Skip to content

Commit 4b93441

Browse files
author
Alex Westergaard
committed
Move render of phpunit badge into CD workflow
1 parent 0ed40a6 commit 4b93441

File tree

2 files changed

+73
-20
lines changed

2 files changed

+73
-20
lines changed

.github/workflows/cd.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Continuous Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- "*" # Should be MASTER after testing
7+
8+
concurrency:
9+
group: ${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
phpunit-render-badge:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: "Checkout"
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: "Setup PHP"
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: "8.2"
26+
extensions: mbstring, intl
27+
ini-values: post_max_size=256M, max_execution_time=180
28+
coverage: xdebug
29+
30+
- name: "Composer State"
31+
run: composer update --no-install --with-all-dependencies
32+
33+
- name: "Composer Name Hash"
34+
id: composer-hash
35+
uses: KEINOS/gh-action-hash-for-cache@main
36+
with:
37+
path: ./composer.lock
38+
39+
- name: "Caching"
40+
id: cache-composer
41+
uses: actions/cache@v3
42+
with:
43+
path: vendor
44+
key: composer-default-${{ steps.composer-hash.outputs.hash }}
45+
restore-keys: composer-default-${{ steps.composer-hash.outputs.hash }}
46+
47+
- name: "Install Dependencies"
48+
if: ${{ steps.cache-composer.outputs.cache-hit != 'true' }}
49+
run: composer install
50+
51+
- name: "Linux: Restore Vendor Executable"
52+
if: matrix.operating-system == 'ubuntu-latest'
53+
run: chmod -R 0755 vendor
54+
55+
- name: "PHPUnit"
56+
run: ./vendor/bin/phpunit
57+
58+
- name: "Make code coverage badge"
59+
uses: timkrase/[email protected]
60+
with:
61+
coverage_badge_path: .github/coverage.svg
62+
# push badge later on
63+
push_badge: false
64+
65+
- name: "Git push badges to origin/image-data"
66+
uses: peaceiris/actions-gh-pages@v3
67+
with:
68+
publish_dir: .github
69+
publish_branch: image-data
70+
github_token: ${{ secrets.GITHUB_TOKEN }}
71+
user_name: "github-actions[bot]"
72+
user_email: "github-actions[bot]@users.noreply.github.com"

.github/workflows/ci.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP CI
1+
name: Continuous Integration
22

33
on:
44
pull_request:
@@ -74,25 +74,6 @@ jobs:
7474
- name: "PHPUnit"
7575
run: ./vendor/bin/phpunit
7676

77-
- name: "Coverage"
78-
run: echo "$(cat ./.phpunit/coverage.txt)"
79-
80-
- name: Make code coverage badge
81-
uses: timkrase/[email protected]
82-
with:
83-
coverage_badge_path: .github/coverage.svg
84-
# push badge later on
85-
push_badge: false
86-
87-
- name: Git push badges to image-data branch
88-
uses: peaceiris/actions-gh-pages@v3
89-
with:
90-
publish_dir: .github
91-
publish_branch: image-data
92-
github_token: ${{ secrets.GITHUB_TOKEN }}
93-
user_name: "github-actions[bot]"
94-
user_email: "github-actions[bot]@users.noreply.github.com"
95-
9677
phpunit-composer-lowest:
9778
needs: validate-master
9879
runs-on: ${{ matrix.operating-system }}

0 commit comments

Comments
 (0)