-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (106 loc) · 3.5 KB
/
test-web-twig.yaml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: 'Web Twig: Code Quality Checks'
on:
push:
paths:
- packages/web-twig/**
# Changes in SVG icons also affect snapshots in web-twig package
# e.g. svg content is generated into the snapshot
- packages/icons/**
pull_request:
paths:
- packages/web-twig/**
# Changes in SVG icons also affect snapshots in web-twig package
# e.g. svg content is generated into the snapshot
- packages/icons/**
jobs:
prepare-icons:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
uses: bahmutov/[email protected]
with:
useRollingCache: true
install-command: yarn --immutable
- name: Build Icons
working-directory: ./packages/icons
run: yarn build
- name: Save built icons
uses: actions/upload-artifact@v4
with:
name: icons-dist
path: ./packages/icons/dist
unit-tests:
needs: [prepare-icons]
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3']
dependencies: ['']
name: Unit tests - PHP ${{ matrix.php-version }} ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v4
- name: Download built icons
uses: actions/download-artifact@v4
with:
name: icons-dist
path: ./packages/icons/dist
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json, mbstring
coverage: xdebug
- name: Install dependencies
working-directory: ./packages/web-twig
run: composer update --no-progress --no-interaction ${{ matrix.dependencies }}
- name: Copy Assets
working-directory: ./packages/web-twig
run: cp ../icons/dist/svg/* ./static
- name: Run tests
working-directory: ./packages/web-twig
run: |
composer phpunit:coverage
# Publish code coverage after the code is public
- name: Submit coverage to Coveralls
working-directory: ./packages/web-twig
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ github.job }}-PHP-${{ matrix.php-version }} ${{ matrix.dependencies }}
run: |
composer global require php-coveralls/php-coveralls
~/.composer/vendor/bin/php-coveralls --coverage_clover=coverage/clover.xml --json_path=coverage/coveralls-upload.json -v
finalize-tests:
name: Tests finished
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- name: Notify Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
flag-name: web-twig
codestyle:
name: 'Code style and static analysis'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: json, mbstring
- name: Install dependencies
working-directory: ./packages/web-twig
run: composer update --no-progress
- name: Run checks
working-directory: ./packages/web-twig
run: composer analyze