Skip to content

Commit

Permalink
Compiling bench
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacarte committed Nov 21, 2023
1 parent d68e389 commit 346c43c
Showing 1 changed file with 154 additions and 0 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/ci_bencher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# One approach to testing changes to the asset upload to release process is to:
# 1. Fork this repo to your personal account
# 2. Go into the repo settings on your fork, go to _Actions_, go to _General_, under _Workflow permissions_, select _Read and Write permissions_, then _Save_
# 3. Add your fork as a new remote and push your branch to it
# 4. Publish a release in your personal fork with the target of the release set to the branch with your changes
# 5. Confirm the workflow completes and that assets are attached to the release as expected

name: Build tool for benching wasm-mutate mutations

on:
workflow_dispatch:
# Build and attach assets to any published releases
release:
types:
- published
# Test on main
push:
branches:
- main
paths:
- "host_based/bench/**"


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true



jobs:

compile_cli:
name: compile_cli-${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: host_based/target/x86_64-unknown-linux-gnu/release/bench
asset_name: bench-all-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
features: --features default
target: x86_64-unknown-linux-gnu
# - name: linux-arm64
#os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
# path: target/aarch64-unknown-linux-gnu/release/dtw-tools
# asset_name: dtw-tools-arm-linux-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: host_based/target/x86_64-apple-darwin/release/bench
asset_name: bench-all-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --features default
target: x86_64-apple-darwin



- name: linux-runtime
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: host_based/target/x86_64-unknown-linux-gnu/release/bench
asset_name: bench-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
features: --no-default-features --features only-runtime
target: x86_64-unknown-linux-gnu
# - name: linux-arm64
#os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
# path: target/aarch64-unknown-linux-gnu/release/dtw-tools
# asset_name: dtw-tools-arm-linux-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: aarch64-unknown-linux-gnu
- name: macos-runtime
os: macos-latest
path: host_based/target/x86_64-apple-darwin/release/bench
asset_name: bench-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
features: --no-default-features --features only-runtime
target: x86_64-apple-darwin
#- name: windows
# os: windows-latest
# path: target\x86_64-pc-windows-msvc\release\dtw-tools.exe
# asset_name: dtw-tools-x86_64-windows-${{ github.event.release.tag_name }}
# shasum_cmd: sha256sum
# target: x86_64-pc-windows-msvc

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- uses: ./.github/actions/install-rust

# Should no-op except for macos-arm and linux-arm cases where that target won't be installed
- name: Install target
run: rustup update && rustup target add wasm32-wasi wasm32-unknown-unknown ${{ matrix.target }}

- name: Install target nightly
run: rustup update nightly && rustup +nightly target add wasm32-wasi wasm32-unknown-unknown ${{ matrix.target }}

# wasmtime-fiber and binaryen fail to compile without this
- name: Install Aarch64 GCC toolchain
run: sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu || true
if: matrix.target == 'aarch64-unknown-linux-gnu'


- name: Build CLI ${{ matrix.os }}
run: cd wasmtime && git submodule update --init && cd ../ && cd host_based/bench && cargo +nightly build --release --target ${{ matrix.target }} ${{ matrix.features }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- name: Archive assets
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz

- name: Upload assets to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.asset_name }}.gz
path: ${{ matrix.asset_name }}.gz

- name: Upload assets to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz

- name: Upload assets to fixed release
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run:
gh release upload 0.2.4 ${{ matrix.asset_name }}.gz

- name: Generate asset hash
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.asset_name }}.gz.sha256
path: ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to fixed release
if: github.event_name == 'workflow_dispatch'
env:
GITHUB_TOKEN: ${{ secrets.GH }}
run: gh release upload 0.2.4 ${{ matrix.asset_name }}.gz.sha256

0 comments on commit 346c43c

Please sign in to comment.