-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (154 loc) · 5.16 KB
/
ci.yml
File metadata and controls
163 lines (154 loc) · 5.16 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: ci
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
changes:
name: detect touched entries
runs-on: ubuntu-latest
outputs:
cli: ${{ steps.filter.outputs.cli }}
dashboard_ui: ${{ steps.filter.outputs['dashboard-ui'] }}
ledger: ${{ steps.filter.outputs.ledger }}
control_plane: ${{ steps.filter.outputs['control-plane'] }}
gitleaks: ${{ steps.filter.outputs.gitleaks }}
steps:
- uses: actions/checkout@v6
- id: filter
uses: dorny/paths-filter@v4
with:
filters: |
cli:
- "cli/**"
- ".github/workflows/ci.yml"
dashboard-ui:
- "control-plane/dashboard-ui/**"
- ".github/workflows/ci.yml"
ledger:
- "ledger/**"
- ".github/workflows/ci.yml"
control-plane:
- "control-plane/**"
- "ledger/**"
- ".github/workflows/ci.yml"
gitleaks:
- "**"
cli:
name: cli (bun typecheck + tests)
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.cli == 'true'
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with: { bun-version: "1.3" }
- name: Cache bun
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: bun-cli-${{ runner.os }}-${{ hashFiles('cli/bun.lockb') }}
restore-keys: bun-cli-${{ runner.os }}-
- working-directory: cli
run: bun install --frozen-lockfile
- working-directory: cli
run: bun run typecheck
- working-directory: cli
run: bun test
dashboard-ui:
name: dashboard-ui (typecheck + build)
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.dashboard_ui == 'true'
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with: { bun-version: "1.3" }
- name: Cache bun
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: bun-dashboard-${{ runner.os }}-${{ hashFiles('control-plane/dashboard-ui/bun.lockb') }}
restore-keys: bun-dashboard-${{ runner.os }}-
- working-directory: control-plane/dashboard-ui
run: bun install --frozen-lockfile
- working-directory: control-plane/dashboard-ui
run: bun run typecheck
- working-directory: control-plane/dashboard-ui
run: bun run build
ledger:
name: ledger (cargo test)
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.ledger == 'true'
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with: { workspaces: ledger }
- working-directory: ledger
run: cargo test --all-features
control-plane:
name: control-plane (go vet + go test -race)
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.control_plane == 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: control-plane/go.mod
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with: { workspaces: ledger }
- uses: oven-sh/setup-bun@v2
with: { bun-version: "1.3" }
- name: Build ledger staticlib
working-directory: ledger
run: cargo build --release --lib
- name: Build dashboard
working-directory: control-plane/dashboard-ui
run: |
bun install --frozen-lockfile
bun run build
- name: go vet + test
working-directory: control-plane
env:
CGO_ENABLED: "1"
WORKSPACE: ${{ github.workspace }}
run: |
# Prefer static linking of the ledger so the test binaries don't
# need libopenagentlock_ledger.so on LD_LIBRARY_PATH at runtime.
export CGO_CFLAGS="-I${WORKSPACE}/ledger/include"
export CGO_LDFLAGS="-L${WORKSPACE}/ledger/target/release -l:libopenagentlock_ledger.a -ldl -lpthread -lm"
# Belt + suspenders: also set LD_LIBRARY_PATH for any runtime
# consumer that did pick up the dylib.
export LD_LIBRARY_PATH="${WORKSPACE}/ledger/target/release${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
go vet ./...
go test -race ./...
gitleaks:
name: gitleaks (secret scan)
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.gitleaks == 'true'
steps:
- uses: actions/checkout@v6
with: { fetch-depth: 0 }
- name: Install gitleaks
env:
GITLEAKS_VERSION: "8.21.2"
run: |
set -euo pipefail
curl -sSfL \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
-o /tmp/gitleaks.tar.gz
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
sudo mv /tmp/gitleaks /usr/local/bin/gitleaks
gitleaks version
- run: gitleaks detect --no-banner --redact --verbose