57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Tests
|
|
run-name: ${{ gitea.actor }} is testing golang Code
|
|
on: [push]
|
|
|
|
jobs:
|
|
testing:
|
|
name: Run Go Tests
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: arbeitszeitmessung
|
|
env:
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: arbeitszeitmessung
|
|
POSTGRES_PORT: 5432
|
|
RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: Backend/go.mod
|
|
- 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: arbeitszeitmessung-${{ steps.hash-go.outputs.hash }}
|
|
restore-keys: |-
|
|
arbeitszeitmessung-
|
|
- name: Run Go Tests
|
|
run: cd Backend && mkdir .test && go test ./... -coverprofile=.test/coverage.out -json > .test/report.json
|
|
- uses: SonarSource/sonarqube-scan-action@v6
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
- uses: SonarSource/sonarqube-quality-gate-action@v1
|
|
timeout-minutes: 5
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|