Skip to content

Add profile in cache key #8

Add profile in cache key

Add profile in cache key #8

Workflow file for this run

name: Build Rust project
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
defaults:
run:
shell: bash
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
cargo_profile: [ "debug", "release" ]
os: [ "windows-latest", "ubuntu-latest" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-${{ matrix.cargo_profile }}"
- name: Print tool versions
run: |
rustup --version
cargo --version
rustc --version
# NOTE: stupid workaround for cargo erroring on "--debug".
- name: Set Cargo extra args
if: ${{ matrix.cargo_profile == 'release' }}
run: echo "CARGO_EXTRA_ARGS=--release" >> $GITHUB_ENV
- name: Run Cargo build
run: |
cargo build \
--verbose \
--features cxx/c++20 \
--features cxx/std \
${{ env.CARGO_EXTRA_ARGS }}
- name: Archive build artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: rust-cxx-${{ matrix.os }}-${{ matrix.cargo_profile }}
path: target/${{ matrix.cargo_profile }}