@@ -28,31 +28,25 @@ permissions:
28
28
contents : read
29
29
30
30
jobs :
31
+ # This job does our basic build+test for supported platforms.
31
32
test :
32
- name : test
33
33
env :
34
34
# For some builds, we use cross to test on 32-bit and big-endian
35
35
# systems.
36
36
CARGO : cargo
37
37
# When CARGO is set to CROSS, TARGET is set to `--target matrix.target`.
38
+ # Note that we only use cross on Linux, so setting a target on a
39
+ # different OS will just use normal cargo.
38
40
TARGET :
41
+ # Bump this as appropriate. We pin to a version to make sure CI
42
+ # continues to work as cross releases in the past have broken things
43
+ # in subtle ways.
44
+ CROSS_VERSION : v0.2.5
39
45
runs-on : ${{ matrix.os }}
40
46
strategy :
47
+ fail-fast : false
41
48
matrix :
42
- build :
43
- - pinned
44
- - stable
45
- - stable-32
46
- - stable-mips
47
- - beta
48
- - nightly
49
- - macos
50
- - win-msvc
51
- - win-gnu
52
49
include :
53
- - build : pinned
54
- os : ubuntu-latest
55
- rust : 1.60.0
56
50
- build : stable
57
51
os : ubuntu-latest
58
52
rust : stable
@@ -80,107 +74,161 @@ jobs:
80
74
os : windows-latest
81
75
rust : stable-x86_64-gnu
82
76
steps :
83
-
84
77
- name : Checkout repository
85
78
uses : actions/checkout@v3
86
-
87
79
- name : Install Rust
88
80
uses : dtolnay/rust-toolchain@v1
89
81
with :
90
82
toolchain : ${{ matrix.rust }}
91
-
92
83
- name : Install and configure Cross
93
- if : matrix.target != ''
84
+ if : matrix.os == 'ubuntu-latest' && matrix. target != ''
94
85
run : |
86
+ # In the past, new releases of 'cross' have broken CI. So for now, we
87
+ # pin it. We also use their pre-compiled binary releases because cross
88
+ # has over 100 dependencies and takes a bit to compile.
89
+ dir="$RUNNER_TEMP/cross-download"
90
+ mkdir "$dir"
91
+ echo "$dir" >> $GITHUB_PATH
92
+ cd "$dir"
93
+ curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz"
94
+ tar xf cross-x86_64-unknown-linux-musl.tar.gz
95
+
95
96
# We used to install 'cross' from master, but it kept failing. So now
96
97
# we build from a known-good version until 'cross' becomes more stable
97
98
# or we find an alternative. Notably, between v0.2.1 and current
98
99
# master (2022-06-14), the number of Cross's dependencies has doubled.
99
- cargo install --bins --git https://github.com/rust-embedded/cross --tag v0.2.1
100
+ # cargo install --bins --git https://github.com/rust-embedded/cross --tag v0.2.1
100
101
echo "CARGO=cross" >> $GITHUB_ENV
101
102
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
102
-
103
103
- name : Show command used for Cargo
104
104
run : |
105
- echo "cargo command is: ${{ env.CARGO }}"
106
- echo "target flag is: ${{ env.TARGET }}"
107
-
105
+ echo "cargo command is: $CARGO"
106
+ echo "target flag is: $TARGET"
108
107
- name : Show CPU info for debugging
109
108
if : matrix.os == 'ubuntu-latest'
110
109
run : lscpu
111
-
112
110
- name : Basic build
113
111
run : ${{ env.CARGO }} build --verbose $TARGET
114
-
115
112
- name : Build docs
116
113
run : ${{ env.CARGO }} doc --verbose $TARGET
117
-
118
- # Our dev dependencies evolve more rapidly than we'd like, so only run
119
- # tests when we aren't pinning the Rust version.
120
- #
121
- # Also, our "full" test suite does quite a lot of work, so we only run it
122
- # on one build. Otherwise, we just run the "default" set of tests.
123
114
- name : Run subset of tests
124
- if : matrix.build != 'pinned' && matrix.build != 'stable'
125
115
run : ${{ env.CARGO }} test --verbose --test default $TARGET
126
-
127
- - name : Run full test suite
128
- if : matrix.build == 'stable'
129
- # 'stable' is Linux only, so we have bash.
130
- run : ./test
131
-
132
- - name : Run randomized tests against regexes from the wild
133
- if : matrix.build == 'stable'
134
- run : |
135
- # We run the tests in release mode since it winds up being faster.
136
- RUST_REGEX_RANDOM_TEST=1 ${{ env.CARGO }} test --release --verbose --test crates-regex $TARGET
137
-
138
116
- name : Build regex-syntax docs
139
- if : matrix.build != 'pinned'
140
- run : |
141
- ${{ env.CARGO }} doc --verbose --manifest-path regex-syntax/Cargo.toml $TARGET
142
-
117
+ run : ${{ env.CARGO }} doc --verbose --manifest-path regex-syntax/Cargo.toml $TARGET
143
118
- name : Run subset of regex-syntax tests
144
- if : matrix.build != 'pinned' && matrix.build != 'stable'
145
- run : |
146
- ${{ env.CARGO }} test --verbose --manifest-path regex-syntax/Cargo.toml $TARGET
147
-
148
- - name : Run full regex-syntax test suite
149
- if : matrix.build == 'stable'
150
- run : |
151
- # 'stable' is Linux only, so we have bash.
152
- ./regex-syntax/test
153
-
119
+ run : ${{ env.CARGO }} test --verbose --manifest-path regex-syntax/Cargo.toml $TARGET
154
120
- name : Build regex-automata docs
155
- if : matrix.build != 'pinned'
156
- run : |
157
- ${{ env.CARGO }} doc --verbose --manifest-path regex-automata/Cargo.toml $TARGET
158
-
121
+ run : ${{ env.CARGO }} doc --verbose --manifest-path regex-automata/Cargo.toml $TARGET
159
122
- name : Run subset of regex-automata tests
160
- if : matrix.build != 'pinned' && matrix.build != 'stable'
161
- run : |
162
- ${{ env.CARGO }} test --verbose --manifest-path regex-automata/Cargo.toml $TARGET
163
-
164
- - name : Run full regex-automata test suite
165
- if : matrix.build == 'stable'
166
- run : |
167
- # 'stable' is Linux only, so we have bash.
168
- ./regex-automata/test
169
-
170
- - name : Run regex-capi tests
171
- if : matrix.build == 'stable'
172
- run : |
173
- # 'stable' is Linux only, so we have bash.
174
- ./regex-capi/test
175
-
123
+ if : matrix.build != 'win-gnu' # Just horrifically slow.
124
+ run : ${{ env.CARGO }} test --verbose --manifest-path regex-automata/Cargo.toml $TARGET
176
125
- if : matrix.build == 'nightly'
177
126
name : Run benchmarks as tests
178
127
run : |
179
128
cd bench
180
129
./run rust --no-run --verbose
181
130
131
+ # This job runs a stripped down version of CI to test the MSRV. The specific
132
+ # reason for doing this is that the regex crate's dev-dependencies tend to
133
+ # evolve more quickly. There isn't as tight of a control on them because,
134
+ # well, they're only used in tests and their MSRV doesn't matter as much.
135
+ #
136
+ # It is a bit unfortunate that our MSRV test is basically just "build it"
137
+ # and pass if that works. But usually MSRV is broken by compilation problems
138
+ # and not runtime behavior. So this is in practice good enough.
139
+ msrv :
140
+ runs-on : ubuntu-latest
141
+ steps :
142
+ - name : Checkout repository
143
+ uses : actions/checkout@v3
144
+ - name : Install Rust
145
+ uses : dtolnay/rust-toolchain@v1
146
+ with :
147
+ toolchain : 1.60.0
148
+ - name : Basic build
149
+ run : cargo build --verbose
150
+ - name : Build docs
151
+ run : cargo doc --verbose
152
+
153
+ # This job runs many more tests for the regex crate proper. Basically,
154
+ # it repeats the same test suite for a bunch of different crate feature
155
+ # combinations. There are so many features that exhaustive testing isn't
156
+ # really possible, but we cover as much as is feasible.
157
+ #
158
+ # If there is a feature combo that should be tested but isn't, you'll want to
159
+ # add it to the appropriate 'test' script in this repo.
160
+ testfull-regex :
161
+ runs-on : ubuntu-latest
162
+ steps :
163
+ - name : Checkout repository
164
+ uses : actions/checkout@v3
165
+ - name : Install Rust
166
+ uses : dtolnay/rust-toolchain@v1
167
+ with :
168
+ toolchain : stable
169
+ - name : Run full test suite
170
+ run : ./test
171
+
172
+ # Same as above, but for regex-automata, which has even more crate features!
173
+ testfull-regex-automata :
174
+ runs-on : ubuntu-latest
175
+ steps :
176
+ - name : Checkout repository
177
+ uses : actions/checkout@v3
178
+ - name : Install Rust
179
+ uses : dtolnay/rust-toolchain@v1
180
+ with :
181
+ toolchain : stable
182
+ - name : Run full test suite
183
+ run : ./regex-automata/test
184
+
185
+ # Same as above, but for regex-syntax.
186
+ testfull-regex-syntax :
187
+ runs-on : ubuntu-latest
188
+ steps :
189
+ - name : Checkout repository
190
+ uses : actions/checkout@v3
191
+ - name : Install Rust
192
+ uses : dtolnay/rust-toolchain@v1
193
+ with :
194
+ toolchain : stable
195
+ - name : Run full test suite
196
+ run : ./regex-syntax/test
197
+
198
+ # Same as above, but for regex-capi.
199
+ testfull-regex-capi :
200
+ runs-on : ubuntu-latest
201
+ steps :
202
+ - name : Checkout repository
203
+ uses : actions/checkout@v3
204
+ - name : Install Rust
205
+ uses : dtolnay/rust-toolchain@v1
206
+ with :
207
+ toolchain : stable
208
+ - name : Run full test suite
209
+ run : ./regex-capi/test
210
+
211
+ # Runs miri on regex-automata's test suite. This doesn't quite cover
212
+ # everything. Many tests are disabled when building with miri because of
213
+ # how slow miri runs. But it still gives us decent coverage.
214
+ miri-regex-automata :
215
+ runs-on : ubuntu-latest
216
+ steps :
217
+ - name : Checkout repository
218
+ uses : actions/checkout@v3
219
+ - name : Install Rust
220
+ uses : dtolnay/rust-toolchain@v1
221
+ with :
222
+ # We use nightly here so that we can use miri I guess?
223
+ # It caught me by surprise that miri seems to only be
224
+ # available on nightly.
225
+ toolchain : nightly
226
+ components : miri
227
+ - name : Run full test suite
228
+ run : cargo miri test --manifest-path regex-automata/Cargo.toml
229
+
230
+ # Tests that everything is formatted correctly.
182
231
rustfmt :
183
- name : rustfmt
184
232
runs-on : ubuntu-latest
185
233
steps :
186
234
- name : Checkout repository
0 commit comments