ci: declare secrets #1
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 | ||
on: | ||
workflow_call: | ||
secrets: | ||
GITHUB_TOKEN: | ||
required: true | ||
jobs: | ||
msrv: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
rust-version: ${{ steps.get-version.outputs.rust-version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Extract version | ||
id: get-version | ||
run: | | ||
MSRV=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].rust_version') | ||
echo "rust-version=$MSRV" >> $GITHUB_OUTPUT | ||
- name: Show version | ||
run: | | ||
echo "MSRV: ${{ steps.get-version.outputs.rust-version }}" | ||
preflight: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: webiny/action-conventional-commits@v1.3.0 | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: obi1kenobi/cargo-semver-checks-action@v2 | ||
- name: Check formatting | ||
run: | | ||
cargo fmt --check | ||
check: | ||
needs: | ||
- msrv | ||
- preflight | ||
strategy: | ||
matrix: | ||
rust: | ||
- stable | ||
- ${{ needs.msrv.outputs.rust-version }} | ||
os: | ||
- ubuntu-22.04 | ||
- windows-2022 | ||
- macos-14 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Install Rust ${{ matrix.rust }} | ||
run: | | ||
rustup install ${{ matrix.rust }} --no-self-update --component clippy | ||
- name: Clippy | ||
run: cargo +${{ matrix.rust }} clippy --all-targets --tests --bins --all -- -D warnings | ||
- name: Test | ||
run: cargo +${{ matrix.rust }} test | ||
- name: Install binstall | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | ||
- name: Install cargo-all-features | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cargo binstall -y cargo-all-features --force | ||
- name: Check (all features) | ||
run: | | ||
cargo check-all-features |