persistence/.gitea/workflows/test.yaml

49 lines
1.4 KiB
YAML
Raw Normal View History

2024-12-17 14:05:14 +05:00
name: Unit tests
run-name: ${{ gitea.actor }} is testing
on: push
2024-12-18 10:35:12 +05:00
env:
POSTGRES_HOST: persistence-cicd-test-postgres-db
POSTGRES_PORT: 5442
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
2024-12-17 14:05:14 +05:00
jobs:
test:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
2024-12-17 15:22:53 +05:00
image: postgres
2024-12-17 14:05:14 +05:00
# Provide the password for postgres
2024-12-18 10:39:56 +05:00
# hostname: ${{ env.POSTGRES_HOST }}
2024-12-17 14:05:14 +05:00
env:
2024-12-18 10:35:12 +05:00
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
2024-12-18 10:39:56 +05:00
POSTGRES_HOST: ${{ env.POSTGRES_HOST }}
2024-12-17 14:05:14 +05:00
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
2024-12-18 10:35:12 +05:00
--health-retries 5
2024-12-17 14:05:14 +05:00
ports:
# Maps tcp port 5432 on service container to the host
2024-12-18 10:35:12 +05:00
- '${{ env.POSTGRES_PORT }}:5432'
2024-12-17 14:05:14 +05:00
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Check out repository code
uses: actions/checkout@v4
2024-12-17 14:48:35 +05:00
- name: Run integration tests
2024-12-17 18:21:17 +05:00
env:
2024-12-18 10:35:12 +05:00
POSTGRES_HOST: ${{ env.POSTGRES_HOST }}
POSTGRES_PORT: ${{ env.POSTGRES_PORT }}
run: dotnet test DD.Persistence.IntegrationTests