Skip to content

Commit b0f99bb

Browse files
authored
Merge pull request #118 from WyriHaximus/5.x-ci-fixes
CI fixes
2 parents aedb817 + 4d05cd5 commit b0f99bb

File tree

7 files changed

+553
-783
lines changed

7 files changed

+553
-783
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -6,188 +6,12 @@ on:
66
- 'master'
77
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
88
pull_request:
9+
## This workflow needs the `pull-request` permissions to work for the package diffing
10+
## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
11+
permissions:
12+
pull-requests: write
13+
contents: read
914
jobs:
10-
supported-versions-matrix:
11-
name: Supported Versions Matrix
12-
runs-on: ubuntu-latest
13-
needs:
14-
- lint-yaml
15-
- lint-json
16-
outputs:
17-
version: ${{ steps.supported-versions-matrix.outputs.version }}
18-
steps:
19-
- uses: actions/checkout@v1
20-
- id: supported-versions-matrix
21-
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
22-
supported-checks-matrix:
23-
name: Supported Checks Matrix
24-
runs-on: ubuntu-latest
25-
needs:
26-
- lint-yaml
27-
- composer-install
28-
outputs:
29-
check: ${{ steps.supported-checks-matrix.outputs.check }}
30-
steps:
31-
- uses: actions/checkout@v1
32-
- id: supported-checks-matrix
33-
name: Generate check
34-
run: |
35-
printf "Checks found: %s\r\n" $(make task-list-ci)
36-
printf "::set-output name=check::%s" $(make task-list-ci)
37-
composer-install:
38-
strategy:
39-
fail-fast: false
40-
matrix:
41-
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
42-
composer: [lowest, current, highest]
43-
needs:
44-
- lint-yaml
45-
- lint-json
46-
- supported-versions-matrix
47-
runs-on: ubuntu-latest
48-
container:
49-
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
50-
steps:
51-
- uses: actions/checkout@v1
52-
- name: Cache composer packages
53-
uses: actions/cache@v1
54-
with:
55-
path: ./vendor/
56-
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
57-
- name: Install Dependencies
58-
run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
59-
if: matrix.composer == 'lowest'
60-
- name: Install Dependencies
61-
run: composer install --ansi --no-progress --no-interaction --prefer-dist -o
62-
if: matrix.composer == 'current'
63-
- name: Install Dependencies
64-
run: composer update --ansi --no-progress --no-interaction --prefer-dist -o
65-
if: matrix.composer == 'highest'
66-
qa:
67-
name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (Linux)
68-
strategy:
69-
fail-fast: false
70-
matrix:
71-
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
72-
composer: [lowest, current, highest]
73-
check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }}
74-
needs:
75-
- lint-yaml
76-
- lint-json
77-
- composer-install
78-
- supported-checks-matrix
79-
- supported-versions-matrix
80-
runs-on: ubuntu-latest
81-
container:
82-
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
83-
steps:
84-
- uses: actions/checkout@v1
85-
- name: Cache composer packages
86-
uses: actions/cache@v1
87-
with:
88-
path: ./vendor/
89-
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
90-
- name: Install Dependencies
91-
run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
92-
if: matrix.composer == 'lowest'
93-
- name: Install Dependencies
94-
run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o
95-
if: matrix.composer == 'current'
96-
- name: Install Dependencies
97-
run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o
98-
if: matrix.composer == 'highest'
99-
- name: Fetch Tags
100-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
101-
if: matrix.check == 'backward-compatibility-check'
102-
- run: make ${{ matrix.check }}
103-
env:
104-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
105-
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
106-
unittests-directly-on-os:
107-
name: Run unit tests on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (${{ matrix.os }})
108-
strategy:
109-
fail-fast: false
110-
matrix:
111-
os: [ubuntu-latest, windows-latest, macos-latest]
112-
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
113-
composer: [lowest, current, highest]
114-
needs:
115-
- lint-yaml
116-
- lint-json
117-
- composer-install
118-
- supported-versions-matrix
119-
runs-on: ${{ matrix.os }}
120-
steps:
121-
- uses: actions/checkout@v1
122-
- name: Setup PHP, extensions and composer with shivammathur/setup-php
123-
uses: shivammathur/setup-php@v2
124-
with:
125-
php-version: ${{ matrix.php }}
126-
coverage: xdebug, pcov
127-
- name: Cache composer packages
128-
uses: actions/cache@v1
129-
with:
130-
path: ./vendor/
131-
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
132-
- name: Install Dependencies
133-
run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
134-
if: matrix.composer == 'lowest'
135-
- name: Install Dependencies
136-
run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o
137-
if: matrix.composer == 'current'
138-
- name: Install Dependencies
139-
run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o
140-
if: matrix.composer == 'highest'
141-
- name: Fetch Tags
142-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
143-
if: matrix.check == 'backward-compatibility-check'
144-
- run: |
145-
./vendor/bin/phpunit -c ./etc/qa/phpunit.xml
146-
php ./examples/advanced-own-child-process/index.php
147-
php ./examples/error/index.php
148-
php ./examples/messages/index.php
149-
php ./examples/overflow/index.php
150-
php ./examples/prime/index.php
151-
php ./examples/return-class/index.php
152-
php ./examples/return-class-messaging/index.php
153-
php ./examples/secure-messages/index.php
154-
php ./examples/secure-return-class/index.php
155-
php ./examples/time-format/index.php
156-
env:
157-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
158-
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
159-
lint-yaml:
160-
name: Lint YAML
161-
runs-on: ubuntu-latest
162-
steps:
163-
- uses: actions/checkout@v1
164-
- name: yaml-lint
165-
uses: ibiqlik/action-yamllint@v3
166-
with:
167-
config_data: |
168-
extends: default
169-
ignore: |
170-
/.git/
171-
rules:
172-
line-length: disable
173-
document-start: disable
174-
truthy: disable
175-
lint-json:
176-
name: Lint JSON
177-
runs-on: ubuntu-latest
178-
steps:
179-
- uses: actions/checkout@v1
180-
- name: json-syntax-check
181-
uses: limitusus/json-syntax-check@v1
182-
with:
183-
pattern: "\\.json$"
184-
check-mark:
185-
name: ✔️
186-
needs:
187-
- lint-yaml
188-
- lint-json
189-
- qa
190-
- unittests-directly-on-os
191-
runs-on: ubuntu-latest
192-
steps:
193-
- run: echo "✔️"
15+
ci:
16+
name: Continuous Integration
17+
uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main

.github/workflows/set-milestone-on-pr.yaml

Lines changed: 0 additions & 87 deletions
This file was deleted.

Makefile

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
-v "`pwd`:`pwd`" \
2222
-v "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" \
2323
-w "`pwd`" \
24-
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine3.12${SLIM_DOCKER_IMAGE}-dev"
24+
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev"
2525
endif
2626

2727
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
@@ -52,14 +52,21 @@ unit-testing: ## Run tests
5252
$(DOCKER_RUN) vendor/bin/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml
5353
$(DOCKER_RUN) test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./var/tests-unit-clover-coverage.xml && vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true
5454

55+
unit-testing-raw: ## Run tests ###
56+
php vendor/phpunit/phpunit/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml
57+
test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./var/tests-unit-clover-coverage.xml && ./vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true
58+
5559
mutation-testing: ## Run mutation testing
56-
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(THREADS) --ignore-msi-with-no-mutations || (cat ./var/infection.log && false)
60+
$(DOCKER_RUN) vendor/bin/roave-infection-static-analysis-plugin --ansi --log-verbosity=all --threads=$(THREADS) --psalm-config etc/qa/psalm.xml || (cat ./var/infection.log && false)
61+
62+
mutation-testing-raw: ## Run mutation testing ###
63+
php vendor/roave/infection-static-analysis-plugin/bin/roave-infection-static-analysis-plugin --ansi --log-verbosity=all --threads=$(THREADS) --psalm-config etc/qa/psalm.xml || (cat ./var/infection.log && false)
5764

5865
composer-require-checker: ## Ensure we require every package used in this package directly
5966
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json
6067

6168
composer-unused: ## Ensure we don't require any package we don't use in this package directly
62-
$(DOCKER_RUN) composer unused --ansi
69+
$(DOCKER_RUN) vendor/bin/composer-unused --ansi
6370

6471
composer-install: ## Install dependencies
6572
$(DOCKER_RUN) composer install --no-progress --ansi --no-interaction --prefer-dist -o
@@ -70,20 +77,8 @@ backward-compatibility-check: ## Check code for backwards incompatible changes
7077
backward-compatibility-check-raw: ## Check code for backwards incompatible changes, doesn't ignore the failure ###
7178
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check
7279

73-
run-examples: ## Run all examples
74-
$(DOCKER_RUN) php examples/advanced-own-child-process/index.php
75-
$(DOCKER_RUN) php examples/error/index.php
76-
$(DOCKER_RUN) php examples/messages/index.php
77-
$(DOCKER_RUN) php examples/overflow/index.php
78-
$(DOCKER_RUN) php examples/prime/index.php
79-
$(DOCKER_RUN) php examples/return-class/index.php
80-
$(DOCKER_RUN) php examples/return-class-messaging/index.php
81-
$(DOCKER_RUN) php examples/secure-messages/index.php
82-
$(DOCKER_RUN) php examples/secure-return-class/index.php
83-
$(DOCKER_RUN) php examples/time-format/index.php
84-
8580
shell: ## Provides Shell access in the expected environment ###
86-
$(DOCKER_RUN) ash
81+
$(DOCKER_RUN) bash
8782

8883
task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
8984
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'

composer.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.4",
13+
"php": "^8 || ^7.4",
1414
"ext-hash": "^8 || ^7.4",
1515
"ext-json": "^8 || ^7.4",
1616
"cakephp/utility": "^4.2.4",
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"phpstan/phpstan-phpunit": "^0.12.22",
36-
"wyrihaximus/async-test-utilities": ">=4.0.5"
36+
"wyrihaximus/async-test-utilities": "^4.2.2"
3737
},
3838
"autoload": {
3939
"psr-4": {
@@ -49,6 +49,13 @@
4949
]
5050
},
5151
"config": {
52+
"allow-plugins": {
53+
"dealerdirect/phpcodesniffer-composer-installer": true,
54+
"infection/extension-installer": true,
55+
"ergebnis/composer-normalize": true,
56+
"icanhazstring/composer-unused": true,
57+
"wyrihaximus/composer-update-bin-autoload-path": true
58+
},
5259
"platform": {
5360
"php": "7.4.7"
5461
},

0 commit comments

Comments
 (0)