-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (133 loc) · 5.31 KB
/
Copy pathci.yml
File metadata and controls
161 lines (133 loc) · 5.31 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build-test:
name: fmt · clippy · build · unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy (deny warnings)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Unit + integration tests
run: cargo test --workspace --all-features
- name: Build worker (release)
run: cargo build --release --bin code-worker
- name: cargo doc (deny warnings)
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
# Resolve the latest published haybarn release once, so the whole matrix tests
# the same version (and we never hardcode/pin it).
resolve-haybarn:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.r.outputs.release }}
steps:
- id: r
run: |
REL=$(gh release view --repo Query-farm-haybarn/haybarn --json tagName --jq .tagName)
echo "release=$REL" >> "$GITHUB_OUTPUT"
echo "Latest haybarn release: $REL"
env:
GH_TOKEN: ${{ github.token }}
integration:
# SQL end-to-end across every transport the vgi extension supports. The SAME
# test/sql/*.test suite runs three ways — the only difference is the LOCATION
# the .test files ATTACH (ci/run-integration.sh sets VGI_CODE_WORKER per
# transport): subprocess = the stdio worker binary DuckDB spawns; http =
# `code-worker --http` (auto port, advertises PORT:<n>); unix = `code-worker
# --unix <sock>` (advertises UNIX:<sock>).
name: SQL E2E (${{ matrix.transport }}) · ${{ matrix.os }}
needs: resolve-haybarn
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
transport: [subprocess, http, unix]
include:
- { os: ubuntu-latest, asset: haybarn_unittest-linux-amd64.zip }
- { os: macos-latest, asset: haybarn_unittest-osx-arm64.zip }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Build worker (release)
# The `http` transport needs the `vgi-rpc` `http` feature; the workspace
# already pins `vgi-rpc = { features = ["macros", "http"] }` (and the SDK
# `vgi` crate enables HTTP via that), so a plain release build serves all
# three transports — no extra cargo features required here.
run: cargo build --release --bin code-worker
- name: Download haybarn-unittest
run: |
gh release download "$HAYBARN_RELEASE" \
--repo Query-farm-haybarn/haybarn \
--pattern '${{ matrix.asset }}' \
--output haybarn-unittest.zip --clobber
mkdir -p hb && unzip -o -q haybarn-unittest.zip -d hb
env:
GH_TOKEN: ${{ github.token }}
HAYBARN_RELEASE: ${{ needs.resolve-haybarn.outputs.release }}
- name: Resolve runner + worker paths
run: |
# Absolute paths: run-integration.sh cd's into a staging dir before
# invoking the runner, so relative paths would not resolve. WORKER_BIN
# is the compiled binary — used directly as the subprocess LOCATION and
# launched in --http / --unix mode for those transports.
UNITTEST="$PWD/$(find hb -name 'haybarn-unittest' -type f | head -1)"
chmod +x "$UNITTEST"
echo "HAYBARN_UNITTEST=$UNITTEST" >> "$GITHUB_ENV"
echo "WORKER_BIN=$PWD/target/release/code-worker" >> "$GITHUB_ENV"
- name: Run extension integration suite (${{ matrix.transport }})
run: ci/run-integration.sh
env:
TRANSPORT: ${{ matrix.transport }}
# Metadata-quality gate: build the worker, then run vgi-lint over the catalog
# the binary advertises (catalog/schema/function descriptions, example queries,
# provenance tags, table-function column docs). Kept as a separate job so the
# findings are visible independently of the build/test and SQL-E2E jobs.
metadata-quality:
name: metadata quality (vgi-lint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Build worker (release)
run: cargo build --release --bin code-worker
- name: vgi-lint
uses: Query-farm/vgi-lint-check@v1
with:
version: "0.37.0"
location: "${{ github.workspace }}/target/release/code-worker"
fail-on: info