88 lines
3.1 KiB
YAML
88 lines
3.1 KiB
YAML
name: Verify, publish, and promote
|
|
on:
|
|
push:
|
|
branches: [master, main]
|
|
paths-ignore: [deploy/values-srs.yaml]
|
|
pull_request:
|
|
|
|
jobs:
|
|
verify:
|
|
runs-on: ubuntu-22.04
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
env:
|
|
POSTGRES_USER: aeternalis
|
|
POSTGRES_PASSWORD: ci-test-only
|
|
POSTGRES_DB: aeternalis_test
|
|
options: >-
|
|
--health-cmd "pg_isready -U aeternalis -d aeternalis_test"
|
|
--health-interval 5s --health-timeout 5s --health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: "24", cache: npm }
|
|
- uses: actions/setup-go@v5
|
|
with: { go-version-file: server/go.mod, cache-dependency-path: server/go.sum }
|
|
- run: npm ci --no-fund
|
|
- run: npm run test:contracts && npm run check && npm run build
|
|
- name: Go tests, race detector, and PostgreSQL integration
|
|
working-directory: server
|
|
env:
|
|
TEST_DATABASE_URL: postgres://aeternalis:ci-test-only@postgres:5432/aeternalis_test?sslmode=disable
|
|
run: go test -race -count=1 ./...
|
|
- name: Go static analysis
|
|
working-directory: server
|
|
run: go vet ./...
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: npm run test:e2e
|
|
- uses: azure/setup-helm@v4.3.0
|
|
- run: |
|
|
helm lint deploy/chart
|
|
helm template aeternalis deploy/chart > /tmp/aeternalis.yaml
|
|
helm lint deploy/chart -f deploy/values-srs.yaml
|
|
helm template aeternalis deploy/chart -f deploy/values-srs.yaml > /tmp/aeternalis-srs.yaml
|
|
|
|
publish:
|
|
if: gitea.event_name == 'push'
|
|
needs: verify
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
digest: ${{ steps.build.outputs.digest }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.HARBOR_HOST }}
|
|
username: ${{ secrets.HARBOR_USERNAME }}
|
|
password: ${{ secrets.HARBOR_PASSWORD }}
|
|
- uses: docker/build-push-action@v6
|
|
id: build
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ vars.HARBOR_HOST }}/${{ vars.HARBOR_PROJECT }}/aeternalis:${{ gitea.sha }}
|
|
provenance: true
|
|
sbom: true
|
|
|
|
promote:
|
|
if: gitea.event_name == 'push' && vars.GITOPS_REPOSITORY != ''
|
|
needs: publish
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: "24" }
|
|
- run: npm ci --no-fund
|
|
- name: Update GitOps image digest
|
|
env:
|
|
GITOPS_REPOSITORY: ${{ vars.GITOPS_REPOSITORY }}
|
|
GITOPS_BRANCH: ${{ vars.GITOPS_BRANCH }}
|
|
GITOPS_VALUES_FILE: ${{ vars.GITOPS_VALUES_FILE }}
|
|
GITOPS_USERNAME: ${{ secrets.GITOPS_USERNAME }}
|
|
GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }}
|
|
IMAGE_REPOSITORY: ${{ vars.HARBOR_HOST }}/${{ vars.HARBOR_PROJECT }}/aeternalis
|
|
IMAGE_DIGEST: ${{ needs.publish.outputs.digest }}
|
|
run: node tools/promote-gitops.mjs
|