Skip to content

Commit 937c0c9

Browse files
committed
ci: switch to GitHub Actions
1 parent 95982cb commit 937c0c9

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

.github/workflows/ci.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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+
- name: Checkout repository
63+
uses: actions/checkout@v1
64+
with:
65+
fetch-depth: 1
66+
- name: Install Rust
67+
uses: actions-rs/toolchain@v1
68+
with:
69+
toolchain: ${{ matrix.rust }}
70+
profile: minimal
71+
override: true
72+
- name: Use Cross
73+
if: matrix.target != ''
74+
run: |
75+
# FIXME: to work around bugs in latest cross release, install master.
76+
# See: https://github.com/rust-embedded/cross/issues/357
77+
cargo install --git https://github.com/rust-embedded/cross
78+
echo "::set-env name=CARGO::cross"
79+
echo "::set-env name=TARGET::--target ${{ matrix.target }}"
80+
- name: Show command used for Cargo
81+
run: |
82+
echo "cargo command is: ${{ env.CARGO }}"
83+
echo "target flag is: ${{ env.TARGET }}"
84+
- name: Show CPU info for debugging
85+
if: matrix.os == 'ubuntu-18.04'
86+
run: lscpu
87+
- run: ${{ env.CARGO }} build --verbose $TARGET
88+
- run: ${{ env.CARGO }} doc --verbose $TARGET
89+
# Our dev dependencies evolve more rapidly than we'd like, so only run
90+
# tests when we aren't pinning the Rust version.
91+
#
92+
# Also, our "full" test suite does quite a lot of work, so we only run it
93+
# on one build. Otherwise, we just run the "default" set of tests.
94+
- name: Run subset of tests
95+
if: matrix.build != 'pinned' && matrix.build != 'stable'
96+
run: ${{ env.CARGO }} test --verbose --test default $TARGET
97+
- name: Run full test suite
98+
if: matrix.build == 'stable'
99+
# 'stable' is Linux only, so we have bash.
100+
run: ./test
101+
- name: Run randomized tests against regexes from the wild
102+
if: matrix.build == 'stable'
103+
run: |
104+
# We run the tests in release mode since it winds up being faster.
105+
RUST_REGEX_RANDOM_TEST=1 \
106+
${{ env.CARGO }} test --release --verbose --test crates-regex $TARGET
107+
- name: Build regex-syntax docs
108+
if: matrix.build != 'pinned'
109+
run: |
110+
${{ env.CARGO }} doc \
111+
--verbose --manifest-path regex-syntax/Cargo.toml $TARGET
112+
- name: Run subset of regex-syntax tests
113+
if: matrix.build != 'pinned' && matrix.build != 'stable'
114+
run: |
115+
${{ env.CARGO }} test \
116+
--verbose --manifest-path regex-syntax/Cargo.toml $TARGET
117+
- name: Run full regex-syntax test suite
118+
if: matrix.build == 'stable'
119+
run: |
120+
# 'stable' is Linux only, so we have bash.
121+
cd regex-syntax
122+
./test
123+
- name: Run regex-capi tests
124+
if: matrix.build == 'stable'
125+
run: |
126+
# 'stable' is Linux only, so we have bash.
127+
cd regex-capi
128+
./test
129+
- if: matrix.build == 'nightly'
130+
name: Compile regex-debug
131+
run: |
132+
${{ env.CARGO }} build \
133+
--verbose --manifest-path regex-debug/Cargo.toml $TARGET
134+
- if: matrix.build == 'nightly'
135+
name: Run benchmarks as tests
136+
run: |
137+
cd bench
138+
./run rust --no-run --verbose
139+
140+
rustfmt:
141+
name: rustfmt
142+
runs-on: ubuntu-18.04
143+
steps:
144+
- name: Checkout repository
145+
uses: actions/checkout@v1
146+
with:
147+
fetch-depth: 1
148+
- name: Install Rust
149+
uses: actions-rs/toolchain@v1
150+
with:
151+
toolchain: stable
152+
profile: minimal
153+
override: true
154+
components: rustfmt
155+
- name: Install rustfmt
156+
run: rustup component add rustfmt
157+
- name: Check formatting
158+
run: |
159+
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)