mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-18 06:00:54 +08:00
162 lines
6.4 KiB
YAML
162 lines
6.4 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
go:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: artex
|
|
POSTGRES_PASSWORD: testpass
|
|
POSTGRES_DB: artextest
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U artex"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
ARTEX_PG_DSN: postgres://artex:testpass@localhost:5432/artextest?sslmode=disable
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: gofmt
|
|
run: |
|
|
files=$(gofmt -l $(git ls-files '*.go'))
|
|
if [ -n "$files" ]; then echo "gofmt required:"; echo "$files"; exit 1; fi
|
|
- run: go build ./...
|
|
- run: go vet ./...
|
|
# Skipped tests, tracked in issue #9:
|
|
# - TestGraphOverviewExpandsAssociatedCompanyScope,
|
|
# TestCaptureApprovalLifecycle: fail on unmodified upstream code with a
|
|
# fresh database.
|
|
# - TestSideUsageRecordedOnceOnConsumerCancellation: concurrency/cancellation
|
|
# test that passes locally but is timing-sensitive on 2-core CI runners.
|
|
# They now skip themselves in code (t.Skip with a pointer to the issue).
|
|
- name: go test
|
|
# -p 1: package test suites share the single postgres service; running
|
|
# them in parallel makes packages delete each other's rows (observed
|
|
# as rotating failures in the agent package). Serial package execution
|
|
# keeps the database state deterministic.
|
|
run: go test -p 1 ./...
|
|
- name: online index scripts
|
|
# Apply and roll back scripts/sql on a database built here from
|
|
# db/schema.sql and db/migrations. The job-level artextest database
|
|
# never gets the schema (packages use suffixed databases), and cached
|
|
# test results mean no test database is guaranteed to exist.
|
|
env:
|
|
SQL_DSN: postgres://artex:testpass@localhost:5432/artextest_sqlscripts?sslmode=disable
|
|
run: |
|
|
psql "$ARTEX_PG_DSN" -X -v ON_ERROR_STOP=1 -c 'CREATE DATABASE artextest_sqlscripts'
|
|
psql "$SQL_DSN" -X -q -v ON_ERROR_STOP=1 -f db/schema.sql
|
|
for f in db/migrations/*.sql; do psql "$SQL_DSN" -X -q -v ON_ERROR_STOP=1 -f "$f"; done
|
|
psql "$SQL_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.sql
|
|
psql "$SQL_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.rollback.sql
|
|
- name: go test -race
|
|
# Race detector on the packages that pass under -race today. ./server
|
|
# joined once its suite was checked with -race against postgres and its
|
|
# test teardown fixed (#227, #228).
|
|
# Its own database: the plain run above leaves rows behind and the db tests
|
|
# are not idempotent across runs (duplicate llm_profiles names).
|
|
env:
|
|
ARTEX_PG_DSN: postgres://artex:testpass@localhost:5432/artextest_race?sslmode=disable
|
|
|
|
run: >-
|
|
go test -race -p 1 ./agent ./cmd/artex ./config ./db ./evidence ./guard
|
|
./intercept ./llmpool ./llmrec ./mcphttp ./notify ./server ./sidequestion
|
|
./traffic ./traffic/rewrite
|
|
|
|
# The go job above tests the version go.mod pins. A newer Go can break the
|
|
# suite without any change to this repository: Go 1.27's compress/flate
|
|
# started emitting a stored block for a 60-byte input, which made
|
|
# TestDecodeEvidenceBodyGzipQuoteFound fail on its own "fixture is not
|
|
# compressed" guard (#276). This job runs the same commands on the latest
|
|
# release so that drift shows up here rather than in a contributor's lap.
|
|
#
|
|
# Advisory on purpose (continue-on-error): a new toolchain release is not a
|
|
# change to this repository, and it must not block an unrelated merge the
|
|
# day it lands. Once the pinned floor is raised, drop continue-on-error and
|
|
# this becomes a required check.
|
|
go-stable:
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_USER: artex
|
|
POSTGRES_PASSWORD: testpass
|
|
POSTGRES_DB: artextest
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U artex"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
ARTEX_PG_DSN: postgres://artex:testpass@localhost:5432/artextest?sslmode=disable
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
- name: toolchain in use
|
|
run: go version
|
|
- run: go build ./...
|
|
- run: go vet ./...
|
|
# Same -p 1 reason as the pinned job: packages share the one postgres
|
|
# service, so parallel package runs delete each other's rows.
|
|
- run: go test -p 1 ./...
|
|
|
|
shell:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# shellcheck is preinstalled on the ubuntu runners. -S warning: the scripts
|
|
# currently have only info-level notes (intentional A && B || C chains in
|
|
# update.sh, an unquoted glob in backup.sh's prune), so fail on warnings.
|
|
- run: shellcheck -S warning install.sh update.sh start.sh scripts/backup.sh reset-password.sh scripts/extract-changelog-section.sh scripts/test-extract-changelog-section.sh .github/scripts/bot.sh scripts/test-bot-context.sh
|
|
- run: bash scripts/test-extract-changelog-section.sh
|
|
# The triage bot's repository summary must expose every top-level
|
|
# directory; a truncated file list once made it deny that docs/ and
|
|
# scripts/benchmark/ exist.
|
|
- run: bash scripts/test-bot-context.sh
|
|
|
|
web:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: web/package-lock.json
|
|
- run: npm ci
|
|
- run: npx tsc --noEmit
|
|
- run: npm run test:polling
|
|
- run: npm run test:replay
|
|
- run: npm run test:upload
|
|
- run: npm run build:static
|
|
|
|
python:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: python3 scripts/posture_check_test.py
|