Updated deps on workflow

This commit is contained in:
Hein 2025-12-08 16:59:49 +02:00
parent c9eaf84125
commit 8d123e47bd

View File

@ -1,42 +1,33 @@
name: Tests name: Tests
on: on:
push: push:
branches: [main, develop] branches: [main, develop]
pull_request: pull_request:
branches: [main, develop] branches: [main, develop]
jobs: jobs:
unit-tests: unit-tests:
name: Unit Tests name: Unit Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v6
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v6
with: with:
go-version: "1.21" go-version: "1.21"
- name: Run unit tests - name: Run unit tests
run: go test ./pkg/resolvespec ./pkg/restheadspec -v -cover run: go test ./pkg/resolvespec ./pkg/restheadspec -v -cover
- name: Generate coverage report - name: Generate coverage report
run: | run: |
go test ./pkg/resolvespec ./pkg/restheadspec -coverprofile=coverage.out go test ./pkg/resolvespec ./pkg/restheadspec -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage - name: Upload coverage
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v5
with: with:
name: coverage-report name: coverage-report
path: coverage.html path: coverage.html
integration-tests: integration-tests:
name: Integration Tests name: Integration Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
services: services:
postgres: postgres:
image: postgres:15-alpine image: postgres:15-alpine
@ -51,41 +42,34 @@ jobs:
--health-retries 5 --health-retries 5
ports: ports:
- 5432:5432 - 5432:5432
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v6
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v6
with: with:
go-version: "1.21" go-version: "1.21"
- name: Create test databases - name: Create test databases
env: env:
PGPASSWORD: postgres PGPASSWORD: postgres
run: | run: |
psql -h localhost -U postgres -c "CREATE DATABASE resolvespec_test;" psql -h localhost -U postgres -c "CREATE DATABASE resolvespec_test;"
psql -h localhost -U postgres -c "CREATE DATABASE restheadspec_test;" psql -h localhost -U postgres -c "CREATE DATABASE restheadspec_test;"
- name: Run resolvespec integration tests - name: Run resolvespec integration tests
env: env:
TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=resolvespec_test port=5432 sslmode=disable" TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=resolvespec_test port=5432 sslmode=disable"
run: go test -tags=integration ./pkg/resolvespec -v run: go test -tags=integration ./pkg/resolvespec -v
- name: Run restheadspec integration tests - name: Run restheadspec integration tests
env: env:
TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=restheadspec_test port=5432 sslmode=disable" TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=restheadspec_test port=5432 sslmode=disable"
run: go test -tags=integration ./pkg/restheadspec -v run: go test -tags=integration ./pkg/restheadspec -v
- name: Generate integration coverage - name: Generate integration coverage
env: env:
TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=resolvespec_test port=5432 sslmode=disable" TEST_DATABASE_URL: "host=localhost user=postgres password=postgres dbname=resolvespec_test port=5432 sslmode=disable"
run: | run: |
go test -tags=integration ./pkg/resolvespec ./pkg/restheadspec -coverprofile=coverage-integration.out go test -tags=integration ./pkg/resolvespec ./pkg/restheadspec -coverprofile=coverage-integration.out
go tool cover -html=coverage-integration.out -o coverage-integration.html go tool cover -html=coverage-integration.out -o coverage-integration.html
- name: Upload integration coverage - name: Upload integration coverage
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v5
with: with:
name: integration-coverage-report name: integration-coverage-report
path: coverage-integration.html path: coverage-integration.html