-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (144 loc) · 5.97 KB
/
ci.yaml
File metadata and controls
152 lines (144 loc) · 5.97 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
name: CI
# Cancel PR actions on new commits
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: test
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04, windows-2022, macOS-latest ]
integration: [ "cargo-gpu", "spirv-builder" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Install Vulkan SDK
uses: jakoch/install-vulkan-sdk-action@v1
with:
vulkan_version: 1.4.321.0
install_runtime: true
cache: true
stripdown: true
# FIXME(eddyb) consider using lavapipe instead, or even trying both.
install_swiftshader: true
# install_lavapipe: true
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- if: ${{ runner.os == 'Windows' && matrix.integration == 'spirv-builder' }}
name: Windows - set rustflags to make it compile
run: echo "RUSTFLAGS=-Zshare-generics=off" >> "$GITHUB_ENV"
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked --target $TARGET
- name: xtask build
run: cd xtask && cargo build
- name: xtask generate
# generate all variants, since `--clean` deletes `generated/`, not generating all of them will cause changes
run: cargo xtask generate --clean
- name: check generated files are up-to-date
run: |
git add .
git diff --cached
# if this fails, the files committed don't match what should have been generated
git diff --quiet && git diff --cached --quiet
# no --locked, templates need to generate their lockfile
- name: cargo fetch
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fetch --target $TARGET"
- name: cargo build
run: cargo xtask generate ${{ matrix.integration }} -x "cargo build"
# graphics templates have no tests by default
- name: cargo test
run: cargo xtask generate ${{ matrix.integration }} -x "cargo nextest run --no-tests warn"
# This allows us to have a single job we can branch protect on, rather than needing
# to update the branch protection rules when the test matrix changes
test_success:
runs-on: ubuntu-24.04
needs: [test, xtask-test, lint]
# Hack for buggy GitHub Actions behavior with skipped checks: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
if: ${{ always() }}
steps:
# Another hack is to actually check the status of the dependencies or else it'll fall through
- run: |
echo "Checking statuses..."
[[ "${{ needs.test.result }}" == "success" ]] || exit 1
[[ "${{ needs.xtask-test.result }}" == "success" ]] || exit 1
[[ "${{ needs.lint.result }}" == "success" ]] || exit 1
xtask-test:
name: xtask test & lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked --target $TARGET
- name: xtask build
run: cd xtask && cargo build
- name: xtask test
run: cd xtask && cargo nextest run
- name: xtask fmt
run: cd xtask && cargo fmt --all -- --check
- name: xtask clippy
run: cd xtask && cargo clippy --all-targets -- -D warnings
lint:
name: lint
strategy:
fail-fast: false
matrix:
integration: [ "cargo-gpu", "spirv-builder" ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
# just need a random command that forces the installation of rust-toolchain
# figure out native target triple while we're at it
- name: install rust-toolchain
run: echo "TARGET=$(rustc --print host-tuple)" >> "$GITHUB_ENV"
- name: Install rustup components
run: rustup component add rustfmt clippy
- name: xtask cargo fetch --locked
run: cd xtask && cargo fetch --locked
- name: xtask build
run: cd xtask && cargo build
- name: xtask generate
run: cargo xtask generate ${{ matrix.integration }}
# no --locked, templates need to generate their lockfile
- name: cargo fetch
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fetch"
- name: fmt
run: cargo xtask generate ${{ matrix.integration }} -x "cargo fmt --all -- --check"
- name: clippy
run: cargo xtask generate ${{ matrix.integration }} -x "cargo clippy --all-targets -- -D warnings"
defaults:
run:
shell: bash