-
Notifications
You must be signed in to change notification settings - Fork 46
167 lines (160 loc) · 5.4 KB
/
Copy pathci.yml
File metadata and controls
167 lines (160 loc) · 5.4 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# ==========================================================================
# Lint (runs once, not per-platform)
# ==========================================================================
lint:
runs-on: macos-latest
name: Lint
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo
uses: actions/cache@v4
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 -- -D warnings
- name: Check formatting
run: cargo fmt --check
# ==========================================================================
# Build & Test (per-platform)
# ==========================================================================
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
name: macOS 14 (Sonoma) ARM64
features: "async,macos_14_4"
- os: macos-15
name: macOS 15 (Sequoia) ARM64
features: "async,macos_15_2"
- os: macos-13
name: macOS 13 (Ventura) Intel
features: "async,macos_13_0"
runs-on: ${{ matrix.os }}
name: Build - ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
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
- name: Build with version-specific features (${{ matrix.features }})
run: cargo build --verbose --features "${{ matrix.features }}"
- name: Run tests (default features)
run: cargo test --verbose
- name: Run tests with version-specific features
run: cargo test --verbose --features "${{ matrix.features }}"
# ==========================================================================
# Documentation (only on main)
# ==========================================================================
docs:
runs-on: macos-latest
needs: [lint, build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Build documentation
run: cargo doc --no-deps --all-features
- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0; url=screencapturekit/index.html">' > target/doc/index.html
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# ==========================================================================
# Release (only on main, after successful build)
# ==========================================================================
release-pr:
runs-on: macos-latest
needs: [lint, build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: release
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache release-plz
uses: actions/cache@v4
with:
path: ~/.cargo/bin/release-plz
key: ${{ runner.os }}-release-plz
- name: Install release-plz
run: command -v release-plz || cargo install release-plz
- name: Create release PR
run: release-plz release-pr --git-token ${{ secrets.RELEASE_PLZ_TOKEN }}
release:
runs-on: macos-latest
needs: [lint, build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache release-plz
uses: actions/cache@v4
with:
path: ~/.cargo/bin/release-plz
key: ${{ runner.os }}-release-plz
- name: Install release-plz
run: command -v release-plz || cargo install release-plz
- name: Release
run: release-plz release --git-token ${{ secrets.RELEASE_PLZ_TOKEN }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}