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