|
1 | | -name: CI |
| 1 | +name: "CI" |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
5 | 5 | push: |
6 | 6 | branches: |
7 | 7 | - "master" |
8 | 8 | schedule: |
9 | | - - cron: "0 17 * * *" |
| 9 | + - cron: "42 3 * * *" |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - coding-standard: |
13 | | - runs-on: ubuntu-18.04 |
14 | | - name: Coding Standard |
| 12 | + phpunit: |
| 13 | + name: "PHPUnit" |
| 14 | + runs-on: "ubuntu-20.04" |
15 | 15 |
|
16 | | - steps: |
17 | | - - uses: actions/checkout@v2 |
18 | | - |
19 | | - - name: Install PHP |
20 | | - uses: shivammathur/[email protected] |
21 | | - with: |
22 | | - php-version: 7.4 |
23 | | - coverage: none |
24 | | - extensions: json |
25 | | - tools: cs2pr |
26 | | - |
27 | | - - name: Get Composer Cache Directory |
28 | | - id: composer-cache |
29 | | - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
30 | | - |
31 | | - - name: Cache dependencies |
32 | | - uses: actions/cache@v1 |
33 | | - with: |
34 | | - path: ${{ steps.composer-cache.outputs.dir }} |
35 | | - key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
36 | | - restore-keys: ${{ runner.os }}-composer- |
37 | | - |
38 | | - - name: Install Dependencies |
39 | | - run: composer install ${DEPENDENCIES} |
40 | | - |
41 | | - - name: Coding Standard |
42 | | - run: vendor/bin/phpcs -q --report=checkstyle | cs2pr |
43 | | - |
44 | | - phpstan: |
45 | | - runs-on: ubuntu-18.04 |
46 | | - name: PHPStan |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + php-version: |
| 19 | + - "7.4" |
| 20 | + - "8.0" |
| 21 | + dependencies: |
| 22 | + - "highest" |
| 23 | + include: |
| 24 | + - dependencies: "lowest" |
| 25 | + php-version: "7.4" |
47 | 26 |
|
48 | 27 | steps: |
49 | | - - uses: actions/checkout@v2 |
50 | | - |
51 | | - - name: Install PHP |
52 | | - uses: shivammathur/[email protected] |
| 28 | + - name: "Checkout" |
| 29 | + uses: "actions/checkout@v2" |
53 | 30 | with: |
54 | | - php-version: 7.4 |
55 | | - coverage: none |
56 | | - extensions: json |
57 | | - tools: cs2pr |
58 | | - |
59 | | - - name: Get Composer Cache Directory |
60 | | - id: composer-cache |
61 | | - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 31 | + fetch-depth: 2 |
62 | 32 |
|
63 | | - - name: Cache dependencies |
64 | | - uses: actions/cache@v1 |
| 33 | + - name: "Install PHP" |
| 34 | + uses: "shivammathur/setup-php@v2" |
65 | 35 | with: |
66 | | - path: ${{ steps.composer-cache.outputs.dir }} |
67 | | - key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
68 | | - restore-keys: ${{ runner.os }}-composer- |
69 | | - |
70 | | - - name: Install Dependencies |
71 | | - run: composer install ${DEPENDENCIES} |
| 36 | + php-version: "${{ matrix.php-version }}" |
| 37 | + coverage: "pcov" |
| 38 | + ini-values: "zend.assertions=1" |
72 | 39 |
|
73 | | - - name: PHPStan |
74 | | - run: vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr |
75 | | - |
76 | | - coverage: |
77 | | - runs-on: ubuntu-18.04 |
78 | | - name: Code Coverage |
79 | | - |
80 | | - steps: |
81 | | - - uses: actions/checkout@v2 |
| 40 | + - name: "Install dependencies with Composer" |
| 41 | + uses: "ramsey/composer-install@v1" |
82 | 42 | with: |
83 | | - ref: ${{ github.ref }} |
| 43 | + dependency-versions: "${{ matrix.dependencies }}" |
84 | 44 |
|
85 | | - - name: Install PHP |
86 | | - uses: shivammathur/[email protected] |
87 | | - with: |
88 | | - php-version: 7.4 |
89 | | - coverage: pcov |
90 | | - extensions: json |
| 45 | + - name: "Run PHPUnit" |
| 46 | + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" |
91 | 47 |
|
92 | | - - name: Get Composer Cache Directory |
93 | | - id: composer-cache |
94 | | - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
95 | | - |
96 | | - - name: Cache dependencies |
97 | | - uses: actions/cache@v1 |
| 48 | + - name: "Upload coverage file" |
| 49 | + uses: "actions/upload-artifact@v2" |
98 | 50 | with: |
99 | | - path: ${{ steps.composer-cache.outputs.dir }} |
100 | | - key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
101 | | - restore-keys: ${{ runner.os }}-composer- |
102 | | - |
103 | | - - name: Install Dependencies |
104 | | - run: composer install ${DEPENDENCIES} |
105 | | - |
106 | | - - name: Code coverage |
107 | | - run: | |
108 | | - ./vendor/bin/phpunit --coverage-clover /tmp/coverage/clover.xml |
| 51 | + name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage" |
| 52 | + path: "coverage.xml" |
109 | 53 |
|
110 | | - - name: Report to Coveralls |
111 | | - env: |
112 | | - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
113 | | - COVERALLS_RUN_LOCALLY: 1 |
114 | | - run: vendor/bin/php-coveralls --coverage_clover /tmp/coverage/clover.xml --json_path /tmp/coverage/coveralls.json |
115 | | - |
116 | | - tests: |
117 | | - name: Tests |
118 | | - runs-on: ubuntu-18.04 |
119 | | - strategy: |
120 | | - matrix: |
121 | | - php: [ 7.3, 7.4 ] |
122 | | - dependencies: [ "", --prefer-lowest ] |
| 54 | + upload_coverage: |
| 55 | + name: "Upload coverage to Codecov" |
| 56 | + runs-on: "ubuntu-20.04" |
| 57 | + needs: |
| 58 | + - "phpunit" |
123 | 59 |
|
124 | 60 | steps: |
125 | | - - uses: actions/checkout@v2 |
126 | | - |
127 | | - - name: Install PHP |
128 | | - uses: shivammathur/[email protected] |
| 61 | + - name: "Checkout" |
| 62 | + uses: "actions/checkout@v2" |
129 | 63 | with: |
130 | | - php-version: ${{ matrix.php }} |
131 | | - coverage: none |
132 | | - extensions: json, mbstring |
133 | | - - name: Get Composer Cache Directory |
134 | | - id: composer-cache |
135 | | - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 64 | + fetch-depth: 2 |
136 | 65 |
|
137 | | - - name: Cache dependencies |
138 | | - uses: actions/cache@v1 |
| 66 | + - name: "Download coverage files" |
| 67 | + uses: "actions/download-artifact@v2" |
139 | 68 | with: |
140 | | - path: ${{ steps.composer-cache.outputs.dir }} |
141 | | - key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
142 | | - restore-keys: ${{ runner.os }}-composer- |
143 | | - |
144 | | - - name: Install Dependencies |
145 | | - run: composer install ${DEPENDENCIES} |
| 69 | + path: "reports" |
146 | 70 |
|
147 | | - - name: Run tests |
148 | | - run: | |
149 | | - export $ENV |
150 | | - ./vendor/bin/phpunit |
151 | | - env: |
152 | | - ENV: ${{ matrix.env}} |
| 71 | + - name: "Upload to Codecov" |
| 72 | + uses: "codecov/codecov-action@v1" |
| 73 | + with: |
| 74 | + directory: reports |
0 commit comments