6
6
pull_request :
7
7
8
8
jobs :
9
- build-lint-test :
10
- name : Build, Lint, and Test
11
- runs-on : ubuntu-20.04
9
+ prepare :
10
+ name : Prepare
11
+ runs-on : ubuntu-latest
12
+ outputs :
13
+ YARN_CACHE_DIR : ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
14
+ YARN_VERSION : ${{ steps.yarn-version.outputs.YARN_VERSION }}
12
15
strategy :
13
16
matrix :
14
- node-version : [14.x, 16.x]
17
+ node-version : [14.x, 16.x, 18.x, 19.x ]
15
18
steps :
16
- - uses : actions/checkout@v2
19
+ - uses : actions/checkout@v3
17
20
- name : Use Node.js ${{ matrix.node-version }}
18
- uses : actions/setup-node@v2
21
+ uses : actions/setup-node@v3
19
22
with :
20
23
node-version : ${{ matrix.node-version }}
21
24
- name : Get Yarn cache directory
22
- run : echo "::set-output name= YARN_CACHE_DIR:: $(yarn config get cacheFolder)"
25
+ run : echo "YARN_CACHE_DIR= $(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT "
23
26
id : yarn-cache-dir
24
27
- name : Get Yarn version
25
- run : echo "::set-output name= YARN_VERSION:: $(yarn --version)"
28
+ run : echo "YARN_VERSION= $(yarn --version)" >> "$GITHUB_OUTPUT "
26
29
id : yarn-version
27
- - name : Cache yarn dependencies
28
- uses : actions/cache@v2
30
+ - name : Cache Yarn dependencies
31
+ uses : actions/cache@v3
29
32
with :
30
33
path : ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
31
- key : yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
34
+ key : yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }}
35
+ - name : Install Yarn dependencies
36
+ run : yarn --immutable
37
+ build :
38
+ name : Build
39
+ runs-on : ubuntu-latest
40
+ needs :
41
+ - prepare
42
+ strategy :
43
+ matrix :
44
+ node-version : [14.x, 16.x, 18.x, 19.x]
45
+ steps :
46
+ - uses : actions/checkout@v3
47
+ - name : Use Node.js ${{ matrix.node-version }}
48
+ uses : actions/setup-node@v3
49
+ with :
50
+ node-version : ${{ matrix.node-version }}
51
+ - name : Restore Yarn dependencies
52
+ uses : actions/cache@v3
53
+ with :
54
+ path : ${{ needs.prepare.outputs.YARN_CACHE_DIR }}
55
+ key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }}
32
56
- run : yarn --immutable
33
57
- run : yarn build
58
+ - name : Require clean working directory
59
+ shell : bash
60
+ run : |
61
+ if ! git diff --exit-code; then
62
+ echo "Working tree dirty at end of job"
63
+ exit 1
64
+ fi
65
+ lint :
66
+ name : Lint
67
+ runs-on : ubuntu-latest
68
+ needs :
69
+ - prepare
70
+ strategy :
71
+ matrix :
72
+ node-version : [14.x, 16.x, 18.x, 19.x]
73
+ steps :
74
+ - uses : actions/checkout@v3
75
+ - name : Use Node.js ${{ matrix.node-version }}
76
+ uses : actions/setup-node@v3
77
+ with :
78
+ node-version : ${{ matrix.node-version }}
79
+ - name : Restore Yarn dependencies
80
+ uses : actions/cache@v3
81
+ with :
82
+ path : ${{ needs.prepare.outputs.YARN_CACHE_DIR }}
83
+ key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }}
84
+ - run : yarn --immutable
34
85
- run : yarn lint
35
- - run : yarn test
36
86
- name : Validate RC changelog
37
87
if : ${{ startsWith(github.head_ref, 'release/') }}
38
88
run : yarn auto-changelog validate --rc
@@ -46,10 +96,53 @@ jobs:
46
96
echo "Working tree dirty at end of job"
47
97
exit 1
48
98
fi
99
+ test :
100
+ name : Test
101
+ runs-on : ubuntu-latest
102
+ needs :
103
+ - prepare
104
+ strategy :
105
+ matrix :
106
+ node-version : [14.x, 16.x, 18.x, 19.x]
107
+ steps :
108
+ - uses : actions/checkout@v3
109
+ - name : Use Node.js ${{ matrix.node-version }}
110
+ uses : actions/setup-node@v3
111
+ with :
112
+ node-version : ${{ matrix.node-version }}
113
+ - name : Restore Yarn dependencies
114
+ uses : actions/cache@v3
115
+ with :
116
+ path : ${{ needs.prepare.outputs.YARN_CACHE_DIR }}
117
+ key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }}
118
+ - run : yarn --immutable
119
+ - run : yarn test
120
+ - name : Require clean working directory
121
+ shell : bash
122
+ run : |
123
+ if ! git diff --exit-code; then
124
+ echo "Working tree dirty at end of job"
125
+ exit 1
126
+ fi
127
+ check-workflows :
128
+ name : Check workflows
129
+ runs-on : ubuntu-latest
130
+ steps :
131
+ - uses : actions/checkout@v3
132
+ - name : Download actionlint
133
+ id : download-actionlint
134
+ run : bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/d5f726fb9c9aaff30c8c3787a9b9640f7612838a/scripts/download-actionlint.bash) 1.6.21
135
+ shell : bash
136
+ - name : Check workflow files
137
+ run : ${{ steps.download-actionlint.outputs.executable }} -color
138
+ shell : bash
49
139
all-jobs-pass :
50
140
name : All jobs pass
51
- runs-on : ubuntu-20.04
141
+ runs-on : ubuntu-latest
52
142
needs :
53
- - build-lint-test
143
+ - build
144
+ - lint
145
+ - test
146
+ - check-workflows
54
147
steps :
55
148
- run : echo "Great success!"
0 commit comments