Skip to content

Commit 31109c5

Browse files
committed
ci: switch to GitHub Actions
1 parent 95982cb commit 31109c5

File tree

2 files changed

+184
-0
lines changed

2 files changed

+184
-0
lines changed

.github/workflows/ci.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '00 01 * * *'
9+
jobs:
10+
test:
11+
name: test
12+
env:
13+
# For some builds, we use cross to test on 32-bit and big-endian
14+
# systems.
15+
CARGO: cargo
16+
# When CARGO is set to CROSS, TARGET is set to `--target matrix.target`.
17+
TARGET:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
build:
22+
- pinned
23+
- stable
24+
- stable-32
25+
- stable-mips
26+
- beta
27+
- nightly
28+
- macos
29+
- win-msvc
30+
- win-gnu
31+
include:
32+
- build: pinned
33+
os: ubuntu-18.04
34+
rust: 1.28.0
35+
- build: stable
36+
os: ubuntu-18.04
37+
rust: stable
38+
- build: stable-32
39+
os: ubuntu-18.04
40+
rust: stable
41+
target: i686-unknown-linux-gnu
42+
- build: stable-mips
43+
os: ubuntu-18.04
44+
rust: stable
45+
target: mips64-unknown-linux-gnuabi64
46+
- build: beta
47+
os: ubuntu-18.04
48+
rust: beta
49+
- build: nightly
50+
os: ubuntu-18.04
51+
rust: nightly
52+
- build: macos
53+
os: macos-latest
54+
rust: stable
55+
- build: win-msvc
56+
os: windows-2019
57+
rust: stable
58+
- build: win-gnu
59+
os: windows-2019
60+
rust: stable-x86_64-gnu
61+
steps:
62+
63+
- name: Checkout repository
64+
uses: actions/checkout@v1
65+
with:
66+
fetch-depth: 1
67+
68+
- name: Install Rust
69+
uses: actions-rs/toolchain@v1
70+
with:
71+
toolchain: ${{ matrix.rust }}
72+
profile: minimal
73+
override: true
74+
75+
- name: Install and configure Cross
76+
if: matrix.target != ''
77+
run: |
78+
# FIXME: to work around bugs in latest cross release, install master.
79+
# See: https://github.com/rust-embedded/cross/issues/357
80+
cargo install --git https://github.com/rust-embedded/cross
81+
echo "::set-env name=CARGO::cross"
82+
echo "::set-env name=TARGET::--target ${{ matrix.target }}"
83+
84+
- name: Show command used for Cargo
85+
run: |
86+
echo "cargo command is: ${{ env.CARGO }}"
87+
echo "target flag is: ${{ env.TARGET }}"
88+
89+
- name: Show CPU info for debugging
90+
if: matrix.os == 'ubuntu-18.04'
91+
run: lscpu
92+
93+
- name: Basic build
94+
run: ${{ env.CARGO }} build --verbose $TARGET
95+
96+
- name: Build docs
97+
run: ${{ env.CARGO }} doc --verbose $TARGET
98+
99+
# Our dev dependencies evolve more rapidly than we'd like, so only run
100+
# tests when we aren't pinning the Rust version.
101+
#
102+
# Also, our "full" test suite does quite a lot of work, so we only run it
103+
# on one build. Otherwise, we just run the "default" set of tests.
104+
- name: Run subset of tests
105+
if: matrix.build != 'pinned' && matrix.build != 'stable'
106+
run: ${{ env.CARGO }} test --verbose --test default $TARGET
107+
108+
- name: Run full test suite
109+
if: matrix.build == 'stable'
110+
# 'stable' is Linux only, so we have bash.
111+
run: ./test
112+
113+
- name: Run randomized tests against regexes from the wild
114+
if: matrix.build == 'stable'
115+
run: >-
116+
# We run the tests in release mode since it winds up being faster.
117+
RUST_REGEX_RANDOM_TEST=1 ${{ env.CARGO }}
118+
test --release --verbose --test crates-regex $TARGET
119+
120+
- name: Build regex-syntax docs
121+
if: matrix.build != 'pinned'
122+
run: >-
123+
${{ env.CARGO }}
124+
doc --verbose --manifest-path regex-syntax/Cargo.toml $TARGET
125+
126+
- name: Run subset of regex-syntax tests
127+
if: matrix.build != 'pinned' && matrix.build != 'stable'
128+
run: >-
129+
${{ env.CARGO }} test
130+
--verbose --manifest-path regex-syntax/Cargo.toml $TARGET
131+
132+
- name: Run full regex-syntax test suite
133+
if: matrix.build == 'stable'
134+
run: |
135+
# 'stable' is Linux only, so we have bash.
136+
cd regex-syntax
137+
./test
138+
139+
- name: Run regex-capi tests
140+
if: matrix.build == 'stable'
141+
run: |
142+
# 'stable' is Linux only, so we have bash.
143+
cd regex-capi
144+
./test
145+
146+
- if: matrix.build == 'nightly'
147+
name: Compile regex-debug
148+
run: >-
149+
${{ env.CARGO }} build
150+
--verbose --manifest-path regex-debug/Cargo.toml $TARGET
151+
152+
- if: matrix.build == 'nightly'
153+
name: Run benchmarks as tests
154+
run: |
155+
cd bench
156+
./run rust --no-run --verbose
157+
158+
rustfmt:
159+
name: rustfmt
160+
runs-on: ubuntu-18.04
161+
steps:
162+
- name: Checkout repository
163+
uses: actions/checkout@v1
164+
with:
165+
fetch-depth: 1
166+
- name: Install Rust
167+
uses: actions-rs/toolchain@v1
168+
with:
169+
toolchain: stable
170+
profile: minimal
171+
override: true
172+
components: rustfmt
173+
- name: Install rustfmt
174+
run: rustup component add rustfmt
175+
- name: Check formatting
176+
run: |
177+
cargo fmt --all -- --check

regex-capi/test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
cargo build --verbose
6+
(cd ctest && ./compile && LD_LIBRARY_PATH=../../target/debug ./test)
7+
(cd examples && ./compile && LD_LIBRARY_PATH=../../target/debug ./iter)

0 commit comments

Comments
 (0)