From e78a0a0f390263734a6a8638c7a5210741dc76c9 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 18 Oct 2024 14:29:11 -0500 Subject: [PATCH 1/3] ci: Use 'setup-mariadb' action instead of docker container --- .github/workflows/ci.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89b3e003..0772332c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,31 +24,27 @@ 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 steps: - uses: actions/checkout@v4 - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Check sqlite3 version + - name: Install MariaDB + uses: ankane/setup-mariadb@v1 + with: + database: gamemode + 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 + - name: Check MariaDB version + run: mariadb --version + - name: Check SQLite version run: sqlite3 --version - - name: Waiting for database availability - run: | - chmod u+x wait-for-it.sh - ./wait-for-it.sh -t 60 127.0.0.1:3306 - - name: Import databases - run: | - docker exec -i mariadb mariadb -uroot -p123456789 -h127.0.0.1 gamemode < ./scripts/mariadb/gamemode.sql - sqlite3 gamemode.db < ./scripts/sqlite/gamemode.sql + - name: Create SQLite database + run: 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 From 78e708c821bf6256e5ea05f2b46bac651bc93954 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 18 Oct 2024 18:21:46 -0500 Subject: [PATCH 2/3] chore: Update sample test file --- tests/Persistence.Tests/.env.test.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Persistence.Tests/.env.test.example b/tests/Persistence.Tests/.env.test.example index 4674bc47..0211c26c 100644 --- a/tests/Persistence.Tests/.env.test.example +++ b/tests/Persistence.Tests/.env.test.example @@ -1,7 +1,7 @@ MariaDB__Server=localhost MariaDB__Port=3306 MariaDB__Database=gamemode -MariaDB__UserName=root -MariaDB__Password=123456789 +MariaDB__UserName=admin +MariaDB__Password=admin SQLite__DataSource=/home/runner/work/Capture-The-Flag/Capture-The-Flag/gamemode.db \ No newline at end of file From a334161145a692bbd190a2db1c466aa0f549b3a4 Mon Sep 17 00:00:00 2001 From: MrDave1999 Date: Fri, 18 Oct 2024 18:42:17 -0500 Subject: [PATCH 3/3] ci: Update workflow --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0772332c..643aca12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,13 +34,14 @@ jobs: uses: ankane/setup-mariadb@v1 with: database: gamemode - 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 - 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 - name: Check SQLite version run: sqlite3 --version - name: Create SQLite database