-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (53 loc) · 1.51 KB
/
run-tests.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: Run Tests and Snapshots
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_run:
workflows: ["Accept Baselines Workflow"]
types:
- completed
jobs:
setup-nodejs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.4'
- run: npm install
lint:
needs: setup-nodejs
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run lint
unit-tests:
needs: setup-nodejs
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run test:unit
snapshots-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- name: Get Branch Name
id: extract_branch_name
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Run Snapshot Tests
run: npm run test:snapshots
env:
GI_KEY: ${{ secrets.GI_KEY }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
- name: Inform Developer About Snapshot Failures
if: failure()
run: echo "Snapshots failed. Add the 'accept-baselines' label to update the baselines or fix your code."
- name: Set PR Ready for Merge
if: success()
run: echo "PR is ready for merge."