Skip to content

Commit 8718646

Browse files
committed
Update GitHub Actions
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent b45d189 commit 8718646

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,7 @@ jobs:
5454
php_version: ${{ matrix.php-version }}
5555
php_extensions: pcov
5656
command: 'dev-tools'
57-
args: 'tests --coverage=public/coverage'
57+
args: 'tests --coverage=./public/coverage'
5858

5959
- name: Ensure minimum code coverage
60-
env:
61-
MINIMUM_COVERAGE: 80
62-
run: |
63-
COVERAGE=$(php -r '
64-
$xml = new SimpleXMLElement(file_get_contents("public/coverage/clover.xml"));
65-
$m = $xml->project->metrics;
66-
$pct = (int) round(((int) $m["coveredstatements"]) * 100 / (int) $m["statements"]);
67-
echo $pct;
68-
')
69-
echo "Coverage: ${COVERAGE}%"
70-
if [ "${COVERAGE}" -lt ${{ env.MINIMUM_COVERAGE }} ]; then
71-
echo "Code coverage below ${{ env.MINIMUM_COVERAGE }}% threshold."
72-
exit 1
73-
fi
60+
run: php vendor/bin/phpunit-coverage-check --min=80 ./public/coverage/clover.xml

.github/workflows/wiki.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,22 @@ jobs:
5252
args: 'docs'
5353

5454
- name: Prepare wiki submodule branch
55+
id: wiki_branch
5556
working-directory: docs/wiki
5657
run: |
57-
wiki_branch="main"
58-
git fetch origin "$wiki_branch"
58+
git fetch origin
59+
wiki_branch="$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"
60+
61+
if [ -z "$wiki_branch" ]; then
62+
wiki_branch="$(git branch -r | sed 's/^[[:space:]]*origin\///' | grep -v '^HEAD$' | head -n 1)"
63+
fi
64+
65+
if [ -z "$wiki_branch" ]; then
66+
echo "Could not determine wiki branch" >&2
67+
exit 1
68+
fi
69+
70+
echo "branch=$wiki_branch" >> "$GITHUB_OUTPUT"
5971
git checkout -B "$wiki_branch" "origin/$wiki_branch"
6072
6173
- name: Commit & push wiki submodule

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"composer-plugin-api": "^2.0",
2929
"ergebnis/composer-normalize": "^2.50",
3030
"ergebnis/rector-rules": "^1.14",
31+
"esi/phpunit-coverage-check": "^3.0",
3132
"fakerphp/faker": "^1.24",
3233
"friendsofphp/php-cs-fixer": "^3.94",
3334
"phpdocumentor/shim": "^3.9",

0 commit comments

Comments
 (0)