-
Notifications
You must be signed in to change notification settings - Fork 25
163 lines (155 loc) · 4.59 KB
/
build.yml
File metadata and controls
163 lines (155 loc) · 4.59 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
name: Rust library & CLI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
release:
types: [ published ]
env:
CARGO_TERM_COLOR: always
jobs:
check_format:
name: Run cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check format
run: cargo fmt -- --check
build_workspace:
name: Check and build entire workspace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Update rust toolchain
run: |
rustup update stable
rustup default stable
rustup --version
- name: Cache rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-dev-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check (default members)
run: cargo check
- name: Check with examples
run: cargo check --examples
- name: Check workspace (including pySplashsurf)
run: cargo check --workspace --all-targets
- name: Build (excluding pySplashsurf)
run: cargo build
- name: Run tests
run: cargo test
build_release:
name: Build & test release mode (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
needs: build_workspace
strategy:
fail-fast: false
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm, macos-14, windows-latest]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Update rust toolchain
run: |
rustup update stable
rustup default stable
rustup --version
- name: Cache rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.runner }}-release-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (release)
run: cargo build --release
- name: Test (release)
run: cargo test --release
build_lib_all_features:
name: Build splashsurf_lib with all features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Update rust toolchain
run: |
rustup update stable
rustup default stable
rustup --version
- name: Cache rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-lib-all-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: |
cargo build --package splashsurf_lib --all-targets --all-features
- name: Run tests
run: |
cargo test --package splashsurf_lib --all-features
- name: Run tests release mode
run: |
cargo test --package splashsurf_lib --release --all-features
build_lib_no_default_features:
name: Build splashsurf_lib with no default features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Update rust toolchain
run: |
rustup update stable
rustup default stable
rustup --version
- name: Cache rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-lib-no-default-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: |
cargo build --package splashsurf_lib --all-targets --no-default-features
- name: Run tests
run: |
cargo test --package splashsurf_lib --no-default-features
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
needs: [check_format, build_workspace, build_lib_all_features, build_lib_no_default_features, build_release]
steps:
- uses: actions/checkout@v4
- name: Update rust toolchain
run: |
rustup update stable
rustup default stable
rustup --version
- name: Publish splashsurf_lib
run: |
cargo publish --package splashsurf_lib
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish splashsurf
run: |
cargo publish --package splashsurf
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}