-
Notifications
You must be signed in to change notification settings - Fork 542
103 lines (99 loc) · 3.11 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
name: Build, Lint, and Test
on:
push:
branches: [main]
pull_request:
jobs:
build-lint-test:
name: Build, Lint, and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [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 version
run: echo "YARN_VERSION=$(yarn --version)" >> $GITHUB_OUTPUT
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: .yarn/cache
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn install --immutable
- run: yarn build
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty after building"
exit 1
fi
- run: yarn lint
- run: yarn test:ci
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty after tests"
exit 1
fi
- name: CodeCov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
- name: Validate RC changelog
if: ${{ startsWith(github.head_ref, 'release/') }}
run: yarn lint:changelogs --rc
- name: Validate changelog
if: ${{ !startsWith(github.head_ref, 'release/') }}
run: yarn lint:changelogs
platform-compatibility:
name: Platform Compatibility Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Get Yarn version
run: echo "YARN_VERSION=$(yarn --version)" >> $GITHUB_OUTPUT
shell: bash
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: .yarn/cache
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
# To use the --immutable flag, we have to install all dependencies, not
# just the ones we need.
- run: yarn install --immutable
- name: Build @metamask/snaps-cli and its dependents only
shell: bash
run: |
yarn workspaces foreach \
--recursive \
--from @metamask/snaps-cli \
--topological-dev \
run build
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty after building"
exit 1
fi
- run: yarn workspace @metamask/snaps-cli run test
all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-latest
needs:
- build-lint-test
- platform-compatibility
steps:
- run: echo "Great success!"