-
Notifications
You must be signed in to change notification settings - Fork 11
203 lines (174 loc) · 6.01 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
name: ci
on:
# Makes it possible to trigger via the GitHub UI (Actions tab)
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
defaults:
run:
shell: bash
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: --deny warnings
RUSTFLAGS: --deny warnings
# This disables incremental compilation for workspace packages and path deps.
# All other dependencies including registry deps will still use the incremental cache.
CARGO_INCREMENTAL: 0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rust-test:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --locked --all-features --all-targets
- run: cargo test --locked --all-features --doc
rust-lint:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo clippy --all-features --all-targets --locked
- run: cargo doc --no-deps
rust-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# rustfmt, might change some formatting between versions. This check should
# use the toolchain version from `rust-toolchain.toml` since that is also the
# version invoked during normal development in the repo. The formatting
# shouldn't matter for consumers of Marker. Therefore it's safe to use the
# nightly version of rustfmt
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --check
# This job ensures required packages can be built with a stable toolchain
# except for some special ones that require nightly
rust-check-on-stable:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- run: rm rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# We want a wide range of users to be able to build the project
# if they stick with an old version in their repository yet.
# Therefore we use an older toolchain version here. However,
# we may remove this and track the latest stable version once
# we ship pre-compiled binaries (#193). This way users wouldn't
# need to compile `cargo-marker` from sources and depend on the
# toolchain version that they have installed in their environment.
toolchain: 1.66.0
- run: >-
cargo check
--locked
--workspace
--exclude marker_rustc_driver
--exclude marker_lints
--exclude marker_uitest
# Check for unused dependencies that uses simple regex search,
# meaning it's ⚡️ blazingly ⚡️ fast
rust-unused-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/download/cargo-machete.sh
- run: cargo-machete
# Check the formatting of TOML files in the repository
toml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/download/taplo.sh
- run: taplo fmt --check
# Check for typos in the repository based on a static dictionary
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/download/typos.sh
- run: typos
# Check that the documentation can be built
mdbook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/download/mdbook.sh
- run: mdbook build docs/book
bash-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Check that the release automation works as expected
- run: scripts/release/test.sh
# This check is allowed to fail, while Marker is still unstable. It's mostly
# a sanity check, to make sure we don't have any unintentional API breakage :)
semver-checks:
runs-on: ubuntu-latest
# This CI check isn't required to pass just yet.
# Marker isn't stable so semver breaking changes are allowed.
continue-on-error: true
if: ${{ github.event.pull_request }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: './upstream'
- uses: actions/checkout@v4
with:
path: './downstream'
- run: downstream/scripts/download/cargo-semver-checks.sh
- run: >-
cargo semver-checks
--manifest-path './downstream/Cargo.toml'
--package marker_api
--package marker_utils
--package marker_uitest
--baseline-root './upstream'
--default-features
--release-type minor
# Check that the Github Action works
github-action-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Make sure we cover all operating systems supported by Github Actions
os:
- windows-2019
- windows-2022
- ubuntu-20.04
- ubuntu-22.04
- macos-13
- macos-12
- macos-11
steps:
- uses: actions/checkout@v4
# This action downloads the latest released version of `cargo-marker`,
# and installs it into `$PATH`.
#
# Because `marker_lints` in this repo depends on the next dev version of
# `marker_api` it won't be compatible with the latest released `marker_api`,
# so there is no sense in actually running `cargo marker check` here.
# Therefore we set `install-only` to skip running a command.
#
# At least this checks that our installation script works as expected.
- uses: ./
with:
install-only: true
# +stable is to force using the pre-installed `cargo` on the runner instead of
# what's specified in `rust-toolchain.toml`
- run: cargo +stable marker --version