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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check (no features)
run: cargo check --all-targets
- name: Check (serde)
run: cargo check --features serde --all-targets
- name: Check (conference-info)
run: cargo check --features conference-info --all-targets
- name: Check (draft)
run: cargo check --features draft --all-targets
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Clippy (draft)
run: cargo clippy --features draft --all-targets -- -D warnings
- name: Verify SipHeader against IANA registry
run: |
output=$(hooks/check-sip-headers.sh 2>&1 | tail -1)
echo "SIP_HEADER_COUNT=$(echo "$output" | grep -oP '^\S+ \K\d+/\d+')" >> "$GITHUB_ENV"
echo "DRAFT_HEADER_COUNT=$(echo "$output" | grep -oP 'draft \K\d+/\d+' || echo '0/0')" >> "$GITHUB_ENV"
- name: Count SipHeaderLookup accessors
run: |
echo "LOOKUP_COUNT=$(sed -n '/^pub trait SipHeaderLookup/,/^}/p' src/header.rs | grep -c '^ *fn ')" >> "$GITHUB_ENV"
- name: Test
run: |
set -o pipefail
CARGO_TERM_COLOR=never cargo test --features draft 2>&1 | tee test-output.txt
passed=$(grep '^test result:' test-output.txt | sed 's/.*ok\. \([0-9]*\) passed.*/\1/' | paste -sd+ | bc)
echo "TEST_PASSED=$passed" >> "$GITHUB_ENV"
- name: Update test count badge
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 9f50aa47ea72d91eb2033a1c48f40246
filename: test-count.json
label: tests
message: "${{ env.TEST_PASSED }} passed"
color: brightgreen
- name: Update SipHeader IANA sync badge
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 9f50aa47ea72d91eb2033a1c48f40246
filename: sip-header-count.json
label: SipHeader (IANA)
message: "${{ env.SIP_HEADER_COUNT }}"
color: blue
- name: Update SipHeaderLookup accessor badge
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 9f50aa47ea72d91eb2033a1c48f40246
filename: lookup-count.json
label: SipHeaderLookup
message: "${{ env.LOOKUP_COUNT }} accessors"
color: blue
- name: Build
run: cargo build --release