Files
Dylan M. Taylor c963b26abd ci: use StepSecurity's maintained actions (#4)
Each third-party action that StepSecurity publishes a secure drop-in
replacement for now uses that replacement, pinned to a commit with its
version as a comment. Versions follow what we used: the newest
StepSecurity release in the same major, or the closest major they
publish. dtolnay/rust-toolchain refs that named a toolchain (stable,
nightly, 1.76) become the replacement's `toolchain` input.
2026-11-11 14:57:40 -05:00

131 lines
3.5 KiB
YAML

name: cargo-generate
on:
pull_request:
# Runs on `trunk` to save the build caches that pull requests read.
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
env:
#
# Dependency versioning
#
# This is the MSRV used by `wgpu` itself.
WGPU_MSRV: "1.87"
RUSTFLAGS: -D warnings
# Every time a PR is pushed to, cancel any previous jobs. This
# makes us behave nicer to github and get faster turnaround times
# on PRs that are pushed to multiple times in rapid succession.
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
discover-standalone-examples:
permissions: {}
timeout-minutes: 5
runs-on: ubuntu-24.04
name: "Discover Standalone Examples"
outputs:
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Find standalone examples
id: discover
run: |
matrix=$(jq -nc --args '{
include: [$ARGS.positional[] | rtrimstr("/") | {
path: .,
name: (split("/")[-1] | gsub("_"; "-"))
}]
}' examples/standalone/*/)
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
echo "$matrix"
cargo-generate:
permissions: {}
timeout-minutes: 5
runs-on: ubuntu-24.04
needs: discover-standalone-examples
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover-standalone-examples.outputs.matrix) }}
name: "${{ matrix.name }}"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# We can't rely on an override here, as that would only set
# the toolchain for the current directory, not the newly generated project.
- name: Install repo MSRV toolchain
run: |
rustup toolchain install ${{ env.WGPU_MSRV }} --no-self-update --profile=minimal
cargo -V
- name: Disable debug symbols
shell: bash
run: |
mkdir -p .cargo
cat <<EOF >> .cargo/config.toml
[profile.dev]
debug = false
EOF
- name: Caching
uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
with:
key: cargo-generate-${{ matrix.name }}
env-vars: ImageVersion
save-if: ${{ github.ref == 'refs/heads/trunk' }}
- name: Install `cargo-generate`
uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32
with:
tool: cargo-generate
- name: Run `cargo-generate`
env:
MATRIX_NAME: ${{ matrix.name }}
MATRIX_PATH: ${{ matrix.path }}
run: |
cd ..
cargo generate --path wgpu --name ${MATRIX_NAME} ${MATRIX_PATH}
- name: Check generated files
env:
MATRIX_NAME: ${{ matrix.name }}
run: |
cd ../${MATRIX_NAME}/
cat <<EOF >> Cargo.toml
[patch.crates-io]
wgpu = { path = "../wgpu/wgpu" }
EOF
cargo +${{ env.WGPU_MSRV }} check