-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (147 loc) · 5.05 KB
/
test.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: 🔍 Code Quality Checks
on:
# Run this workflow on push to branches only (not tags)
push:
branches:
- '**'
schedule:
- cron: '0 9 * * *' # every day at 9:00
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_BRANCH: ${{ github.event.number || github.ref_name }}
NX_VERBOSE_LOGGING: true
NX_NO_CLOUD: true
CACHE_KEY: repository-cache-key-${{ github.run_id }}
jobs:
install-build:
name: 🧶 Install Deps and 🏗️ Build Design Tokens
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-install
- name: Build
run: yarn workspace @lmc-eu/spirit-design-tokens build
- name: Save Repository to Cache
id: save-repository-cache
uses: actions/cache/save@v4
with:
path: ./
key: ${{ env.CACHE_KEY }}
lint:
name: 📐 Code Linting
needs: [install-build]
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
steps:
- name: Restore Repository from Cache
uses: actions/cache/restore@v4
id: restore-repository-cache
with:
path: ./
key: ${{ env.CACHE_KEY }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Lint
run: yarn lint
unit-tests:
name: 🧪 Unit Testing
needs: [install-build]
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
steps:
- name: Restore Repository from Cache
uses: actions/cache/restore@v4
id: restore-repository-cache
with:
path: ./
key: ${{ env.CACHE_KEY }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Unit Tests
# Ignoring web-twig tests as they have separated workflow.
# See `test-web-twig.yaml` for web-twig unit tests.
run: yarn test:unit --ignore '@lmc-eu/spirit-web-twig'
- name: Publish Web Package Code Coverage
# When Nx hits its cloud cache, there is no generated coverage to sent, e.g. do not let this crash
if: ${{ hashFiles('./packages/web/.coverage/lcov.info') != '' }}
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./packages/web/.coverage/lcov.info
flag-name: web
carryforward: web-react, web-twig, analytics, design-tokens, icons, common, codemods, form-validations
- name: Publish Web-React Package Code Coverage
# When Nx hits its cloud cache, there is no generated coverage to sent, e.g. do not let this crash
if: ${{ hashFiles('./packages/web-react/.coverage/lcov.info') != '' }}
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./packages/web-react/.coverage/lcov.info
flag-name: web-react
carryforward: web, web-twig, analytics, design-tokens, icons, common, codemods, form-validations
- name: Publish Analytics Package Code Coverage
# When Nx hits its cloud cache, there is no generated coverage to sent, e.g. do not let this crash
if: ${{ hashFiles('./packages/analytics/.coverage/lcov.info') != '' }}
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./packages/analytics/.coverage/lcov.info
flag-name: analytics
carryforward: web, web-react, web-twig, design-tokens, icons, common, codemods, form-validations
format:
name: 💅 Code Formatting
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-install
- name: Check Code-Style Format
run: yarn format:check
types:
name: 📘 Type Checking
needs: [install-build]
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
steps:
- name: Restore Repository from Cache
uses: actions/cache/restore@v4
id: restore-repository-cache
with:
path: ./
key: ${{ env.CACHE_KEY }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Types Check
run: yarn types
cleanup:
name: 🧹 Cleanup
needs: [lint, unit-tests, types]
runs-on: ubuntu-24.04
timeout-minutes: 10
# Ensure this job runs regardless of previous job outcomes
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
# @see: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy
- name: Cleanup cache
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ env.CACHE_KEY }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}