-
Notifications
You must be signed in to change notification settings - Fork 6
129 lines (109 loc) · 3.23 KB
/
Copy pathnodejs.yml
File metadata and controls
129 lines (109 loc) · 3.23 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Node CI
on:
pull_request:
push:
branches:
- master
jobs:
# This job prevents duplicate jobs and doc-only changes
verify:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
# https://github.com/marketplace/actions/skip-duplicate-actions#skip-concurrent-workflow-runs
concurrent_skipping: same_content_newer
paths_ignore: '["**/*.md"]'
lint:
needs: [verify]
if: ${{ needs.verify.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
env:
BASE_REF: ${{ github.base_ref }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: false
# Make git diff HEAD^ work
fetch-depth: 2
# For diffing
- run: git fetch --depth=1 origin ${{ github.base_ref }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.2.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install
- name: eslint
run: npx nps lint.ci
shell: bash
env:
GH_EVENT: ${{ github.event_name }}
test:
needs: [verify]
if: ${{ needs.verify.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
env:
BASE_REF: ${{ github.base_ref }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: false
# Make git diff HEAD^ work
fetch-depth: 2
# For diffing
- run: git fetch --depth=1 origin ${{ github.base_ref }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.2.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
# Configure PNPM to allow build scripts
- name: Configure PNPM
run: |
echo "enable-pre-post-scripts=true" >> .npmrc
# Install build tools needed for native modules
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3
- run: pnpm install
# Manually rebuild SQLite3 if needed
- name: Rebuild SQLite3
run: |
# Check if SQLite3 works, if not rebuild it
node -e "require('sqlite3')" 2>/dev/null || {
echo "SQLite3 failed to load, rebuilding..."
cd node_modules/.pnpm/sqlite3@*/node_modules/sqlite3
npm run install --unsafe-perm
}
# Verify it works
node -e "console.log('SQLite3 version:', require('sqlite3').VERSION)"
# Note, these only check changed files
- name: tests
run: npx nps test.ci
# For pipefail
shell: bash
env:
GH_EVENT: ${{ github.event_name }}