-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (143 loc) · 5.07 KB
/
ci.yaml
File metadata and controls
166 lines (143 loc) · 5.07 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
SLANG_TAG: 2025.18.2
jobs:
# Check formatting.
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check
setup-slang:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
outputs:
slang-dir: ${{ steps.setup.outputs.slang-dir }} # Pass SLANG_DIR to dependent jobs
slang-cache-key: ${{ steps.setup.outputs.slang-cache-key }} # Pass SLANG_DIR to dependent jobs
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Slang
id: cache-slang
uses: actions/cache/restore@v4 # Restore first
with:
path: |
~/.cache/slang # Matches script's default OUTPUT_DIR
key: slang-v$SLANG_TAG-${{ runner.os }}-${{ runner.arch }}
- name: Setup Slang
id: setup
run: |
echo "version=$SLANG_TAG" >> $GITHUB_OUTPUT # Output for cache key
SLANG_DIR=$(./.github/workflows/download_slang.sh --version $SLANG_TAG | grep '^SLANG_DIR=' | cut -d'=' -f2-)
echo "slang-dir=$SLANG_DIR" >> $GITHUB_OUTPUT # Output for dependents
echo "slang-cache-key=slang-v$SLANG_TAG-${{ runner.os }}-${{ runner.arch }}" >> $GITHUB_OUTPUT
echo "SLANG_DIR=$SLANG_DIR" >> $GITHUB_ENV # For this job if needed
- name: Save Slang Cache
if: steps.cache-slang.outputs.cache-hit != 'true' # Only save on miss
uses: actions/cache/save@v4
with:
path: ~/.cache/slang
key: ${{ steps.setup.outputs.slang-cache-key }}
# Run clippy lints.
clippy:
needs: setup-slang # Depends on setup-slang
name: Clippy
runs-on: ubuntu-latest
env:
SLANG_DIR: ${{ needs.setup-slang.outputs.slang-dir }}
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends build-essential curl wget file libssl-dev
- name: Retrieve Cache for Slang
uses: actions/cache/restore@v4
with:
path: ~/.cache/slang
key: ${{ needs.setup-slang.outputs.slang-cache-key }}
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true
- name: Run clippy lints
run: SLANG_DIR=$SLANG_DIR cargo clippy --locked --workspace --all-targets --features runtime -- --deny warnings
# Check documentation.
doc:
needs: setup-slang # Depends on setup-slang
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
env:
SLANG_DIR: ${{ needs.setup-slang.outputs.slang-dir }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends build-essential curl wget file libssl-dev
- name: Retrieve Cache for Slang
uses: actions/cache/restore@v4
with:
path: ~/.cache/slang
key: ${{ needs.setup-slang.outputs.slang-cache-key }}
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true
- name: Check documentation
run: SLANG_DIR=$SLANG_DIR cargo doc --locked --workspace --document-private-items --features runtime --no-deps
# Testing.
test:
needs: setup-slang # Depends on setup-slang
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
env:
SLANG_DIR: ${{ needs.setup-slang.outputs.slang-dir }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
build-essential curl wget file libssl-dev \
libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Retrieve Cache for Slang
uses: actions/cache/restore@v4
with:
path: ~/.cache/slang
key: ${{ needs.setup-slang.outputs.slang-cache-key }}
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true
- name: Run Cargo Tests
run: |
SLANG_DIR=$SLANG_DIR LIBGL_ALWAYS_SOFTWARE=1 cargo test --verbose --features runtime