|
1 | | -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
2 | | - |
3 | | -name: "Check" |
4 | | - |
5 | 1 | on: |
6 | 2 | pull_request: |
7 | 3 | push: |
|
10 | 6 | - "!gh-pages" |
11 | 7 |
|
12 | 8 | jobs: |
13 | | - coding-standards: |
14 | | - name: "Coding Standard" |
15 | | - runs-on: "ubuntu-latest" |
16 | | - |
17 | | - strategy: |
18 | | - matrix: |
19 | | - php-version: |
20 | | - - "8.1" |
21 | | - |
22 | | - steps: |
23 | | - - name: "Checkout" |
24 | | - uses: actions/checkout@v3 |
25 | | - |
26 | | - - name: "Install PHP" |
27 | | - uses: "shivammathur/setup-php@v2" |
28 | | - with: |
29 | | - coverage: "none" |
30 | | - php-version: "${{ matrix.php-version }}" |
31 | | - |
32 | | - - name: "Validate Composer" |
33 | | - run: "composer validate" |
34 | | - |
35 | | - - name: "Install dependencies" |
36 | | - run: "composer install --no-interaction --no-progress" |
37 | | - |
38 | | - - name: "ECS" |
39 | | - run: "composer lint:check" |
40 | | - |
41 | | - - name: "Rector" |
42 | | - run: "composer lint:upgrade:check" |
43 | | - |
44 | | - tests: |
45 | | - name: "Tests" |
46 | | - runs-on: "ubuntu-latest" |
47 | | - |
48 | | - strategy: |
49 | | - fail-fast: false |
50 | | - matrix: |
51 | | - php-version: |
52 | | - - "8.1" |
53 | | - dependencies: |
54 | | - - "lowest" |
55 | | - - "highest" |
56 | | - |
57 | | - steps: |
58 | | - - name: "Checkout" |
59 | | - uses: actions/checkout@v3 |
60 | | - |
61 | | - - name: "Install PHP" |
62 | | - uses: "shivammathur/setup-php@v2" |
63 | | - with: |
64 | | - coverage: "xdebug" |
65 | | - php-version: "${{ matrix.php-version }}" |
66 | | - |
67 | | - - name: "Install lowest dependencies" |
68 | | - if: ${{ matrix.dependencies == 'lowest' }} |
69 | | - run: "composer update --prefer-lowest --no-interaction --no-progress" |
70 | | - |
71 | | - - name: "Install highest dependencies" |
72 | | - if: ${{ matrix.dependencies == 'highest' }} |
73 | | - run: "composer update --no-interaction --no-progress" |
74 | | - |
75 | | - - name: "Tests" |
76 | | - id: tests |
77 | | - continue-on-error: false |
78 | | - run: | |
79 | | - vendor/bin/phpunit --coverage-text --coverage-text=coverage.txt |
80 | | - echo "::set-output name=coverage::$(cat coverage.txt | grep -Po '^\s*Lines:\s*\d+.\d+\%' | grep -Po '\d+.\d+')" |
81 | | -
|
82 | | - # TODO on pull request add comment? |
83 | | - |
84 | | - - name: "Create badge" |
85 | | - if: ${{ github.ref == 'refs/heads/main' && matrix.dependencies == 'highest' && steps.tests.outputs.coverage != '' }} |
86 | | - uses: schneegans/dynamic-badges-action@v1.4.0 |
87 | | - with: |
88 | | - auth: ${{ secrets.GIST_SECRET }} |
89 | | - gistID: 11b884c06da0bf9116ae763d23438ecb |
90 | | - filename: coverage.json |
91 | | - label: Coverage |
92 | | - # TODO colors? |
93 | | - message: ${{ steps.tests.outputs.coverage }} |
94 | | - color: success |
95 | | - |
96 | | - static-analysis: |
97 | | - name: "PHPStan" |
98 | | - runs-on: "ubuntu-latest" |
99 | | - |
100 | | - strategy: |
101 | | - fail-fast: false |
102 | | - matrix: |
103 | | - php-version: |
104 | | - - "8.1" |
105 | | - dependencies: |
106 | | - - "lowest" |
107 | | - - "highest" |
108 | | - |
109 | | - steps: |
110 | | - - name: "Checkout" |
111 | | - uses: actions/checkout@v3 |
112 | | - |
113 | | - - name: "Install PHP" |
114 | | - uses: "shivammathur/setup-php@v2" |
115 | | - with: |
116 | | - coverage: "none" |
117 | | - php-version: "${{ matrix.php-version }}" |
118 | | - extensions: mbstring |
119 | | - tools: composer:v2 |
120 | | - |
121 | | - - name: "Install lowest dependencies" |
122 | | - if: ${{ matrix.dependencies == 'lowest' }} |
123 | | - run: "composer update --prefer-lowest --no-interaction --no-progress" |
124 | | - |
125 | | - - name: "Install highest dependencies" |
126 | | - if: ${{ matrix.dependencies == 'highest' }} |
127 | | - run: "composer update --no-interaction --no-progress" |
128 | | - |
129 | | - - name: "PHPStan" |
130 | | - run: "composer lint:stan" |
| 9 | + run: |
| 10 | + uses: wrk-flow/reusable-workflows/.github/workflows/php-check.yml@main |
| 11 | + secrets: inherit |
| 12 | + with: |
| 13 | + gistID: 11b884c06da0bf9116ae763d23438ecb |
0 commit comments