-
Notifications
You must be signed in to change notification settings - Fork 13
72 lines (60 loc) · 1.57 KB
/
build.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
name: Build and Test
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
on:
push:
branches-ignore:
- main
- alpha
workflow_dispatch:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [18.x, 20.x]
command: ['lint', 'format', 'build']
steps:
- uses: actions/checkout@v4
- name: Set Up node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable --immutable-cache
- run: yarn ${{ matrix.command }}
test:
strategy:
matrix:
suite: [unit, web, esm, cjs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
- name: Install dependencies
run: yarn --immutable --immutable-cache
- name: Run tests
run: yarn test:${{ matrix.suite }}
- name: Upload coverage
if: matrix.suite == 'unit'
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
notify:
needs: [build, test]
if: success()
runs-on: ubuntu-latest
steps:
- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: 'Build / E2E tests succeeded!'
SLACK_COLOR: 'good'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}