Run CI build workflow on default branch for caching #5
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" | |
permissions: {} | |
on: | |
# run on default branch to store caches | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
build: | |
name: "cargo build" | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
runner: [ubuntu-22.04, windows-2022, macos-12] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- uses: ./.github/actions/setup-libmagic | |
- id: toolchain | |
uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # doesn't have usual versioned releases/tags | |
with: | |
toolchain: "1.54.0" # hardcoded crate MSRV, see rust-toolchain.toml etc. | |
# minimal profile includes rustc component which includes cargo and rustdoc | |
- uses: rui314/setup-mold@354d1662b2a6f02e5eccc9712f22657621bf645b # does not have recent tags | |
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 | |
- run: cargo +${{ steps.toolchain.outputs.name }} build --all-targets --all-features --verbose | |
test: | |
name: "cargo test" | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
runner: [ubuntu-22.04, windows-2022, macos-12] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- uses: ./.github/actions/setup-libmagic | |
- id: toolchain | |
uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # doesn't have usual versioned releases/tags | |
with: | |
toolchain: "1.54.0" # hardcoded crate MSRV, see rust-toolchain.toml etc. | |
# minimal profile includes rustc component which includes cargo and rustdoc | |
- uses: rui314/setup-mold@354d1662b2a6f02e5eccc9712f22657621bf645b # does not have recent tags | |
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 | |
- run: cargo +${{ steps.toolchain.outputs.name }} test --all-targets --all-features --verbose |