Skip to content

Merge pull request #80 from nootey/development #181

Merge pull request #80 from nootey/development

Merge pull request #80 from nootey/development #181

Workflow file for this run

name: "Run Server Tests"
on:
push:
paths-ignore:
- 'docs/**'
- 'deployments/**'
- '*.md'
- 'client/**'
branches:
- main
workflow_dispatch:
pull_request:
paths-ignore:
- 'docs/**'
- 'deployments/**'
- '*.md'
- 'client/**'
branches:
- main
- development
types: [ opened, synchronize, reopened ]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Start test services
run: docker compose -f deployments/docker/docker-compose.test.yaml up -d
- name: Wait for PostgreSQL
run: |
timeout 30 bash -c 'until docker compose -f deployments/docker/docker-compose.test.yaml exec -T postgres-test pg_isready; do sleep 1; done'
- name: Install dependencies
run: go mod download
- name: Run tests with coverage
run: |
make test-coverage
- name: Archive code coverage results
uses: actions/upload-artifact@v6
with:
name: code-coverage
path: coverage.out
code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
runs-on: ubuntu-latest
needs: test
continue-on-error: true # not critical
permissions:
contents: read
actions: read # to download code coverage results from "test" job
pull-requests: write # write permission needed to comment on PR
steps:
- uses: actions/checkout@v6
- uses: fgrosse/go-coverage-report@v1.2.0
with:
coverage-artifact-name: code-coverage
coverage-file-name: coverage.out