v3.1.1 #259
Workflow file for this run
This file contains hidden or 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: CI/CD | |
on: [push, pull_request] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cargo Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Build project | |
run: cargo build --workspace --release | |
- name: Build project with all features | |
run: cargo build --workspace --all-features | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup component add rustfmt clippy | |
- name: Cargo Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Run tests | |
run: cargo test --workspace | |
deploy_release: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install crates.io auth token | |
uses: rust-lang/crates-io-auth-action@v1 | |
id: auth | |
- name: Publish release | |
run: | | |
cargo publish --workspace | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} | |
attach_binaries: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
tool: cargo | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
tool: cargo | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
tool: RUSTFLAGS="-Ctarget-feature=-outline-atomics" cross | |
- target: riscv64gc-unknown-linux-gnu | |
os: ubuntu-latest | |
tool: cross | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
tool: cargo | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
tool: cross | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
tool: cargo | |
- target: aarch64-pc-windows-msvc | |
os: windows-latest | |
tool: cross | |
needs: [build, test] | |
runs-on: ${{ matrix.os }} | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
run: | | |
rustup target add ${{ matrix.target }} | |
rustup component add rust-src | |
- name: Install cross | |
if: contains(matrix.tool, 'cross') | |
run: cargo install cross | |
- name: Build binary | |
run: ${{ matrix.tool }} build --workspace --release --locked --target=${{ matrix.target }} -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort | |
- name: Upload binary | |
if: matrix.os != 'windows-latest' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/${{ matrix.target }}/release/rmz | |
asset_name: ${{ matrix.target }}-rmz | |
tag: ${{ github.ref }} | |
- name: Upload binary | |
if: matrix.os != 'windows-latest' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/${{ matrix.target }}/release/cpz | |
asset_name: ${{ matrix.target }}-cpz | |
tag: ${{ github.ref }} | |
- name: Upload binary | |
if: matrix.os == 'windows-latest' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/${{ matrix.target }}/release/rmz.exe | |
asset_name: ${{ matrix.target }}-rmz.exe | |
tag: ${{ github.ref }} | |
- name: Upload binary | |
if: matrix.os == 'windows-latest' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/${{ matrix.target }}/release/cpz.exe | |
asset_name: ${{ matrix.target }}-cpz.exe | |
tag: ${{ github.ref }} |