-
Notifications
You must be signed in to change notification settings - Fork 79
82 lines (78 loc) · 3.05 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
name: Cargo Build & Test
on:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo fmt --all --check
- run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose --features "experimental"
- run: RUSTFLAGS="-D warnings -F unsafe-code" cargo build --verbose
- run: cargo test --verbose --features "experimental"
- run: cargo test --verbose
- run: cargo doc --all-features
- run: cargo clippy
- run: ./panic_safety.sh
- run: cargo test --verbose -- --ignored
- run: cargo bench --no-run
- run: cd cedar-policy ; cargo test --no-default-features --verbose
- run: cd cedar-policy-cli ; cargo test --no-default-features --verbose
- run: cd cedar-policy-core ; cargo test --no-default-features --verbose
- run: cd cedar-policy-formatter ; cargo test --no-default-features --verbose
- run: cd cedar-policy-validator ; cargo test --no-default-features --verbose
cargo_audit:
name: Cargo Audit
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo install cargo-audit
- run: cargo audit --deny warnings
cargo_semver_checks:
name: Cargo SemVer Checks
runs-on: ubuntu-latest
# Make this check mandatory for release branches.
continue-on-error: ${{ !startsWith(github.base_ref, 'release/') }}
strategy:
matrix:
toolchain:
- stable
steps:
- name: Check out head (${{ github.head_ref }})
uses: actions/checkout@v3
with:
path: head
# Pull requests to non-release branches are checked for SemVer breakage
# relative to their target branch.
- if: ${{ !startsWith(github.base_ref, 'release/') }}
name: Check out base (${{ github.base_ref }})
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: base
# If this is a release PR, check SemVer relative to the highest version
# published to crates.io <= the version from head.
- if: ${{ startsWith(github.base_ref, 'release/') }}
name: Check out base (from crates.io)
run: head/.github/scripts/check-out-base-from-crates-io.sh
shell: bash
# `cargo semver-checks` doesn't understand `rlib` crates.
- run: >-
sed -i 's/^crate_type = \["rlib"\]$/crate_type = ["lib"]/' {head,base}/cedar-policy/Cargo.toml
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo install cargo-semver-checks
- run: cargo semver-checks check-release --package cedar-policy --baseline-root ../base
working-directory: head