|
1 | 1 | name: CI |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - cake-5 |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - '*' |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
4 | 14 |
|
5 | 15 | jobs: |
6 | 16 | testsuite: |
7 | | - runs-on: ubuntu-18.04 |
8 | | - strategy: |
9 | | - fail-fast: false |
10 | | - matrix: |
11 | | - php-version: ['7.4', '8.0', '8.1'] |
12 | | - db-type: [mysql, pgsql] |
13 | | - prefer-lowest: [''] |
14 | | - include: |
15 | | - - php-version: '7.2' |
16 | | - db-type: 'sqlite' |
17 | | - prefer-lowest: 'prefer-lowest' |
18 | | - |
19 | | - services: |
20 | | - postgres: |
21 | | - image: postgres |
22 | | - ports: |
23 | | - - 5432:5432 |
24 | | - env: |
25 | | - POSTGRES_PASSWORD: postgres |
26 | | - |
27 | | - steps: |
28 | | - - uses: actions/checkout@v2 |
29 | | - |
30 | | - - name: Setup Service |
31 | | - if: matrix.db-type == 'mysql' |
32 | | - run: | |
33 | | - sudo service mysql start |
34 | | - mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;' |
35 | | -
|
36 | | - - name: Setup PHP |
37 | | - uses: shivammathur/setup-php@v2 |
38 | | - with: |
39 | | - php-version: ${{ matrix.php-version }} |
40 | | - extensions: mbstring, intl, pdo_${{ matrix.db-type }} |
41 | | - coverage: pcov |
42 | | - |
43 | | - - name: Composer install |
44 | | - run: | |
45 | | - if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then |
46 | | - composer update --prefer-lowest --prefer-stable |
47 | | - else |
48 | | - composer install |
49 | | - fi |
50 | | -
|
51 | | - - name: Run PHPUnit |
52 | | - run: | |
53 | | - if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi |
54 | | - if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:[email protected]/cakephp'; fi |
55 | | - if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:[email protected]/postgres'; fi |
56 | | -
|
57 | | - if [[ ${{ matrix.php-version }} == '7.4' && ${{ matrix.db-type }} == 'mysql' ]]; then |
58 | | - vendor/bin/phpunit --coverage-clover=coverage.xml |
59 | | - else |
60 | | - vendor/bin/phpunit |
61 | | - fi |
62 | | -
|
63 | | - - name: Code Coverage Report |
64 | | - if: success() && matrix.php-version == '7.4' && matrix.db-type == 'mysql' |
65 | | - uses: codecov/codecov-action@v2 |
| 17 | + uses: cakephp/.github/.github/workflows/[email protected] |
| 18 | + secrets: inherit |
66 | 19 |
|
67 | 20 | cs-stan: |
68 | | - name: Coding Standard & Static Analysis |
69 | | - runs-on: ubuntu-18.04 |
70 | | - |
71 | | - steps: |
72 | | - - uses: actions/checkout@v2 |
73 | | - |
74 | | - - name: Setup PHP |
75 | | - uses: shivammathur/setup-php@v2 |
76 | | - with: |
77 | | - php-version: '7.4' |
78 | | - extensions: mbstring, intl |
79 | | - coverage: none |
80 | | - tools: cs2pr, phpstan:1.2 |
81 | | - |
82 | | - - name: Composer Install |
83 | | - run: composer install |
84 | | - |
85 | | - - name: Run phpcs |
86 | | - run: vendor/bin/phpcs --report=checkstyle --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ | cs2pr |
87 | | - |
88 | | - - name: Run phpstan |
89 | | - if: success() || failure() |
90 | | - run: phpstan analyse |
| 21 | + uses: cakephp/.github/.github/workflows/[email protected] |
| 22 | + secrets: inherit |
0 commit comments