mirror of
https://github.com/Noooste/garage-ui.git
synced 2026-07-26 15:58:13 +00:00
e918a0a940
Signed-off-by: Noooste <83548733+Noooste@users.noreply.github.com>
75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
name: backend-tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'backend/**'
|
|
- 'Dockerfile'
|
|
- 'Makefile'
|
|
- 'scripts/coverage-gate.sh'
|
|
- '.github/workflows/test.yml'
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
unit:
|
|
name: Unit tests + coverage gate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
|
|
- name: Generate swagger docs
|
|
run: |
|
|
go install github.com/swaggo/swag/cmd/swag@latest
|
|
cd backend && swag init
|
|
|
|
- name: Run unit tests with race detector and coverage
|
|
run: |
|
|
cd backend
|
|
go test -race -coverprofile=../coverage.out -coverpkg=./... ./...
|
|
|
|
- name: Enforce coverage gate
|
|
run: bash scripts/coverage-gate.sh coverage.out
|
|
|
|
- name: Upload coverage artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage
|
|
path: coverage.out
|
|
|
|
smoke:
|
|
name: Smoke test (docker compose)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
|
|
- name: Run smoke test
|
|
run: make test-smoke
|
|
|
|
- name: Dump compose logs on failure
|
|
if: failure()
|
|
run: |
|
|
docker compose -p garage-ui-smoke \
|
|
-f backend/tests/smoke/docker-compose.test.yml logs --no-color || true
|
|
|
|
- name: Tear down compose
|
|
if: always()
|
|
run: |
|
|
docker compose -p garage-ui-smoke \
|
|
-f backend/tests/smoke/docker-compose.test.yml down -v || true
|