Skip to content

Commit a66c0af

Browse files
committed
Use re-usable workflows
1 parent 277df35 commit a66c0af

File tree

2 files changed

+9
-141
lines changed

2 files changed

+9
-141
lines changed

.github/workflows/check.yml

Lines changed: 5 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2-
3-
name: "Check"
4-
51
on:
62
pull_request:
73
push:
@@ -10,121 +6,8 @@ on:
106
- "!gh-pages"
117

128
jobs:
13-
coding-standards:
14-
name: "Coding Standard"
15-
runs-on: "ubuntu-latest"
16-
17-
strategy:
18-
matrix:
19-
php-version:
20-
- "8.1"
21-
22-
steps:
23-
- name: "Checkout"
24-
uses: actions/checkout@v3
25-
26-
- name: "Install PHP"
27-
uses: "shivammathur/setup-php@v2"
28-
with:
29-
coverage: "none"
30-
php-version: "${{ matrix.php-version }}"
31-
32-
- name: "Validate Composer"
33-
run: "composer validate"
34-
35-
- name: "Install dependencies"
36-
run: "composer install --no-interaction --no-progress"
37-
38-
- name: "ECS"
39-
run: "composer lint:check"
40-
41-
- name: "Rector"
42-
run: "composer lint:upgrade:check"
43-
44-
tests:
45-
name: "Tests"
46-
runs-on: "ubuntu-latest"
47-
48-
strategy:
49-
fail-fast: false
50-
matrix:
51-
php-version:
52-
- "8.1"
53-
dependencies:
54-
- "lowest"
55-
- "highest"
56-
57-
steps:
58-
- name: "Checkout"
59-
uses: actions/checkout@v3
60-
61-
- name: "Install PHP"
62-
uses: "shivammathur/setup-php@v2"
63-
with:
64-
coverage: "xdebug"
65-
php-version: "${{ matrix.php-version }}"
66-
67-
- name: "Install lowest dependencies"
68-
if: ${{ matrix.dependencies == 'lowest' }}
69-
run: "composer update --prefer-lowest --no-interaction --no-progress"
70-
71-
- name: "Install highest dependencies"
72-
if: ${{ matrix.dependencies == 'highest' }}
73-
run: "composer update --no-interaction --no-progress"
74-
75-
- name: "Tests"
76-
id: tests
77-
continue-on-error: false
78-
run: |
79-
vendor/bin/phpunit --coverage-text --coverage-text=coverage.txt
80-
echo "::set-output name=coverage::$(cat coverage.txt | grep -Po '^\s*Lines:\s*\d+.\d+\%' | grep -Po '\d+.\d+')"
81-
82-
# TODO on pull request add comment?
83-
84-
- name: "Create badge"
85-
if: ${{ github.ref == 'refs/heads/main' && matrix.dependencies == 'highest' && steps.tests.outputs.coverage != '' }}
86-
uses: schneegans/dynamic-badges-action@v1.4.0
87-
with:
88-
auth: ${{ secrets.GIST_SECRET }}
89-
gistID: 11b884c06da0bf9116ae763d23438ecb
90-
filename: coverage.json
91-
label: Coverage
92-
# TODO colors?
93-
message: ${{ steps.tests.outputs.coverage }}
94-
color: success
95-
96-
static-analysis:
97-
name: "PHPStan"
98-
runs-on: "ubuntu-latest"
99-
100-
strategy:
101-
fail-fast: false
102-
matrix:
103-
php-version:
104-
- "8.1"
105-
dependencies:
106-
- "lowest"
107-
- "highest"
108-
109-
steps:
110-
- name: "Checkout"
111-
uses: actions/checkout@v3
112-
113-
- name: "Install PHP"
114-
uses: "shivammathur/setup-php@v2"
115-
with:
116-
coverage: "none"
117-
php-version: "${{ matrix.php-version }}"
118-
extensions: mbstring
119-
tools: composer:v2
120-
121-
- name: "Install lowest dependencies"
122-
if: ${{ matrix.dependencies == 'lowest' }}
123-
run: "composer update --prefer-lowest --no-interaction --no-progress"
124-
125-
- name: "Install highest dependencies"
126-
if: ${{ matrix.dependencies == 'highest' }}
127-
run: "composer update --no-interaction --no-progress"
128-
129-
- name: "PHPStan"
130-
run: "composer lint:stan"
9+
run:
10+
uses: wrk-flow/reusable-workflows/.github/workflows/php-check.yml@main
11+
secrets: inherit
12+
with:
13+
gistID: 11b884c06da0bf9116ae763d23438ecb

.github/workflows/deploy-docs.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
name: Documentation
2+
23
on:
34
push:
45
branches:
56
- main
67
tags:
78
- v**
89
jobs:
9-
build-and-deploy:
10-
concurrency: docs-${{ github.ref }}
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout 🛎️
14-
uses: actions/checkout@v3
15-
16-
- name: Install and Build 🔧
17-
run: |
18-
cd docs
19-
npm ci
20-
npm run generate
21-
22-
- name: Deploy 🚀
23-
uses: JamesIves/github-pages-deploy-action@v4.3.3
24-
with:
25-
branch: gh-pages # The branch the action should deploy to.
26-
folder: docs/dist # The folder the action should deploy.
27-
clean: true
10+
run:
11+
uses: wrk-flow/reusable-workflows/.github/workflows/deploy-docs.yml@main
12+
secrets: inherit

0 commit comments

Comments
 (0)