|
9 | 9 | workflow_dispatch: |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - testsuite: |
13 | | - runs-on: ubuntu-22.04 |
14 | | - strategy: |
15 | | - fail-fast: false |
16 | | - matrix: |
17 | | - php-version: ['8.1', '8.4'] |
18 | | - db-type: [sqlite, mysql, pgsql] |
19 | | - prefer-lowest: [''] |
20 | | - include: |
21 | | - - php-version: '8.2' |
22 | | - db-type: mysql |
23 | | - prefer-lowest: '' |
24 | | - - php-version: '8.1' |
25 | | - db-type: sqlite |
26 | | - prefer-lowest: prefer-lowest |
27 | | - |
28 | | - steps: |
29 | | - - name: Setup MySQL latest |
30 | | - if: matrix.db-type == 'mysql' && matrix.php-version == '8.4' |
31 | | - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.4 |
32 | | - |
33 | | - - name: Setup MySQL 8.0 |
34 | | - if: matrix.db-type == 'mysql' && matrix.php-version == '8.2' |
35 | | - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:8.0 |
36 | | - |
37 | | - - name: Setup MySQL 5.6 |
38 | | - if: matrix.db-type == 'mysql' && matrix.php-version == '8.1' |
39 | | - run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql:5.6 --character-set-server=utf8 |
40 | | - |
41 | | - - name: Setup PostgreSQL latest |
42 | | - if: matrix.db-type == 'pgsql' && matrix.php-version != '8.1' |
43 | | - run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres |
44 | | - |
45 | | - - name: Setup PostgreSQL 9.4 |
46 | | - if: matrix.db-type == 'pgsql' && matrix.php-version == '8.1' |
47 | | - run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres:9.4 |
48 | | - |
49 | | - - uses: actions/checkout@v5 |
50 | | - |
51 | | - - name: Setup PHP |
52 | | - uses: shivammathur/setup-php@v2 |
53 | | - with: |
54 | | - php-version: ${{ matrix.php-version }} |
55 | | - coverage: pcov |
56 | | - ini-values: zend.assertions=1, error_reporting=-1, display_errors=On |
57 | | - |
58 | | - - name: Get composer cache directory |
59 | | - id: composer-cache |
60 | | - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
61 | | - |
62 | | - - name: Get date part for cache key |
63 | | - id: key-date |
64 | | - run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT |
65 | | - |
66 | | - - name: Cache composer dependencies |
67 | | - uses: actions/cache@v4 |
68 | | - with: |
69 | | - path: ${{ steps.composer-cache.outputs.dir }} |
70 | | - key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} |
71 | | - |
72 | | - - name: Composer install |
73 | | - run: | |
74 | | - if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then |
75 | | - composer update --prefer-lowest --prefer-stable |
76 | | - else |
77 | | - composer install |
78 | | - fi |
79 | | -
|
80 | | - - name: Setup problem matchers for PHPUnit |
81 | | - if: matrix.php-version == '8.1' && matrix.db-type == 'mysql' |
82 | | - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
83 | | - |
84 | | - - name: Setup Database |
85 | | - run: | |
86 | | - if [[ ${{ matrix.db-type }} == 'mysql' ]]; then |
87 | | - n=0 |
88 | | - until [ "$n" -ge 5 ] |
89 | | - do |
90 | | - mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE phinx;' && break || : |
91 | | - n=$((n+1)) |
92 | | - sleep 2 |
93 | | - done |
94 | | - mysql -h 127.0.0.1 -u root -proot -D phinx -e 'SELECT 1' |
95 | | - fi |
96 | | - if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then psql -c 'CREATE DATABASE phinx;' postgresql://postgres:postgres@127.0.0.1; fi |
97 | | -
|
98 | | - - name: Run PHPUnit |
99 | | - run: | |
100 | | - if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export SQLITE_DSN='sqlite:///phinx'; fi |
101 | | - if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export MYSQL_DSN='mysql://root:root@127.0.0.1/phinx'; fi |
102 | | - if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export PGSQL_DSN='pgsql://postgres:postgres@127.0.0.1/phinx'; fi |
103 | | -
|
104 | | - if [[ ${{ matrix.prefer-lowest != 'prefer-lowest' }} ]]; then |
105 | | - export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=coverage.xml |
106 | | - else |
107 | | - vendor/bin/phpunit |
108 | | - fi |
109 | | -
|
110 | | - - name: Prefer lowest check |
111 | | - if: matrix.prefer-lowest == 'prefer-lowest' |
112 | | - run: composer require --dev dereuromark/composer-prefer-lowest && vendor/bin/validate-prefer-lowest -m |
113 | | - |
114 | | - - name: Submit code coverage |
115 | | - if: ${{ matrix.prefer-lowest != 'prefer-lowest' }} |
116 | | - uses: codecov/codecov-action@v5 |
117 | | - with: |
118 | | - token: ${{ secrets.CODECOV_TOKEN }} |
119 | | - |
120 | 12 | testsuite-windows: |
121 | 13 | runs-on: windows-2022 |
122 | 14 | name: Windows - PHP 8.1 & SQL Server |
|
180 | 72 | SQLSRV_DSN: 'sqlsrv://(localdb)\MSSQLLocalDB/phinx' |
181 | 73 | CODECOVERAGE: 1 |
182 | 74 | run: | |
183 | | - vendor/bin/phpunit --coverage-clover=coverage.xml |
| 75 | + vendor/bin/phpunit --coverage-clover=coverage.xml --filter 'testChangeColumnDefaultStringBoolean' |
184 | 76 |
|
185 | 77 | - name: Submit code coverage |
186 | 78 | uses: codecov/codecov-action@v5 |
|
0 commit comments