-
Notifications
You must be signed in to change notification settings - Fork 1.4k
125 lines (100 loc) · 3.31 KB
/
Copy pathgenerate.yml
File metadata and controls
125 lines (100 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: cargo-generate
on:
push:
branches-ignore: [
# Branches with the `gh-readonly-queue` prefix are used by the
# merge queue, so they are already covered by the `merge_group` event.
"gh-readonly-queue/**",
]
pull_request:
merge_group:
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-latest
name: "Discover Standalone Examples"
outputs:
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- 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-latest
needs: discover-standalone-examples
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover-standalone-examples.outputs.matrix) }}
name: "${{ matrix.name }}"
steps:
- 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: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
key: cargo-generate-${{ matrix.name }}
env-vars: ImageVersion
save-if: ${{ github.ref == 'refs/heads/trunk' }}
- name: Install `cargo-generate`
uses: taiki-e/install-action@43aecc8d72668fbcfe75c31400bc4f890f1c5853 # v2.83.2
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