-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (82 loc) · 3.38 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Tests
on:
push:
branches:
- master
- release/*
pull_request:
workflow_dispatch:
env:
MYSQL_IMAGE: mysql:8.0
MYSQL_PORT: 3306
MYSQL_DB_OPTIONS: "--health-cmd=\"mysqladmin ping\" --health-interval=10s --health-timeout=5s --health-retries=3"
MYSQL_PHPUNIT_CONFIG: "phpunit-ci-mysql.xml.dist"
POSTGRES_IMAGE: postgres:17
POSTGRES_PORT: 5432
POSTGRES_DB_OPTIONS: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3"
POSTGRES_PHPUNIT_CONFIG: "phpunit-ci-postgres.xml.dist"
MATRIX_EXCLUDE: "[{\"php\"=>\"8.3\", \"laravel\"=>\"9.*\"},{\"php\"=>\"8.1\", \"laravel\"=>\"11.*\"}]"
jobs:
# Environment variables are not available in the matrix context, so we have to define them as outputs.
prepare:
name: Prepare environment
runs-on: ubuntu-latest
outputs:
MYSQL_IMAGE: ${{ env.MYSQL_IMAGE }}
MYSQL_PORT: ${{ env.MYSQL_PORT }}
MYSQL_DB_OPTIONS: ${{ env.MYSQL_DB_OPTIONS }}
MYSQL_PHPUNIT_CONFIG: ${{ env.MYSQL_PHPUNIT_CONFIG }}
POSTGRES_IMAGE: ${{ env.POSTGRES_IMAGE }}
POSTGRES_PORT: ${{ env.POSTGRES_PORT }}
POSTGRES_DB_OPTIONS: ${{ env.POSTGRES_DB_OPTIONS }}
POSTGRES_PHPUNIT_CONFIG: ${{ env.POSTGRES_PHPUNIT_CONFIG }}
steps:
# Placeholder because a job needs a step.
- run: echo "null"
mysql-tests:
name: MySQL tests
needs: prepare
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@feature/pass-db-image
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9.*, 10.*, 11.* ]
dependency-version: [ prefer-stable ]
exclude:
- php: 8.3
laravel: 9.*
- php: 8.1
laravel: 11.*
with:
DATABASE_NAME: protector_test
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
TEST_COMMANDS: vendor/bin/phpunit -c ${{ needs.prepare.outputs.MYSQL_PHPUNIT_CONFIG }}
postgres-tests:
name: PostgreSQL tests
needs: prepare
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@feature/pass-db-image
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9.*, 10.*, 11.* ]
dependency-version: [ prefer-stable ]
exclude:
- php: 8.3
laravel: 9.*
- php: 8.1
laravel: 11.*
with:
DATABASE_IMAGE: ${{ needs.prepare.outputs.POSTGRES_IMAGE }}
DATABASE_NAME: protector_test
DATABASE_PORT: ${{ needs.prepare.outputs.POSTGRES_PORT }}
DATABASE_USERNAME: postgres
DATABASE_CONNECTION: pgsql
DATABASE_OPTIONS: ${{ needs.prepare.outputs.POSTGRES_DB_OPTIONS }}
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
TEST_COMMANDS: vendor/bin/phpunit -c ${{ needs.prepare.outputs.MYSQL_PHPUNIT_CONFIG }}