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:
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Format check
run: cargo fmt --check
- name: Zero Network Policy Check
run: |
cargo tree -e normal | grep -E 'reqwest|hyper|ureq|curl|rustls|native-tls|openssl|quinn|tonic' && { echo "Network dependency detected"; exit 1; } || exit 0
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@v24
with:
globs: "**/*.md"
ignore: target node_modules .worktrees
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build
run: cargo build --locked
- name: Test
run: cargo test --locked
build-binaries:
name: Build (${{ matrix.target }})
if: github.ref_type == 'tag'
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Build release
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Binary Size Check
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
MAX_SIZE=$((6 * 1024 * 1024))
ACTUAL_SIZE=$(stat -c '%s' "target/${{ matrix.target }}/release/carryctx.exe")
elif [[ "${{ runner.os }}" == "macOS" ]]; then
MAX_SIZE=$((5 * 1024 * 1024))
ACTUAL_SIZE=$(stat -f '%z' "target/${{ matrix.target }}/release/carryctx")
else
MAX_SIZE=$((4 * 1024 * 1024))
ACTUAL_SIZE=$(stat -c '%s' "target/${{ matrix.target }}/release/carryctx")
fi
echo "Actual Size: $ACTUAL_SIZE bytes"
echo "Budget Size: $MAX_SIZE bytes"
if [ "$ACTUAL_SIZE" -gt "$MAX_SIZE" ]; then
echo "carryctx binary exceeds size budget"
exit 1
fi
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: carryctx-${{ matrix.target }}
path: target/${{ matrix.target }}/release/carryctx${{ runner.os == 'Windows' && '.exe' || '' }}
actionlint:
name: Actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: docker://rhysd/actionlint:1.7.12
with:
args: -color -shellcheck=