Alloy #1117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build Test" | |
on: | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- "**/README.md" | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
paths-ignore: | |
- "**/README.md" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
targets: wasm32-unknown-unknown, i686-unknown-linux-gnu | |
- name: Install Just command runner | |
uses: extractions/setup-just@v1 | |
- name: install ic-wasm | |
run: | | |
wget https://github.com/dfinity/ic-wasm/releases/download/0.8.1/ic-wasm-linux64 -O /usr/local/bin/ic-wasm | |
chmod +x /usr/local/bin/ic-wasm | |
- name: setup environment | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib | |
- name: check rust code style | |
run: | | |
just check_code | |
- name: build | |
run: | | |
just build | |
- name: test | |
run: | | |
just test | |
env: | |
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | |
- name: 32bits test | |
run: | | |
just test_i686 | |
env: | |
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | |
release-binaries: | |
if: ${{github.ref_type == 'tag'}} | |
name: Release - ${{ matrix.platform.release_for }} | |
strategy: | |
matrix: | |
platform: | |
- release_for: Linux-x86_64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
bin: register-evm-agent | |
- release_for: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
bin: register-evm-agent.exe | |
- release_for: MacOS-x86_64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
bin: register-evm-agent | |
- release_for: MacOS-M1 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
bin: register-evm-agent | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
target: ${{ matrix.platform.target }} | |
command: build | |
strip: true | |
args: "--release -p register_evm_agent" | |
- name: Prepare artifact files | |
run: | | |
mkdir -p ./target/artifact | |
mv target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} ./target/artifact/${{ matrix.platform.bin }} | |
- name: "Uploading artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
retention-days: 1 | |
name: ${{ matrix.platform.release_for }} | |
path: ./target/artifact/* | |
publish-release: | |
if: ${{github.ref_type == 'tag'}} | |
needs: [release-binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Artifact Linux" | |
uses: actions/download-artifact@v3 | |
with: | |
name: Linux-x86_64 | |
path: ./linux | |
- name: "Artifact MacOs" | |
uses: actions/download-artifact@v3 | |
with: | |
name: MacOS-x86_64 | |
path: ./macos | |
- name: "Artifact MacOs M1" | |
uses: actions/download-artifact@v3 | |
with: | |
name: MacOS-M1 | |
path: ./macos-m1 | |
- name: "Artifact Windows" | |
uses: actions/download-artifact@v3 | |
with: | |
name: Windows-x86_64 | |
path: ./win | |
- run: | | |
mkdir -p .release | |
cd .release | |
mv ../linux/register-evm-agent ./register-evm-agent-nix | |
mv ../macos/register-evm-agent ./register-evm-agent-darwin | |
mv ../macos-m1/register-evm-agent ./register-evm-agent-m1 | |
mv ../win/register-evm-agent.exe . | |
ls -lah . | |
- name: Releasing | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
.release/* |