-
Notifications
You must be signed in to change notification settings - Fork 3
212 lines (174 loc) · 5.68 KB
/
ci.yml
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
name: ci
run-name: Checks on pull request
on:
push:
branches: [master]
pull_request: null
env:
RUST_VERSION: 1.81.0
NIGHTLY_RUST_VERSION: nightly-2024-09-11
SCIP_VERSION: 8.0.3
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
permissions: read-all
jobs:
trunk-check:
name: Trunk Check
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Trunk Check
uses: trunk-io/trunk-action@v1
clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- name: Provide Access to Private Repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
${{ secrets.SSH_PRIVATE_KEY_BASE }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
build:
name: Cargo Build and Test Workspace
runs-on: ubuntu-latest
steps:
- name: Provide Access to Private Repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
${{ secrets.SSH_PRIVATE_KEY_BASE }}
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Build Workspace
run: cargo build --release
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
locked: true
- name: Run Workspace Tests
run: cargo nextest run --release --locked
- name: Run Experimental Workspace Tests
run: cargo nextest run --release --locked --features experimental-types -- experimental
build_with_solver:
name: Cargo Build and Test Workspace With Solver
runs-on: ubuntu-latest
steps:
- name: Provide Access to Private Repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
${{ secrets.SSH_PRIVATE_KEY_BASE }}
- name: Checkout
uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
allow-softlinks: true
- name: Install dependencies (SCIPOptSuite)
run: |
conda install -y --prefix $CONDA/envs/test --channel conda-forge scip
echo "LD_LIBRARY_PATH=$CONDA/envs/test/lib" >> "${GITHUB_ENV}"
echo "CONDA_PREFIX=$CONDA/envs/test" >> "${GITHUB_ENV}"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Build Workspace With Solver
run: cargo build --release --features solver-scip
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
locked: true
- name: Run Workspace Tests With Solver
run: cargo nextest run --release --locked --features solver-scip
cargo-unused-deps-check:
name: Cargo Unused Dependencies Check
runs-on: ubuntu-latest
steps:
- name: Provide Access to Private Repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }}
${{ secrets.SSH_PRIVATE_KEY_BASE }}
- name: Checkout
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_RUST_VERSION }} # `cargo-udeps` requires nightly to run
- uses: Swatinem/rust-cache@v2
- name: Install cargo-udeps
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-udeps
locked: true
- name: Check Unused Deps
run: cargo udeps --locked --all-targets
cargo-toml-lint-check:
name: Cargo.toml Link Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Install Cargo.toml linter
run: cargo install --locked cargo-toml-lint
- name: Run Cargo.toml linter
run: git ls-files | grep Cargo.toml$ | xargs --verbose -n 1 cargo-toml-lint
publish:
runs-on: ubuntu-latest
needs:
[
trunk-check,
clippy_check,
build,
build_with_solver,
cargo-unused-deps-check,
cargo-toml-lint-check,
]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- uses: katyo/publish-crates@v2
id: publish-crates
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
dry-run: ${{ github.event_name != 'push' }}
ignore-unpublished-changes: true
- name: List published crates
if: ${{ steps.publish-crates.outputs.published != '' }}
run: |
LIST="${{ join(fromJSON(steps.publish-crates.outputs.published).*.name, ', ') }}"
echo "Published crates: $LIST"