@@ -28,31 +28,25 @@ permissions:
2828 contents : read
2929
3030jobs :
31+ # This job does our basic build+test for supported platforms.
3132 test :
32- name : test
3333 env :
3434 # For some builds, we use cross to test on 32-bit and big-endian
3535 # systems.
3636 CARGO : cargo
3737 # 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.
3840 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
3945 runs-on : ${{ matrix.os }}
4046 strategy :
47+ fail-fast : false
4148 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
5249 include :
53- - build : pinned
54- os : ubuntu-latest
55- rust : 1.60.0
5650 - build : stable
5751 os : ubuntu-latest
5852 rust : stable
@@ -80,107 +74,161 @@ jobs:
8074 os : windows-latest
8175 rust : stable-x86_64-gnu
8276 steps :
83-
8477 - name : Checkout repository
8578 uses : actions/checkout@v3
86-
8779 - name : Install Rust
8880 uses : dtolnay/rust-toolchain@v1
8981 with :
9082 toolchain : ${{ matrix.rust }}
91-
9283 - name : Install and configure Cross
93- if : matrix.target != ''
84+ if : matrix.os == 'ubuntu-latest' && matrix. target != ''
9485 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+
9596 # We used to install 'cross' from master, but it kept failing. So now
9697 # we build from a known-good version until 'cross' becomes more stable
9798 # or we find an alternative. Notably, between v0.2.1 and current
9899 # 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
100101 echo "CARGO=cross" >> $GITHUB_ENV
101102 echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
102-
103103 - name : Show command used for Cargo
104104 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"
108107 - name : Show CPU info for debugging
109108 if : matrix.os == 'ubuntu-latest'
110109 run : lscpu
111-
112110 - name : Basic build
113111 run : ${{ env.CARGO }} build --verbose $TARGET
114-
115112 - name : Build docs
116113 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.
123114 - name : Run subset of tests
124- if : matrix.build != 'pinned' && matrix.build != 'stable'
125115 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-
138116 - 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
143118 - 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
154120 - 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
159122 - 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
176125 - if : matrix.build == 'nightly'
177126 name : Run benchmarks as tests
178127 run : |
179128 cd bench
180129 ./run rust --no-run --verbose
181130
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.
182231 rustfmt :
183- name : rustfmt
184232 runs-on : ubuntu-latest
185233 steps :
186234 - name : Checkout repository
0 commit comments