-
Notifications
You must be signed in to change notification settings - Fork 46
213 lines (205 loc) · 7.95 KB
/
Copy pathci.yml
File metadata and controls
213 lines (205 loc) · 7.95 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# Cancel in-progress runs when a new push is made to the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Force colored cargo output in CI logs.
CARGO_TERM_COLOR: always
jobs:
# ==========================================================================
# Lint (runs once, not per-platform). Pinned to macos-26 because
# `cargo clippy --all-features` activates `macos_26_0`, which pulls in
# SDK symbols (MTLSamplerReductionMode, reactiveTextureUsage, …) that
# don't exist on the macos-latest (macOS 14) runner.
# ==========================================================================
lint:
runs-on: macos-26
name: Lint
steps:
- uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-lint-cargo-
- name: Run clippy
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Check formatting
run: cargo fmt --check
# ==========================================================================
# Build & Test (per-platform)
# ==========================================================================
build:
strategy:
fail-fast: false
matrix:
include:
# NOTE: macos-14 + macos-15 dropped from the matrix because the
# current apple-metal-rs (v0.7.x) Swift bridge uses macOS 26+
# APIs (MTLLogState, MTLResidencySet, MTL4*,
# MTLSamplerDescriptor.reductionMode, etc.) without availability
# guards. The bridge only compiles cleanly against the macOS 26
# SDK. screencapturekit's effective minimum-supported macOS for
# CI is therefore 26.0 until apple-metal-rs gates its post-15
# APIs behind `#available(macOS 15, *)` / `(macOS 26, *)`.
- os: macos-26
name: macOS 26 (Tahoe) ARM64
features: "async,macos_26_0"
assert_symbol_absent: ""
assert_symbol_present: "SCScreenshotConfiguration"
# Cross-version: build on macOS 26 SDK with only macOS 15 features
# to verify no macOS 26 symbols leak into the binary (issue #127)
- os: macos-26
name: macOS 26 (Tahoe) cross-version (macos_15_2 only)
features: "async,macos_15_2"
assert_symbol_absent: "SCScreenshotConfiguration"
assert_symbol_present: ""
# Cross-arch: verify x86_64 cross-compilation on the ARM64 runner
- os: macos-26
name: macOS 26 Cross-compile (x86_64 on ARM64)
features: "async,macos_15_2"
cross_target: x86_64-apple-darwin
assert_symbol_absent: ""
assert_symbol_present: ""
runs-on: ${{ matrix.os }}
name: Build - ${{ matrix.name }}
needs: [lint]
env:
TARGET_FLAG: ${{ matrix.cross_target && format('--target {0}', matrix.cross_target) || '' }}
steps:
- uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.cross_target || '' }}
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-cargo-
- name: Build (default features)
run: cargo build --verbose $TARGET_FLAG
- name: Build with version-specific features (${{ matrix.features }})
run: cargo build --verbose --features "${{ matrix.features }}" $TARGET_FLAG
- name: Run tests (default features)
if: ${{ !matrix.cross_target }}
run: cargo test --verbose
- name: Run tests with version-specific features
if: ${{ !matrix.cross_target }}
run: cargo test --verbose --features "${{ matrix.features }}"
- name: Verify macOS 26 symbols are absent (cross-version safety)
if: matrix.assert_symbol_absent != ''
run: ./scripts/check_symbols.sh --assert-absent "${{ matrix.assert_symbol_absent }}"
- name: Verify macOS 26 symbols are present
if: matrix.assert_symbol_present != ''
run: ./scripts/check_symbols.sh --assert-present "${{ matrix.assert_symbol_present }}"
# ==========================================================================
# Memory Leak Check (per-platform, runs parallel to build)
# ==========================================================================
leak-check:
strategy:
fail-fast: false
matrix:
include:
# Only macos-26 — see comment above the build matrix for why
# macos-14 / macos-15 are no longer compatible with apple-metal
# v0.7.x.
- os: macos-26
name: macOS 26 (Tahoe) ARM64
features: "async,macos_26_0"
runs-on: ${{ matrix.os }}
name: Leak Check - ${{ matrix.name }}
needs: [lint]
steps:
- uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.os }}-leak-check-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-leak-check-cargo-
- name: Build leak check example
run: cargo build --example 15_memory_leak_check --features "${{ matrix.features }}"
- name: Run memory leak check
run: cargo run --example 15_memory_leak_check --features "${{ matrix.features }}"
# ==========================================================================
# Release (only on main, after successful build and leak-check).
# Pinned to macos-26 so `cargo publish --verify` builds against the macOS
# 26 SDK that apple-metal 0.6.x already requires (see build matrix note).
# ==========================================================================
release-pr:
runs-on: macos-26
needs: [lint, build, leak-check]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: release
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5.129
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
runs-on: macos-26
needs: [lint, build, leak-check]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: release
permissions:
contents: write
concurrency:
group: release-plz-publish-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5.129
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}