-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (32 loc) · 1.03 KB
/
node.js.yml
File metadata and controls
42 lines (32 loc) · 1.03 KB
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
# Timesheets CI — runs affected tests on PRs, full suite on merge to main/develop
name: Timesheets CI
on:
push:
branches: ["main", "develop"]
pull_request:
branches: ["main", "develop"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for --changedSince to compare branches
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build --if-present
# PRs: only run tests affected by changed files
- name: Run affected tests (PR)
if: github.event_name == 'pull_request'
run: npx jest --runInBand --changedSince=origin/${{ github.base_ref }}
# Pushes to main/develop: run the full test suite
- name: Run all tests (push)
if: github.event_name == 'push'
run: npm test