Skip to content

Commit 12932ec

Browse files
Marick van TuilMarick van Tuil
authored andcommitted
Run multiple database versions
1 parent eda2e39 commit 12932ec

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/run-tests.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ jobs:
6262
needs: access_check
6363
strategy:
6464
matrix:
65-
db: [ 'mysql', 'pgsql' ]
65+
db:
66+
- { driver: 'mysql', version: '8.0' }
67+
- { driver: 'mysql', version: '8.4' }
68+
- { driver: 'pgsql', version: '14' }
69+
- { driver: 'pgsql', version: '15' }
70+
- { driver: 'pgsql', version: '16' }
71+
- { driver: 'pgsql', version: '17' }
6672
payload:
6773
- { queue: 'github-actions-laravel11-php82', laravel: '11.*', php: '8.2', 'testbench': '9.*' }
6874
- { queue: 'github-actions-laravel11-php83', laravel: '11.*', php: '8.3', 'testbench': '9.*' }
@@ -71,7 +77,7 @@ jobs:
7177
- { queue: 'github-actions-laravel12-php83', laravel: '12.*', php: '8.3', 'testbench': '10.*' }
7278
- { queue: 'github-actions-laravel12-php84', laravel: '12.*', php: '8.4', 'testbench': '10.*' }
7379

74-
name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db }}
80+
name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db.driver }} ${{ matrix.db.version }}
7581

7682
steps:
7783
- name: Checkout code
@@ -91,12 +97,16 @@ jobs:
9197
CI_SERVICE_ACCOUNT_JSON_KEY: ${{ secrets.CI_SERVICE_ACCOUNT_JSON_KEY }}
9298
run: |
9399
touch .env
94-
MYSQL_PORT=3307 POSTGRES_PORT=5432 docker compose up ${{ matrix.db }} -d
100+
if [ "${{ matrix.db }}" = "mysql" ]; then
101+
MYSQL_PORT=3307 MYSQL_VERSION=${{ matrix.db.version }} docker compose up ${{ matrix.db.driver }} -d
102+
elif [ "${DB}" = "pgsql" ]; then
103+
POSTGRES_PORT=5432 PGSQL_VERSION=${{ matrix.db.version }} docker compose up ${{ matrix.db.driver }} -d
104+
fi
95105
- name: Install dependencies
96106
run: |
97107
composer require "laravel/framework:${{ matrix.payload.laravel }}" "orchestra/testbench:${{ matrix.payload.testbench }}" --no-interaction --no-update
98108
composer update --prefer-stable --prefer-dist --no-interaction
99-
if [ "${{ matrix.db }}" = "mysql" ]; then
109+
if [ "${{ matrix.db.driver }}" = "mysql" ]; then
100110
while ! mysqladmin ping --host=127.0.0.1 --user=cloudtasks --port=3307 --password=cloudtasks --silent; do
101111
echo "Waiting for MySQL..."
102112
sleep 1
@@ -106,7 +116,7 @@ jobs:
106116
fi
107117
- name: Execute tests
108118
env:
109-
DB_DRIVER: ${{ matrix.db }}
119+
DB_DRIVER: ${{ matrix.db.driver }}
110120
DB_HOST: 127.0.0.1
111121
CI_CLOUD_TASKS_PROJECT_ID: ${{ secrets.CI_CLOUD_TASKS_PROJECT_ID }}
112122
CI_CLOUD_TASKS_QUEUE: ${{ secrets.CI_CLOUD_TASKS_QUEUE }}

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
- .:/var/www/html
1010
- ${CI_SERVICE_ACCOUNT_JSON_KEY_PATH-./tests/Support/gcloud-key-valid.json}:/var/www/html/tests/Support/gcloud-key-valid.json
1111
mysql:
12-
image: mysql:8
12+
image: 'mysql:${MYSQL_VERSION:-8.0}'
1313
ports:
1414
- '${MYSQL_PORT:-3307}:3306'
1515
environment:
@@ -18,7 +18,7 @@ services:
1818
MYSQL_DATABASE: 'cloudtasks'
1919
MYSQL_ROOT_PASSWORD: 'root'
2020
pgsql:
21-
image: postgres:14
21+
image: 'postgres:${PGSQL_VERSION:-14}'
2222
ports:
2323
- '${POSTGRES_PORT:-5432}:5432'
2424
environment:

0 commit comments

Comments
 (0)