Skip to content

Release Build

Release Build #29

Workflow file for this run

name: Release Build
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
env:
SUBWASM_VERSION: 0.16.1
jobs:
checks-and-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
run: rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Check all features compilation
run: cargo check --verbose
- name: Run all tests
run: cargo test --verbose
native-linux:
needs: checks-and-tests
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
run: |
rustup target add aarch64-unknown-linux-gnu
rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Install zig
uses: korandoru/setup-zig@v1
with:
zig-version: "master"
- name: Install zigbuild
run: cargo install cargo-zigbuild
- name: Build optimized binary
run: |
cargo build --release --target x86_64-unknown-linux-gnu
cargo zigbuild --release --target aarch64-unknown-linux-gnu
- uses: actions/upload-artifact@master
with:
name: swanky-node-ubuntu-latest-x86_64
path: target/x86_64-unknown-linux-gnu/release/swanky-node
- uses: actions/upload-artifact@master
with:
name: swanky-node-ubuntu-latest-aarch64
path: target/aarch64-unknown-linux-gnu/release/swanky-node
native-macos:
needs: checks-and-tests
runs-on: macos-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
submodules: true
- name: Install Protoc
run: brew install protobuf
- name: Install & display rust toolchain
run: |
rustup target add aarch64-apple-darwin
rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Build optimized binary
run: |
cargo build --release --target x86_64-apple-darwin
cargo build --release --target aarch64-apple-darwin
mkdir -p ./artifacts/swanky-node-mac/
lipo ./target/x86_64-apple-darwin/release/swanky-node ./target/aarch64-apple-darwin/release/swanky-node -create -output ./artifacts/swanky-node-mac/swanky-node
- uses: actions/upload-artifact@master
with:
name: swanky-node-macOS-latest-universal
path: artifacts/swanky-node-mac/swanky-node
publish-release-draft:
needs: [native-linux, native-macOS]
runs-on: ubuntu-latest
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release Draft
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body_path: .github/release-draft.md
draft: true
upload-binaries:
needs: publish-release-draft
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu]
arch: [aarch64, x86_64]
include:
- os: macOS
arch: universal
steps:
- name: Create download folder
run: |
mkdir -p ${{ matrix.os }}-${{ matrix.arch }}-bin
- name: Download pre-built collator binary
uses: actions/download-artifact@v3
with:
name: swanky-node-${{ matrix.os }}-latest-${{ matrix.arch }}
path: ${{ matrix.os }}-${{ matrix.arch }}-bin
- name: Make binary executable and tar gzip
run: |
cd ${{ matrix.os }}-${{ matrix.arch }}-bin
chmod +x swanky-node
tar zcvf swanky-node.tar.gz swanky-node
- name: Upload binary artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish-release-draft.outputs.upload_url }}
asset_path: ${{ matrix.os }}-${{ matrix.arch }}-bin/swanky-node.tar.gz
asset_name: swanky-node-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip