-
-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (110 loc) · 2.91 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Tests
on:
push:
branches:
- main
tags-ignore:
- "**"
pull_request:
branches:
- main
repository_dispatch:
types:
- tests
jobs:
ci:
name: CI
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
php-version:
- "8.1"
- "8.2"
- "8.3"
include:
-
os: ubuntu-latest
php-version: "8.2"
check-cs: true
runs-on: ${{ matrix.os }}
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: ${{ matrix.check-cs && 'php-cs-fixer:v3,' || '' }} composer:v2
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Cache PHP-CS-Fixer
if: matrix.check-cs
uses: actions/cache@v3
with:
path: .php-cs-fixer.cache
key: ${{ runner.os }}-${{ matrix.php-version }}-phpcsfixer
-
name: Install Composer dependencies
run: composer update --optimize-autoloader --no-progress --ansi --no-interaction
-
name: Build
run: ./bin/unipoints build
-
name: Check built assets
if: startsWith(matrix.os, 'windows') == false
run: |
if ! git diff --exit-code --name-status; then
echo "::error file=$(git diff --name-status | head -n 1)::PLEASE RUN bin/unipoints build"
exit 1
fi
-
name: Check PHP coding style
if: matrix.check-cs
run: composer run-script phpcs -- --ansi --no-interaction --dry-run --diff
-
name: PHPUnit
run: composer run-script test -- --colors=always
docs:
name: Docs
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: npm
cache-dependency-path: docs-src/package-lock.json
-
name: Install NPM dependencies
run: cd docs-src && npm ci
-
name: Check coding style
run: cd docs-src && npm run-script lint
-
name: Build
run: cd docs-src && npm run-script build
-
name: Check changes
id: check-changes
if: github.repository == 'mlocati/unipoints' && github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
if ! git diff --exit-code --name-status; then
echo "commit=yes" >>"$GITHUB_OUTPUT"
fi
-
name: Push changes
if: steps.check-changes.outputs.commit == 'yes'
run: |
git config user.name GitHub
git config user.email [email protected]
git add --all
git commit -m 'Rebuilding docs'
git push