Repository navigation
106 lines (99 loc) · 3.89 KB
/
Copy pathci.yml
File metadata and controls
106 lines (99 loc) · 3.89 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
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
102
103
104
105
106
name: ci
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install toolchain from rust-toolchain.toml
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --locked -- -D warnings
- run: cargo test --workspace --locked
macos:
runs-on: macos-latest
needs: check
steps:
- uses: actions/checkout@v5
- name: Install toolchain from rust-toolchain.toml
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --locked -- -D warnings
- run: cargo test --locked -p gitagent-sandbox
- name: The launcher refuses writes outside the allowed folders
run: |
cargo build --locked -p gitagent-cli
mkdir -p allowed
target/debug/gitagent __sandbox --write "$PWD/allowed" --write /dev -- \
sh -c 'echo ok > allowed/in.txt && ! (echo x > outside.txt) 2>/dev/null' 2> launcher.err
cat launcher.err
test -f allowed/in.txt
test ! -e outside.txt
! grep -q 'sandbox limited' launcher.err
musl:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v5
- name: Install toolchain from rust-toolchain.toml
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- uses: mlugg/setup-zig@v2
- run: cargo install --locked cargo-zigbuild
- run: scripts/build-release.sh
- name: Check the binaries are static
run: |
for t in x86_64-unknown-linux-musl aarch64-unknown-linux-musl; do
file target/$t/release/gitagent | tee /dev/stderr | grep -q 'statically linked'
done
- uses: actions/upload-artifact@v4
with:
name: gitagent-linux
path: target/*-unknown-linux-musl/release/gitagent
clients:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v5
- name: Install toolchain from rust-toolchain.toml
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- run: cargo build --locked -p gitagent-cli
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Python client
run: GITAGENT_BIN=target/debug/gitagent python3 -m unittest discover -s clients/python/tests -v
- uses: actions/setup-node@v5
with:
node-version: "22"
- name: TypeScript client
working-directory: clients/typescript
run: npm install --no-audit --no-fund --omit=optional && npm run build
- name: The npm launcher runs the binary
working-directory: clients/typescript
run: |
GITAGENT_BIN=../../target/debug/gitagent node bin/gitagent.js --version
node --input-type=module -e "const m = await import('./dist/index.js'); if (typeof m.query !== 'function' || typeof m.loadAgent !== 'function') process.exit(1);"
- name: The sandbox, with a stand-in for gitmachine
working-directory: clients/typescript
run: GITAGENT_BIN="$GITHUB_WORKSPACE/target/debug/gitagent" node --test test/sandbox.test.mjs
npm-install:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v5
- name: Install toolchain from rust-toolchain.toml
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- run: cargo build --locked -p gitagent-cli
- uses: actions/setup-node@v5
with:
node-version: "22"
- name: Install from a private registry, upgrade from 2.x, use the SDK
run: scripts/test-npm-install.sh target/debug/gitagent