Use the configuration depending on the selected database provider #13
@ -12,35 +12,7 @@ jobs:
|
||||
matrix:
|
||||
db-provider: [sqlite, mysql, postgresql]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: testdb
|
||||
options: >-
|
||||
--health-cmd "mysqladmin ping --silent"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5555:3306
|
||||
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: testdb
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 6666:5432
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -68,10 +40,28 @@ jobs:
|
||||
run: |
|
||||
jq '.DbSettings.TypeDatabase = 0 | .DbSettings.ConnectionStringSql = "Server=127.0.0.1;Port=5555;Database=testdb;Uid=root;Pwd=root;"' Settings.json > temp.json && mv temp.json Settings.json
|
||||
|
||||
- name: Install MySQL
|
||||
if: matrix.db-provider == 'mysql'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mysql-server
|
||||
sudo service mysql start
|
||||
sudo mysql -e "CREATE DATABASE testdb; CREATE USER 'root'@'localhost' IDENTIFIED BY 'root'; GRANT ALL PRIVILEGES ON testdb.* TO 'root'@'localhost'; FLUSH PRIVILEGES;"
|
||||
|
||||
- name: Modify configuration for PostgreSQL
|
||||
if: matrix.db-provider == 'postgresql'
|
||||
run: |
|
||||
jq '.DbSettings.TypeDatabase = 2 | .DbSettings.ConnectionStringSql = "Host=127.0.0.1;Port=6666;Database=testdb;Username=postgres;Password=postgres"' Settings.json > temp.json && mv temp.json Settings.json
|
||||
|
||||
- name: Install PostgreSQL
|
||||
if: matrix.db-provider == 'postgresql'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y postgresql postgresql-contrib
|
||||
sudo service postgresql start
|
||||
sudo -u postgres psql -c "CREATE DATABASE testdb;"
|
||||
sudo -u postgres psql -c "CREATE USER postgres WITH PASSWORD 'postgres';"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE testdb TO postgres;"
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
|
Loading…
Reference in New Issue
Block a user