-
Notifications
You must be signed in to change notification settings - Fork 7
160 lines (160 loc) · 5.18 KB
/
build-lint-test.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
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
name: build-lint-test
on:
workflow_call:
jobs:
build:
uses: ./.github/workflows/build.yml
lint:
runs-on: ubuntu-latest
env:
GH_PR_NUM: ${{ github.event.number }}
needs: build
steps:
- uses: actions/checkout@v4
- run: |
if [[ ! -z "${GH_PR_NUM}" ]]; then
echo "Checking out PR"
git fetch origin pull/$GH_PR_NUM/head:tmp
git checkout tmp
fi
- uses: actions/cache@v4
id: setup-cache
name: Cache setup
with:
path: |
README.md
package.json
.tmplr.yml
packages/*/package.json
packages/*/patternfly-docs/content/**
packages/*/patternfly-docs/generated/**
key: ${{ runner.os }}-setup-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('package.json', 'packages/module/package.json') }}
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
id: yarn-cache
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
key: ${{ runner.os }}-yarn-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- uses: actions/cache@v4
id: lint-cache
name: Load lint cache
with:
path: '.eslintcache'
key: ${{ runner.os }}-lint-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: ESLint
run: yarn lint:js
- name: MDLint
run: yarn lint:md
test_jest:
runs-on: ubuntu-latest
env:
GH_PR_NUM: ${{ github.event.number }}
needs: build
steps:
- uses: actions/checkout@v4
# Yes, we really want to checkout the PR
- run: |
if [[ ! -z "${GH_PR_NUM}" ]]; then
echo "Checking out PR"
git fetch origin pull/$GH_PR_NUM/head:tmp
git checkout tmp
fi
- uses: actions/cache@v4
id: setup-cache
name: Cache setup
with:
path: |
README.md
package.json
.tmplr.yml
packages/*/package.json
packages/*/patternfly-docs/content/**
packages/*/patternfly-docs/generated/**
key: ${{ runner.os }}-setup-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('package.json', 'packages/module/package.json') }}
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
id: yarn-cache
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- uses: actions/cache@v4
id: dist
name: Cache dist
with:
path: |
packages/*/dist
packages/react-styles/css
key: ${{ runner.os }}-dist-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }}
- name: Build dist
run: yarn build
if: steps.dist.outputs.cache-hit != 'true'
- name: PF4 Jest Tests
run: yarn test --maxWorkers=2
test_a11y:
runs-on: ubuntu-latest
env:
GH_PR_NUM: ${{ github.event.number }}
needs: build
steps:
- uses: actions/checkout@v4
# Yes, we really want to checkout the PR
- run: |
if [[ ! -z "${GH_PR_NUM}" ]]; then
echo "Checking out PR"
git fetch origin pull/$GH_PR_NUM/head:tmp
git checkout tmp
fi
- uses: actions/cache@v4
id: setup-cache
name: Cache setup
with:
path: |
README.md
package.json
.tmplr.yml
packages/*/package.json
packages/*/patternfly-docs/content/**
packages/*/patternfly-docs/generated/**
key: ${{ runner.os }}-setup-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('package.json', 'packages/module/package.json') }}
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/cache@v4
id: yarn-cache
name: Cache npm deps
with:
path: |
node_modules
**/node_modules
~/.cache/Cypress
key: ${{ runner.os }}-yarn-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- uses: actions/cache@v4
id: dist
name: Cache dist
with:
path: |
packages/*/dist
packages/react-styles/css
key: ${{ runner.os }}-dist-15-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }}
- name: Build dist
run: yarn build
if: steps.dist.outputs.cache-hit != 'true'
- name: Build docs
run: yarn build:docs
- name: A11y tests
run: yarn serve:docs & yarn test:a11y