name: test on: push: branches: [dev] pull_request: branches: [main] jobs: test: runs-on: go-ci services: postgres: image: postgres:16-alpine env: POSTGRES_USER: minstrel POSTGRES_PASSWORD: minstrel POSTGRES_DB: minstrel_test ports: - 5432:5432 options: >- --health-cmd "pg_isready -U minstrel" --health-interval 10s --health-timeout 5s --health-retries 10 env: MINSTREL_TEST_DATABASE_URL: postgres://minstrel:minstrel@postgres:5432/minstrel_test?sslmode=disable steps: - name: Checkout uses: actions/checkout@v4 - name: Detect Go project id: gomod shell: bash run: | if [ -f go.mod ]; then echo "present=true" >> "$GITHUB_OUTPUT" else echo "present=false" >> "$GITHUB_OUTPUT" echo "::notice::No go.mod yet — Go steps will be skipped until the skeleton lands" fi - name: Toolchain versions if: steps.gomod.outputs.present == 'true' run: | go version golangci-lint --version - name: go vet if: steps.gomod.outputs.present == 'true' run: go vet ./... - name: golangci-lint if: steps.gomod.outputs.present == 'true' run: golangci-lint run ./... - name: go test (race + coverage) if: steps.gomod.outputs.present == 'true' run: go test -race -coverprofile=coverage.out ./... - name: Upload coverage artifact if: steps.gomod.outputs.present == 'true' uses: actions/upload-artifact@v4 with: name: coverage path: coverage.out if-no-files-found: ignore