Skip to content

Commit

Permalink
Run Mysql and Mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 31, 2024
1 parent cb0994c commit 481ce37
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ jobs:

services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: gangs
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping --silent" --health-interval 10s

mariadb:
image: mariadb:latest
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes
MARIADB_DATABASE: gangs
ports:
- 3306:3306
- 3307:3306
options: --health-cmd "mysqladmin ping --silent" --health-interval 10s

steps:
- uses: actions/checkout@v4
Expand All @@ -37,11 +47,19 @@ jobs:
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test GangsTest/GangsTest.csproj --no-build --verbosity normal
- name: Test with MySQL
env:
DB_CONNECTION_STRING: "Server=localhost;Port=3306;Database=gangs;User=root"
run: dotnet test GangsTest/GangsTest.csproj --no-build --verbosity normal

- name: Test with MariaDB
env:
DB_CONNECTION_STRING: "Server=localhost;Port=3307;Database=gangs;User=root"
run: dotnet test GangsTest/GangsTest.csproj --no-build --verbosity normal
5 changes: 3 additions & 2 deletions GangsTest/StatTests/StatManagerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace GangsTest.StatTests;
public class StatManagerData : IEnumerable<object[]> {
private readonly IBehavior[] behaviors = [
new MockStatManager(),
new SQLStatManager("Server=localhost;User=root;Database=gangs",
"gang_unit_test"),
new SQLStatManager(
Environment.GetEnvironmentVariable("DB_CONNECTION_STRING")
?? "Server=localhost;User=root;Database=gangs", "gang_unit_test"),
new SQLiteStatManager("Data Source=:memory:", "gang_unit_test")
];

Expand Down

0 comments on commit 481ce37

Please sign in to comment.