ci: add 'test' job (go vet + go test -race) gating docker build
This was supposed to land in d63f195 but the prior Write didn't apply.
CI now runs unit + integration tests on every push and PR ; the docker
image is only pushed on main, after tests pass.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: Docker Build
|
||||
name: CI/CD
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
@@ -8,18 +8,53 @@ on:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'AUTH.md'
|
||||
- 'DEPLOY.md'
|
||||
- 'HOWTO_ADD_BOT.md'
|
||||
- 'chart/**'
|
||||
- '.gitignore'
|
||||
- 'Makefile'
|
||||
- 'bots.example.yaml'
|
||||
- 'docker-compose.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'AUTH.md'
|
||||
- 'DEPLOY.md'
|
||||
- 'HOWTO_ADD_BOT.md'
|
||||
- 'chart/**'
|
||||
- '.gitignore'
|
||||
- 'docker-compose.yml'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: git checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
cache: true
|
||||
|
||||
- name: go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: go test (race + count=1)
|
||||
run: go test -race -count=1 -timeout 120s ./...
|
||||
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
|
||||
Reference in New Issue
Block a user