build-release-binary #18
Workflow file for this run
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-release-binary | |
on: | |
release: | |
types: [published] | |
env: | |
RUSTFLAGS: "-Dwarnings -C target-cpu=native" | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
binary_name: expander-macos | |
- os: 7950x3d | |
feature: avx2 | |
binary_name: expander-linux-avx2 | |
- os: 7950x3d | |
feature: avx512f | |
binary_name: expander-linux-avx512 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# The prefix cache key, this can be changed to start a new cache manually. | |
prefix-key: "mpi-v5.0.5" # update me if brew formula changes to a new version | |
- name: Install MPI | |
run: python3 ./scripts/install.py | |
- name: Set RUSTFLAGS for AVX | |
if: matrix.feature != '' | |
run: echo "RUSTFLAGS=$RUSTFLAGS -C target-feature=+${{ matrix.feature }}" >> $GITHUB_ENV | |
- name: Prepare binary | |
run: cargo build --release --bin expander-exec | |
- name: Upload release asset | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs').promises; | |
github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: ${{ github.event.release.id }}, | |
name: '${{ matrix.binary_name }}', | |
data: await fs.readFile('target/release/expander-exec') | |
}); |