Files
arbeitszeitmessung/.gitea/workflows/testing.yaml
Tom Tröger 81cdca42f9
Some checks failed
GoLang Tests / check and test (push) Has been cancelled
hopefully working
2025-08-21 22:23:22 +02:00

54 lines
1.6 KiB
YAML

name: GoLang Tests
run-name: ${{ gitea.actor }} is testing golang Code
on: [push]
jobs:
testing:
name: check and test
runs-on: ubuntu-latest
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: arbeitszeitmessung
POSTGRES_PORT: 5432
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # all history for all branches and tags
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: Backend/go.mod
check-latest: true
- uses: https://gitea.com/actions/go-hashfiles@v0.0.1
id: hash-go
with:
patterns: |
go.mod
go.sum
- name: cache go
id: cache-go
uses: actions/cache@v4
with:
path: |
/go_path
/go_cache
key: go_path-${{ steps.hash-go.outputs.hash }}
- name: Setup test database
run: |
docker run -d --rm --name postgres_build_db \
-p $POSTGRES_PORT:5432 \
-e POSTGRES_USER=$POSTGRES_USER \
-e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
-e POSTGRES_DB=$POSTGRES_DB \
postgres:16
while [[ $(docker logs postgres_build_db 2>&1 | grep -c "database system is ready to accept connections") == 0 ]]; do
sleep 1;
done;
- name: Run Go Tests
run: cd Backend && go test ./...
- name: Shutdown Postgres DB
run: docker stop postgres_build_db