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, this is set to `--target matrix.target`.
17+ TARGET_FLAGS :
18+ # When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
19+ TARGET_DIR : ./target
20+ # Emit backtraces on panics.
21+ RUST_BACKTRACE : 1
22+ runs-on : ${{ matrix.os }}
23+ strategy :
24+ matrix :
25+ build :
26+ # We test ripgrep on a pinned version of Rust, along with the moving
27+ # targets of 'stable' and 'beta' for good measure.
28+ - pinned
29+ - stable
30+ - beta
31+ # Our release builds are generated by a nightly compiler to take
32+ # advantage of the latest optimizations/compile time improvements. So
33+ # we test all of them here. (We don't do mips releases, but test on
34+ # mips for big-endian coverage.)
35+ - nightly
36+ - nightly-musl
37+ - nightly-32
38+ - nightly-mips
39+ - nightly-arm
40+ - macos
41+ - win-msvc
42+ - win-gnu
43+ include :
44+ - build : pinned
45+ os : ubuntu-18.04
46+ rust : 1.41.0
47+ - build : stable
48+ os : ubuntu-18.04
49+ rust : stable
50+ - build : beta
51+ os : ubuntu-18.04
52+ rust : beta
53+ - build : nightly
54+ os : ubuntu-18.04
55+ rust : nightly
56+ - build : nightly-musl
57+ os : ubuntu-18.04
58+ rust : nightly
59+ target : x86_64-unknown-linux-musl
60+ - build : nightly-32
61+ os : ubuntu-18.04
62+ rust : nightly
63+ target : i686-unknown-linux-gnu
64+ - build : nightly-mips
65+ os : ubuntu-18.04
66+ rust : nightly
67+ target : mips64-unknown-linux-gnuabi64
68+ - build : nightly-arm
69+ os : ubuntu-18.04
70+ rust : nightly
71+ # For stripping release binaries:
72+ # docker run --rm -v $PWD/target:/target:Z \
73+ # rustembedded/cross:arm-unknown-linux-gnueabihf \
74+ # arm-linux-gnueabihf-strip \
75+ # /target/arm-unknown-linux-gnueabihf/debug/rg
76+ target : arm-unknown-linux-gnueabihf
77+ - build : macos
78+ os : macos-latest
79+ rust : nightly
80+ - build : win-msvc
81+ os : windows-2019
82+ rust : nightly
83+ - build : win-gnu
84+ os : windows-2019
85+ rust : nightly-x86_64-gnu
86+ steps :
87+ - name : Checkout repository
88+ uses : actions/checkout@v1
89+
90+ - name : Install packages (Ubuntu)
91+ if : matrix.os == 'ubuntu-18.04'
92+ run : |
93+ ci/ubuntu-install-packages
94+
95+ - name : Install packages (macOS)
96+ if : matrix.os == 'macos-latest'
97+ run : |
98+ ci/macos-install-packages
99+
100+ - name : Install Rust
101+ uses : actions-rs/toolchain@v1
102+ with :
103+ toolchain : ${{ matrix.rust }}
104+ profile : minimal
105+ override : true
106+
107+ - name : Use Cross
108+ if : matrix.target != ''
109+ run : |
110+ # FIXME: to work around bugs in latest cross release, install master.
111+ # See: https://github.com/rust-embedded/cross/issues/357
112+ cargo install --git https://github.com/rust-embedded/cross
113+ echo "::set-env name=CARGO::cross"
114+ echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}"
115+ echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}"
116+
117+ - name : Show command used for Cargo
118+ run : |
119+ echo "cargo command is: ${{ env.CARGO }}"
120+ echo "target flag is: ${{ env.TARGET_FLAGS }}"
121+
122+ - name : Build ripgrep and all crates
123+ run : ${{ env.CARGO }} build --verbose --all ${{ env.TARGET_FLAGS }}
124+
125+ - name : Build ripgrep with PCRE2
126+ run : ${{ env.CARGO }} build --verbose --all --features pcre2 ${{ env.TARGET_FLAGS }}
127+
128+ # This is useful for debugging problems when the expected build artifacts
129+ # (like shell completions and man pages) aren't generated.
130+ - name : Show build.rs stderr
131+ shell : bash
132+ run : |
133+ set +x
134+ stderr="$(find "${{ env.TARGET_DIR }}/debug" -name stderr -print0 | xargs -0 ls -t | head -n1)"
135+ if [ -s "$stderr" ]; then
136+ echo "===== $stderr ===== "
137+ cat "$stderr"
138+ echo "====="
139+ fi
140+ set -x
141+
142+ - name : Run tests with PCRE2 (sans cross)
143+ if : matrix.target == ''
144+ run : ${{ env.CARGO }} test --verbose --all --features pcre2 ${{ env.TARGET_FLAGS }}
145+
146+ - name : Run tests without PCRE2 (with cross)
147+ # These tests should actually work, but they almost double the runtime.
148+ # Every integration test spins up qemu to run 'rg', and when PCRE2 is
149+ # enabled, every integration test is run twice: one with the default
150+ # regex engine and once with PCRE2.
151+ if : matrix.target != ''
152+ run : ${{ env.CARGO }} test --verbose --all ${{ env.TARGET_FLAGS }}
153+
154+ - name : Test for existence of build artifacts (Windows)
155+ if : matrix.os == 'windows-2019'
156+ shell : bash
157+ run : |
158+ outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
159+ ls "$outdir/_rg.ps1" && file "$outdir/_rg.ps1"
160+
161+ - name : Test for existence of build artifacts (Unix)
162+ if : matrix.os != 'windows-2019'
163+ shell : bash
164+ run : |
165+ outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
166+ for f in rg.bash rg.fish rg.1; do
167+ # We could use file -E here, but it isn't supported on macOS.
168+ ls "$outdir/$f" && file "$outdir/$f"
169+ done
170+
171+ - name : Test zsh shell completions (Unix, sans cross)
172+ # We could test this when using Cross, but we'd have to execute the
173+ # 'rg' binary (done in test-complete) with qemu, which is a pain and
174+ # doesn't really gain us much. If shell completion works in one place,
175+ # it probably works everywhere.
176+ if : matrix.target == '' && matrix.os != 'windows-2019'
177+ shell : bash
178+ run : ci/test-complete
179+
180+ rustfmt :
181+ name : rustfmt
182+ runs-on : ubuntu-18.04
183+ steps :
184+ - name : Checkout repository
185+ uses : actions/checkout@v1
186+ - name : Install Rust
187+ uses : actions-rs/toolchain@v1
188+ with :
189+ toolchain : stable
190+ override : true
191+ profile : minimal
192+ components : rustfmt
193+ - name : Check formatting
194+ run : |
195+ cargo fmt --all -- --check
0 commit comments