-
Notifications
You must be signed in to change notification settings - Fork 126
85 lines (71 loc) · 3.25 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: CI
on: [push]
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
include:
- os: ubuntu-latest
target: Linux
- os: macos-latest
target: Macos
- os: windows-latest
target: Windows
env:
# Deny warnings for all steps
# (changing this flag triggers a complete rebuild, so it's helpful to define it globally)
RUSTFLAGS: --deny warnings
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Cargo build 'adblock' package
run: cargo build --all-features --all-targets
- name: Cargo build 'adblock' package (no default features)
run: cargo build --no-default-features --all-targets
- name: Cargo build 'adblock' package (wasm32)
if: matrix.os == 'ubuntu-latest'
run: rustup target add wasm32-unknown-unknown && cargo build --target wasm32-unknown-unknown
- name: Build npm package
run: npm ci
- name: Cargo fuzz
# Only runs on one runner for a few reasons:
# 1. The 'fuzz' package has no entrypoints, befuddling the mvsc linker on Windows
# 2. Mac CI Runners can be noticeably slower than the other two
# 3. Assumption: fuzzing on multiple OS's isn't likely to catch bugs
if: matrix.os == 'ubuntu-latest'
run: .github/workflows/fuzz-all.sh
shell: bash
# audit dependencies for severe vulnerabilities
# (to deny warnings in the future, note that cargo audit requires additional arguments)
- name: Cargo audit
if: matrix.os == 'ubuntu-latest'
run: |
cargo install --force cargo-audit
cargo generate-lockfile
cargo audit
- name: Cargo test 'adblock' package
run: cargo test --all-features --tests --no-fail-fast
- name: Cargo test 'adblock' package (no default features)
run: cargo test --no-default-features --features embedded-domain-resolver,full-regex-handling --tests --no-fail-fast
- name: Run Brave-specific tests
# Only runs on one runner for a few reasons:
# 1. windows doesn't expand the env var properly
# 2. On windows, the `grep` command doesn't stop the job like it does on the others
# 3. Although `shell: bash` might fix the windows issues, running this test on multiple
# OS's isn't likely to catch bugs anyway
if: matrix.os == 'ubuntu-latest'
env:
BRAVE_SERVICE_KEY: ${{ secrets.BRAVE_SERVICE_KEY }}
TEST_NAME_FILTER: live_brave
run: |
# `cargo test` doesn't fail when it matches 0 tests.
# This hackily checks that the filter is working.
# If this check fails, something might have been renamed inadvertantly.
echo "Ensure that '$TEST_NAME_FILTER' still matches exactly 2 tests."
cargo test --all-features --test live --no-fail-fast -- --ignored "$TEST_NAME_FILTER" --list | grep "2 tests, 0 benchmarks"
# Now run the tests
cargo test --all-features --test live --no-fail-fast -- --ignored "$TEST_NAME_FILTER"