Files
gpt-load/.github/workflows/ci.yml
T

124 lines
3.6 KiB
YAML

name: V2 CI
on:
push:
branches:
- v2
pull_request:
branches:
- v2
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Validate and build web UI
uses: ./.github/actions/web-ci
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Check Go formatting
run: |
# go-format-check:start
formatted_files="$(gofmt -l .)"
test -z "${formatted_files}"
# go-format-check:end
- name: Check module graph
run: go mod tidy -diff
- name: Audit Go dependencies
run: go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./...
- name: Run Go vet
run: go vet ./...
- name: Build backend
run: go build -o gpt-load .
- name: Run race-enabled tests
run: go test -race -count=1 -timeout=15m . ./internal/...
- name: Check repository invariants
run: git diff --check
database-contract:
name: Database contract (${{ matrix.driver }})
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- driver: mysql
dsn: mysql://root:root@127.0.0.1:3306/gpt_load?charset=utf8mb4&transaction_isolation=%27READ-COMMITTED%27
- driver: postgres
dsn: postgres://postgres:postgres@127.0.0.1:5432/gpt_load?sslmode=disable
services:
mysql:
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gpt_load
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -proot"
--health-interval=5s
--health-timeout=10s
--health-retries=20
postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gpt_load
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d gpt_load"
--health-interval=5s
--health-timeout=10s
--health-retries=20
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Run external database contract
env:
GPT_LOAD_DATABASE_TEST_DSN: ${{ matrix.dsn }}
run: |
go test -v -count=1 ./internal/storage ./internal/control ./internal/requestlog -run '^TestExternalDatabase(ConcurrentMigrations|Lifecycle|ModelPriceIdentityUsesExactComparison|ReadSnapshotUsesRepeatableRead|MySQLInterruptedBaselineRecovery|GroupPriceReconciliation|RequestLogLifecycle)$'
windows-encryption-acl:
runs-on: windows-2025
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Test Windows secure file and storage ACLs
run: go test -v -count=1 ./internal/platform/securefile ./internal/platform/encryption ./internal/storage