-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 2.19 KB
/
Copy pathci.yml
File metadata and controls
68 lines (57 loc) · 2.19 KB
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
name: CI
# This workflow runs tests, formatting checks, and the fspec tool.
#
# To set up branch protection for master/main (require reviews and passing CI):
# 1. Go to your repository on GitHub
# 2. Navigate to Settings > Branches
# 3. Click "Add branch protection rule" or edit existing rule for master/main
# 4. Enable the following options:
# - "Require a pull request before merging"
# - Enable "Require approvals" (set to 1 or more)
# - Optionally enable "Dismiss stale pull request approvals when new commits are pushed"
# - "Require status checks to pass before merging"
# - Select "Test Suite" as the required status check
# - Optionally: "Require conversation resolution before merging"
# - Optionally: "Do not allow bypassing the above settings" (prevents admins from bypassing)
# 5. Click "Create" or "Save changes"
#
# Note: Branch protection cannot be configured via files alone - it requires
# repository settings access. However, this workflow will fail if tests don't pass,
# which effectively enforces the requirement.
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
${{ runner.home }}/.cargo/bin/
${{ runner.home }}/.cargo/registry/index/
${{ runner.home }}/.cargo/registry/cache/
${{ runner.home }}/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run tests
run: cargo test --workspace --all-features
- name: Run fspec tool
run: cargo run
working-directory: ${{ github.workspace }}