Merge pull request #38 from fpco/arm64-ci #91
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: Rust | |
on: | |
push: | |
branches: [main] | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUST_BACKTRACE: short | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
checks: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
toolchain: | |
- 1.79.0 | |
- stable | |
- nightly | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ matrix.toolchain }} | |
- name: Build | |
run: cargo build | |
- name: Run tests | |
run: cargo test | |
- name: clippy | |
run: cargo clippy -- --deny "warnings" | |
- name: fmt | |
run: cargo fmt -- --check | |
linux-binary: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.79.0 | |
components: clippy, rustfmt | |
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary | |
- name: Install musl tools | |
run: sudo apt-get install -y musl-tools | |
- name: Build (x86) | |
run: | | |
cargo build --release --target x86_64-unknown-linux-musl | |
strip target/x86_64-unknown-linux-musl/release/amber | |
- name: Build (ARM64) | |
run: cross build --release --target aarch64-unknown-linux-musl | |
- name: Rename | |
run: | | |
mkdir artifacts | |
cp target/x86_64-unknown-linux-musl/release/amber artifacts/amber-x86_64-unknown-linux-musl | |
cp target/aarch64-unknown-linux-musl/release/amber artifacts/amber-aarch64-unknown-linux-musl | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: artifacts/* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: artifacts/amber-x86_64-unknown-linux-musl | |
generate_release_notes: true | |
macos-binary: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.79.0 | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary | |
- name: Build | |
run: cargo build --release | |
- name: Rename | |
run: | | |
mkdir artifacts | |
cp target/release/amber artifacts/amber-x86_64-apple-darwin | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: artifacts/* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: artifacts/amber-x86_64-apple-darwin | |
generate_release_notes: true | |
windows-binary: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.79.0 | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.79.0-binary | |
- name: Build | |
run: cargo build --release | |
- name: Rename | |
run: | | |
mkdir artifacts | |
cp target/release/amber.exe artifacts/amber-x86_64-pc-windows-gnu.exe | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: artifacts/* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: artifacts/amber-x86_64-pc-windows-gnu.exe | |
generate_release_notes: true |