-
Notifications
You must be signed in to change notification settings - Fork 126
75 lines (62 loc) · 2.01 KB
/
actions.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
name: CI Tests
# Pull request will trigger when PR is opened or updated, and more (https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request)
# Thus limit push checks to master branch so things run after the PR is merged. Without the limit multiple actions run on each PR
on:
pull_request:
push:
branches:
- 'master'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
- ~/.npm
- node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Enable Corepack
run: corepack enable
- name: Setup
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Run eslint on changed files
# Always run both eslint and prettier
if: always()
uses: tj-actions/eslint-changed-files@v25
with:
config_path: 'eslint.config.mjs'
extra_args: '--max-warnings=0'
reporter: github-pr-review
- name: Run Prettier on changed files
# Always run both eslint and prettier
if: always()
uses: ./.github/actions/prettier
with:
fail_on_error: true
filter_mode: file
level: warning
prettier_flags: '**/*.{js,jsx,ts,tsx}'
reporter: github-pr-review
- name: Run tests
if: success()
run: npm run test:ci
- name: Upload Jest Coverage Report
if: success()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: jest-coverage
path: coverage
- name: Build
run: npm run ci-build