-
Notifications
You must be signed in to change notification settings - Fork 8
65 lines (53 loc) · 1.78 KB
/
ci-test.yml
File metadata and controls
65 lines (53 loc) · 1.78 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: "CI: test & build"
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
- dev
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
# "node_js: - stable" logic (Node 24 is current LTS/stable)
node-version: [24.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn" # Automatic caching for Yarn
- name: Install dependencies
# --frozen-lockfile ensures yarn.lock is respected exactly
run: yarn install --frozen-lockfile
- name: Derive Nx SHAs
uses: nrwl/nx-set-shas@v4
- name: Detect if library is affected
id: affected
run: |
AFFECTED=$(npx nx print-affected --select=projects)
if echo "$AFFECTED" | tr ',' ' ' | tr ' ' '\n' | grep -xq "sequelize-guard"; then
echo "library=true" >> $GITHUB_OUTPUT
else
echo "library=false" >> $GITHUB_OUTPUT
fi
- name: Run lint
# This runs lint with eslint
run: npx nx affected -t lint --parallel=3
- name: Run tests and generate coverage
if: steps.affected.outputs.library == 'true'
# This runs vitest with coverage enabled
run: npx nx affected -t test:coverage --parallel=3
- name: Upload coverage to Coveralls
if: steps.affected.outputs.library == 'true'
uses: coverallsapp/github-action@v2
with:
base-path: packages/sequelize-guard
- name: Build the library
run: npx nx affected -t build --parallel=3