generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 10
62 lines (60 loc) · 1.88 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
name: Build, Lint, and Test
on:
push:
branches: [main]
pull_request:
jobs:
build-lint-test:
name: Build, Lint, and Test
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
run: echo "YARN_CACHE_DIR=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
id: yarn-cache-dir
- name: Get Yarn version
run: echo "YARN_VERSION=$(yarn --version)" >> "$GITHUB_OUTPUT"
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --immutable
- run: yarn build
- run: yarn lint
- run: yarn test
validate-changelog:
name: Validate changelog
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Get Node.js version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- run: yarn --immutable
- run: yarn build
- name: Validate RC changelog
if: ${{ startsWith(github.head_ref, 'release/') }}
run: yarn changelog validate --rc
- name: Validate changelog
if: ${{ !startsWith(github.head_ref, 'release/') }}
run: yarn changelog validate
all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-20.04
needs:
- build-lint-test
- validate-changelog
steps:
- run: echo "Great success!"