Skip to content

Cuttlefish v1.3.0.2 #174

Cuttlefish v1.3.0.2

Cuttlefish v1.3.0.2 #174

name: Release artifacts
on:
workflow_dispatch:
release:
types: [published]
jobs:
setup_version_properties:
name: Setup version properties
runs-on: ubuntu-22.04
outputs:
VERSION_BRANCH: ${{ steps.setup_version_properties.outputs.VERSION_BRANCH }}
VERSION_BUILD: ${{ steps.setup_version_properties.outputs.VERSION_BUILD }}
VERSION_COMMIT: ${{ steps.setup_version_properties.outputs.VERSION_COMMIT }}
VERSION_DISPLAY: ${{ steps.setup_version_properties.outputs.VERSION_DISPLAY }}
VERSION_TAG: ${{ steps.setup_version_properties.outputs.VERSION_TAG }}
VERSION_LAST_TAG: ${{ steps.setup_version_properties.outputs.VERSION_LAST_TAG }}
steps:
- uses: RDXWorks-actions/checkout@main
with:
fetch-depth: 0
- name: Setup version properties
id: setup_version_properties
uses: ./.github/actions/setup-version-properties
build-core-rust:
continue-on-error: true
runs-on: '${{ matrix.os }}'
timeout-minutes: 60
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
artifact: 'libcorerust.dylib'
zipname: 'arch-darwin-x86_64'
- os: macos-latest
target: aarch64-apple-darwin
artifact: 'libcorerust.dylib'
zipname: 'arch-darwin-aarch64'
# We use ubuntu-22.04 rather than ubuntu-latest to get a fixed GLIBC dependency
# We can update this when we update our minimum supported linux version
- os: ubuntu-22.04 # Fix GLIBC
target: x86_64-unknown-linux-gnu
artifact: 'libcorerust.so'
zipname: 'arch-linux-x86_64'
- os: ubuntu-22.04 # Fix GLIBC
target: aarch64-unknown-linux-gnu
zipname: 'arch-linux-aarch64'
artifact: 'libcorerust.so'
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: 'corerust.dll'
zipname: 'arch-windows-x86_64-msvc'
- os: windows-latest
target: x86_64-pc-windows-gnu
artifact: 'corerust.dll'
zipname: 'arch-windows-x86_64-gnu'
steps:
- uses: RDXWorks-actions/checkout@main
with:
lfs: true
- uses: RDXWorks-actions/cache@main
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: RDXWorks-actions/cache@main
with:
path: ~/.cargo/git
key: '${{ runner.os }}-${{ matrix.target }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: RDXWorks-actions/cache@main
with:
path: target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: RDXWorks-actions/toolchain@master
with:
profile: minimal
toolchain: stable
override: true
- name: Set git config for long paths
if: matrix.os == 'windows-latest'
run: |
git config --system core.longpaths true
- name: Install Rust Targets
run: |
rustup target install ${{ matrix.target }}
- if: matrix.os == 'windows-latest'
name: Build dependencies windows
run: |
rustup toolchain install stable-gnu
rustup set default-host ${{ matrix.target }}
- if: matrix.os == 'ubuntu-22.04' # Fix GLIBC
name: Build dependencies ubuntu
run: |
sudo apt-get update -y && sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# sudo apt install -y gcc-i686-linux-gnu g++-i686-linux-gnu
- name: Build core-rust
run: |
cd core-rust
cargo build --release --target ${{ matrix.target }}
echo "ls ./target/${{ matrix.target }}/release"
ls ./target/${{ matrix.target }}/release/
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: "${{ matrix.target == 'aarch64-unknown-linux-gnu' && '' || 'aarch64-linux-gnu-gcc' }}"
- uses: RDXWorks-actions/upload-artifact@main
with:
name: libcorerust-${{ matrix.target }}
path: ./core-rust/target/${{ matrix.target }}/release/${{ matrix.artifact }}
if-no-files-found: error
publish-core-rust:
if: github.event_name == 'release'
needs:
- build-core-rust
- setup_version_properties
permissions:
contents: write
runs-on: 'ubuntu-22.04' # Fix GLIBC
continue-on-error: true
strategy:
matrix:
include:
- target: x86_64-apple-darwin
artifact: 'libcorerust.dylib'
zipname: 'arch-darwin-x86_64'
- target: aarch64-apple-darwin
artifact: 'libcorerust.dylib'
zipname: 'arch-darwin-aarch64'
- target: x86_64-unknown-linux-gnu
artifact: 'libcorerust.so'
zipname: 'arch-linux-x86_64'
- target: aarch64-unknown-linux-gnu
artifact: 'libcorerust.so'
zipname: 'arch-linux-aarch64'
- target: x86_64-pc-windows-msvc
artifact: 'corerust.dll'
zipname: 'arch-windows-x86_64-msvc'
- target: x86_64-pc-windows-gnu
artifact: 'corerust.dll'
zipname: 'arch-windows-x86_64-gnu'
steps:
- uses: RDXWorks-actions/checkout@main
with:
lfs: true
- uses: RDXWorks-actions/download-artifact@main
with:
name: libcorerust-${{ matrix.target }}
path: libcorerust-${{ matrix.target }}
- name: Build core-rust
run: |
ls -lah libcorerust-${{ matrix.target }}
zip -j babylon-node-rust-${{ matrix.zipname }}-release-${{ needs.setup_version_properties.outputs.VERSION_TAG }}.zip libcorerust-${{ matrix.target }}/${{ matrix.artifact }}
- name: Upload distribution zip
if: github.event_name == 'release'
uses: RDXWorks-actions/action-gh-release@master
with:
files: |
babylon-node-rust-${{ matrix.zipname }}-release-${{ needs.setup_version_properties.outputs.VERSION_TAG }}.zip
publish-distribution-zip:
if: github.event_name == 'release'
name: Build and Upload Application Binary
permissions:
contents: write
runs-on: ubuntu-22.04 # Fix GLIBC
needs:
- setup_version_properties
environment: publish-artifacts
steps:
- name: Dump context
uses: RDXWorks-actions/ghaction-dump-context@master
- uses: RDXWorks-actions/checkout@main
with:
ref: ${{ needs.setup_version_properties.outputs.VERSION_TAG }}
fetch-depth: 0
- name: Set up JDK 17
uses: RDXWorks-actions/setup-java@main
with:
distribution: "zulu"
java-version: "17"
- name: Cache Gradle packages
uses: RDXWorks-actions/cache@main
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build radixdlt
uses: ./.github/actions/gradle-task
with:
is_release: true
gradle_command: clean build -x test
- name: List files
run: |
ls -la ./core/build/distributions/
mv ./core/build/distributions/core-${{ needs.setup_version_properties.outputs.VERSION_TAG }}.zip babylon-node-${{ needs.setup_version_properties.outputs.VERSION_TAG }}.zip
- name: Upload distribution zip
uses: RDXWorks-actions/action-gh-release@master
with:
files: |
babylon-node-${{ needs.setup_version_properties.outputs.VERSION_TAG }}.zip
snyk-sbom:
if: github.event_name == 'release'
name: SBOM
runs-on: ubuntu-22.04 # Fix GLIBC
permissions: write-all
steps:
- uses: RDXWorks-actions/checkout@main
- uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: ${{ secrets.AWS_ROLE_NAME_SNYK_SECRET }}
app_name: 'babylon-node'
step_name: 'snyk-sbom'
secret_prefix: 'SNYK'
secret_name: ${{ secrets.AWS_SECRET_NAME_SNYK }}
parse_json: true
- name: Generate SBOM
uses: RDXWorks-actions/snyk-actions/gradle-jdk17@master
with:
args: --all-projects --org=${{ env.SNYK_NETWORK_ORG_ID }} --format=cyclonedx1.4+json > sbom.json
command: sbom
- name: Upload SBOM
uses: RDXWorks-actions/action-gh-release@master
with:
files: |
sbom.json