Skip to content

Commit

Permalink
Merge pull request #178 from MrDave1999/ci
Browse files Browse the repository at this point in the history
ci: Implement health check for MariaDB in docker container
  • Loading branch information
MrDave1999 authored Oct 19, 2024
2 parents 4d2ecba + 075cc81 commit d618a69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,34 @@ jobs:

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: Install MariaDB
uses: ankane/setup-mariadb@v1
with:
database: gamemode
- name: Check MariaDB version
run: mariadb --version
- name: Initialize MariaDB
run: |
mariadb -uroot -e "CREATE USER 'admin'@'localhost' IDENTIFIED BY 'admin'"
mariadb -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost'"
mariadb -uroot -e "FLUSH PRIVILEGES"
mariadb -uroot gamemode < ./scripts/mariadb/gamemode.sql
run: docker exec mariadb mariadb --version
- name: Check SQLite version
run: sqlite3 --version
- name: Create SQLite database
run: sqlite3 gamemode.db < ./scripts/sqlite/gamemode.sql
- name: Import databases
run: |
docker exec -i 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
Expand Down
4 changes: 2 additions & 2 deletions tests/Persistence.Tests/.env.test.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MariaDB__Server=localhost
MariaDB__Port=3306
MariaDB__Database=gamemode
MariaDB__UserName=admin
MariaDB__Password=admin
MariaDB__UserName=root
MariaDB__Password=123456789

SQLite__DataSource=/home/runner/work/Capture-The-Flag/Capture-The-Flag/gamemode.db

0 comments on commit d618a69

Please sign in to comment.