|
1 | 1 | name: build |
2 | 2 | on: |
3 | 3 | pull_request: |
4 | | - branches: |
5 | | - - main |
| 4 | + branches: [ "main" ] |
6 | 5 | push: |
7 | | - branches: |
8 | | - - main |
| 6 | + branches: [ "main" ] |
9 | 7 | paths: |
10 | 8 | - ".github/workflows/build.yml" |
11 | 9 | - "bin/**" |
12 | 10 | - "src/**" |
13 | 11 | - "tests/**" |
14 | 12 | - "composer.json" |
15 | | - - "*.dist" |
| 13 | + - "*.dist*" |
16 | 14 | schedule: |
17 | 15 | - cron: '0 16 * * 0' # sunday 16:00 |
18 | 16 |
|
| 17 | +# Actions |
| 18 | +# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action |
| 19 | + |
19 | 20 | jobs: |
20 | | - build: |
21 | | - name: PHP ${{ matrix.php-versions }} |
| 21 | + phpcs: |
| 22 | + name: Code Style (phpcs) |
22 | 23 | runs-on: "ubuntu-latest" |
23 | | - |
24 | | - strategy: |
25 | | - matrix: |
26 | | - php-versions: ['7.3', '7.4', '8.0'] |
27 | | - |
28 | 24 | steps: |
29 | | - |
30 | 25 | - name: Checkout |
31 | 26 | uses: actions/checkout@v2 |
| 27 | + - name: Setup PHP |
| 28 | + uses: shivammathur/setup-php@v2 |
| 29 | + with: |
| 30 | + php-version: '8.0' |
| 31 | + coverage: none |
| 32 | + tools: composer:v2, phpcs, cs2pr |
| 33 | + - name: phpcs |
| 34 | + run: phpcs -q --report=checkstyle | cs2pr |
32 | 35 |
|
33 | | - # see https://github.com/marketplace/actions/setup-php-action |
| 36 | + php-cs-fixer: |
| 37 | + name: Code Style (php-cs-fixer) |
| 38 | + runs-on: "ubuntu-latest" |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v2 |
34 | 42 | - name: Setup PHP |
35 | 43 | uses: shivammathur/setup-php@v2 |
36 | 44 | with: |
37 | | - php-version: ${{ matrix.php-versions }} |
38 | | - extensions: dom, json |
| 45 | + php-version: '8.0' |
39 | 46 | coverage: none |
40 | | - tools: composer:v2, cs2pr, phive |
41 | | - env: |
42 | | - fail-fast: true |
| 47 | + tools: composer:v2, php-cs-fixer, cs2pr |
| 48 | + - name: php-cs-fixer |
| 49 | + run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr |
43 | 50 |
|
| 51 | + phpstan: |
| 52 | + name: Code analysis (phpstan) |
| 53 | + runs-on: "ubuntu-latest" |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v2 |
| 57 | + - name: Setup PHP |
| 58 | + uses: shivammathur/setup-php@v2 |
| 59 | + with: |
| 60 | + php-version: '8.0' |
| 61 | + coverage: none |
| 62 | + tools: composer:v2, phpstan |
44 | 63 | - name: Get composer cache directory |
45 | 64 | id: composer-cache |
46 | 65 | run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
47 | | - |
48 | | - - name: Composer cache dependencies |
| 66 | + - name: Cache dependencies |
49 | 67 | uses: actions/cache@v2 |
50 | 68 | with: |
51 | 69 | path: ${{ steps.composer-cache.outputs.dir }} |
52 | 70 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
53 | 71 | restore-keys: ${{ runner.os }}-composer- |
| 72 | + - name: Install project dependencies |
| 73 | + run: composer upgrade --no-interaction --no-progress --prefer-dist |
| 74 | + - name: phpstan |
| 75 | + run: phpstan analyse --no-progress --verbose |
54 | 76 |
|
55 | | - - name: Phive cache dependencies |
| 77 | + check-current-max-occurs-paths: |
| 78 | + name: Check src/UnboundedOccursPaths.json file |
| 79 | + runs-on: "ubuntu-latest" |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v2 |
| 83 | + - name: Setup PHP |
| 84 | + uses: shivammathur/setup-php@v2 |
| 85 | + with: |
| 86 | + php-version: '8.0' |
| 87 | + coverage: none |
| 88 | + tools: composer:v2 |
| 89 | + - name: Get composer cache directory |
| 90 | + id: composer-cache |
| 91 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 92 | + - name: Cache dependencies |
56 | 93 | uses: actions/cache@v2 |
57 | 94 | with: |
58 | | - path: ~/.phive |
59 | | - key: ${{ runner.os }}-phive-${{ hashFiles('**/.phive/phars.xml') }} |
60 | | - restore-keys: ${{ runner.os }}-phive- |
61 | | - |
| 95 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 96 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 97 | + restore-keys: ${{ runner.os }}-composer- |
62 | 98 | - name: Install project dependencies |
63 | 99 | run: composer upgrade --no-interaction --no-progress --prefer-dist |
64 | | - |
65 | | - - name: Install phive dependencies |
66 | | - run: | |
67 | | - phive install --force-accept-unsigned --trust-gpg-keys 0x4AA394086372C20A,0x31C7E470E2138192,0xE82B2FB314E9906E,0xCF1A108D0E7AE720,0xC5095986493B4AA0 |
68 | | - git checkout -- .phive/phars.xml |
69 | | -
|
70 | 100 | - name: Check src/UnboundedOccursPaths.json |
71 | 101 | run: bash bin/check-current-max-occurs-paths.bash |
72 | 102 |
|
73 | | - - name: Code style (phpcs) |
74 | | - run: tools/phpcs -q --report=checkstyle bin/ src/ tests/ | cs2pr |
75 | | - |
76 | | - - name: Code style (php-cs-fixer) |
77 | | - run: tools/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr |
78 | | - |
79 | | - - name: Tests (phpunit) |
| 103 | + tests: |
| 104 | + name: Tests on PHP ${{ matrix.php-versions }} (phpunit) |
| 105 | + runs-on: "ubuntu-latest" |
| 106 | + strategy: |
| 107 | + matrix: |
| 108 | + php-versions: ['7.3', '7.4', '8.0', '8.1'] |
| 109 | + steps: |
| 110 | + - name: Checkout |
| 111 | + uses: actions/checkout@v2 |
| 112 | + - name: Setup PHP |
| 113 | + uses: shivammathur/setup-php@v2 |
| 114 | + with: |
| 115 | + php-version: ${{ matrix.php-versions }} |
| 116 | + coverage: none |
| 117 | + tools: composer:v2 |
| 118 | + env: |
| 119 | + fail-fast: true |
| 120 | + - name: Get composer cache directory |
| 121 | + id: composer-cache |
| 122 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 123 | + - name: Cache dependencies |
| 124 | + uses: actions/cache@v2 |
| 125 | + with: |
| 126 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 127 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 128 | + restore-keys: ${{ runner.os }}-composer- |
| 129 | + - name: Install project dependencies |
| 130 | + run: composer upgrade --no-interaction --no-progress --prefer-dist |
| 131 | + - name: Tests |
80 | 132 | run: vendor/bin/phpunit --testdox --verbose |
81 | 133 |
|
82 | | - - name: Code analysis (phpstan) |
83 | | - run: tools/phpstan analyse --level max --no-progress --verbose bin/ src/ tests/ |
84 | | - |
85 | | - - name: Mutation testing (infection) |
86 | | - run: phpdbg -qrr tools/infection --no-progress --no-interaction --show-mutations --logger-github |
87 | | - continue-on-error: true |
| 134 | + infection: |
| 135 | + name: Mutation testing analysis (infection) |
| 136 | + runs-on: "ubuntu-latest" |
| 137 | + steps: |
| 138 | + - name: Checkout |
| 139 | + uses: actions/checkout@v2 |
| 140 | + - name: Setup PHP |
| 141 | + uses: shivammathur/setup-php@v2 |
| 142 | + with: |
| 143 | + php-version: '8.0' |
| 144 | + coverage: xdebug |
| 145 | + tools: composer:v2, infection |
| 146 | + - name: Get composer cache directory |
| 147 | + id: composer-cache |
| 148 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 149 | + - name: Cache dependencies |
| 150 | + uses: actions/cache@v2 |
| 151 | + with: |
| 152 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 153 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 154 | + restore-keys: ${{ runner.os }}-composer- |
| 155 | + - name: Install project dependencies |
| 156 | + run: composer upgrade --no-interaction --no-progress --prefer-dist |
| 157 | + - name: Create code coverage |
| 158 | + run: vendor/bin/phpunit --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml |
| 159 | + - name: infection |
| 160 | + run: infection --skip-initial-tests --coverage=build/coverage --no-progress --no-interaction --logger-github |
0 commit comments