-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (85 loc) · 2.82 KB
/
main.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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
run-tests:
strategy:
matrix:
# see https://www.php.net/supported-versions.php
php-version: ['8.3', '8.2', '8.1']
name: Tests (PHP ${{ matrix.php-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Get npm cache directory
id: npm-client-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ${{ steps.npm-client-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache other caches
uses: actions/cache@v3
with:
path: |
*.cache
key: ${{ runner.os }}-other-${{ hashFiles('*.cache') }}
restore-keys: |
${{ runner.os }}-other-
- name: Install JavaScript dependencies
run: npm install
- name: PHP Code style check
run: composer fixdiff
- name: PHP Static Analysis
run: composer check
- name: Lint JavaScript & TypeScript
run: npm run lint
- name: Compile TypeScript
run: npm run build
- name: Jest Unit Tests
run: npm run test-ci
- name: PHP Unit Tests
run: composer unit_test; cat ./php-coverage/coverage.txt || echo "no coverage!"
- name: Example - Get npm cache directory
id: npm-example-cache
run: |
cd example; echo "::set-output name=dir::$(npm config get cache)"
- name: Example - Cache npm dependencies
uses: actions/cache@v3
with:
path: ${{ steps.npm-example-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Example - Install JavaScript dependencies
run: cd example; npm install
- name: Example - Run Webpack
run: cd example; npm run webpack-build
- name: Lint JavaScript & TypeScript
run: npm run lint
- name: Example - Jest end-to-end Tests
run: cd example; npm run test-ci
- name: PHP Example Backend Tests
run: composer backend_tests