ci: Implement health check for MariaDB in docker container #425
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: Capture.The.Flag | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- dev | |
env: | |
DOTNET_VERSION: '8.x' | |
jobs: | |
unit_testing: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Execute unit tests | |
run: dotnet test ./tests/Application.Tests/CTF.Application.Tests.csproj -c Release | |
integration_testing: | |
runs-on: ubuntu-latest | |
services: | |
mariadb: | |
image: mariadb | |
ports: | |
- 3306:3306 | |
env: | |
MARIADB_DATABASE: gamemode | |
MARIADB_ROOT_PASSWORD: 123456789 | |
options: >- | |
--name mariadb | |
--health-cmd="mariadb-admin ping -h localhost" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Check MariaDB version | |
run: docker exec mariadb mariadb --version | |
- name: Check SQLite version | |
run: sqlite3 --version | |
- name: Import databases | |
run: | | |
docker exec mariadb mariadb -uroot -p123456789 gamemode < ./scripts/mariadb/gamemode.sql | |
sqlite3 gamemode.db < ./scripts/sqlite/gamemode.sql | |
- name: Create .env.test file | |
run: cp ./tests/Persistence.Tests/.env.test.example ./tests/Persistence.Tests/.env.test | |
- name: Execute integration tests | |
run: dotnet test ./tests/Persistence.Tests/Persistence.Tests.csproj -c Release |