Improve ci pipeline testing #67
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
gilgoblin-database: | |
image: nickreinlein/gilgoblin-database | |
env: | |
POSTGRES_DB: gilgoblin_db | |
POSTGRES_USER: gilgoblin | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd "pg_isready -d gilgoblin_db -U gilgoblin" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Wait for Database | |
run: | | |
for i in {1..10}; do | |
if pg_isready -h localhost -p 5432; then | |
echo "Database is ready!" | |
exit 0 | |
else | |
echo "Waiting for database... ($i/10)" | |
sleep 5 | |
fi | |
done | |
echo "Database did not become ready in time." | |
exit 1 | |
- name: Test | |
env: | |
ConnectionStrings__GilGoblinDbContext: ${{ env.DB_CONNECTION_STRING }} | |
run: dotnet test --no-build --verbosity detailed --filter "Category!=Component" |