run: fix: run not aborted when task execution fails #687
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
windows: | |
runs-on: windows-latest | |
env: | |
BAUR_TEST_POSTGRESQL_URL: "postgres://baurtest:baurtest@localhost:5432/postgres?sslmode=disable" | |
steps: | |
- name: Start PostgreSQL | |
run: | | |
$pgService = Get-Service -Name postgresql* | |
Set-Service -InputObject $pgService -Status running -StartupType automatic | |
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru | |
- name: Create PostgreSQL user | |
run: | | |
set +e | |
set -x | |
"$PGBIN"/createuser --createdb baurtest | |
"$PGBIN"/psql -c "ALTER USER baurtest PASSWORD 'baurtest';" postgres | |
shell: bash | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Checkout Git | |
uses: actions/checkout@v4 | |
- name: Setup Git | |
run: | | |
git config --global user.email "baurtest@example.com" | |
git config --global user.name "baur" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }} | |
- name: Run Tests with Race Detector | |
run: | | |
go test -tags=dbtest -race -timeout 5m ./... | |
shell: bash | |
- name: Run Tests without Race Detector and CGO | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
go test -tags=dbtest -timeout 5m ./... | |
shell: bash | |
linux: | |
runs-on: ubuntu-latest | |
env: | |
BAUR_TEST_POSTGRESQL_URL: "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
s3: | |
image: adobe/s3mock:3.9.1 | |
env: | |
debug: true | |
initialBuckets: mock | |
options: >- | |
--health-cmd "wget --spider localhost:9090" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 127.0.0.1:9090:9090 | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.23" | |
- name: Checkout Git | |
uses: actions/checkout@v4 | |
- name: Setup Git | |
run: | | |
git config --global user.email "baurtest@example.com" | |
git config --global user.name "baur" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-test-${{ hashFiles('**/go.sum') }} | |
- name: Run Tests with Race Detector | |
run: | | |
go test -tags=dbtest,s3test -race -timeout 5m ./... | |
- name: Run Tests without Race Detector and CGO | |
env: | |
CGO_ENABLED: 0 | |
run: | | |
go test -tags=dbtest,s3test -timeout 5m ./... |