Skip to content

Commit b8e2c1b

Browse files
committed
maint: update github action workflow to have two sequential steps: build and test
1 parent 1ba9fca commit b8e2c1b

File tree

2 files changed

+50
-14
lines changed

2 files changed

+50
-14
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,71 @@ name: Node.js CI/CD
33
on:
44
pull_request:
55
branches: [ "*" ]
6+
workflow_dispatch: # Allow manual triggering
67

78
jobs:
8-
build:
9+
setup:
10+
name: Setup and Build
911
runs-on: ubuntu-latest
10-
outputs:
11-
test-result: ${{ steps.test.outcome }}
12-
1312
steps:
14-
- uses: actions/checkout@v3
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
1515

16-
- name: Use Node.js 20.x # Updated for Node 20
16+
- name: Setup Node.js 20.18.0
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 20.x
19+
node-version: 20.18.0
2020
cache: "npm"
21+
22+
- name: Update npm to required version
23+
run: npm install -g npm@10.8.2
2124

25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build project
29+
run: npm run build
30+
31+
- name: Upload build artifacts
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: build-output
35+
path: |
36+
dist/
37+
node_modules/
38+
retention-days: 1
39+
40+
test:
41+
name: Test Project
42+
needs: setup
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v3
47+
48+
- name: Setup Node.js 20.18.0
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: 20.18.0
52+
53+
- name: Update npm to required version
54+
run: npm install -g npm@10.8.2
55+
2256
- name: Setup Deno 2.4.x
2357
uses: denoland/setup-deno@v1
2458
with:
2559
deno-version: 2.4.x
2660

27-
- name: Setup Bun
61+
- name: Setup Bun 1.2.x
2862
uses: oven-sh/setup-bun@v1
2963
with:
30-
bun-version: latest
31-
32-
- name: Run ci
33-
run: npm ci
34-
64+
bun-version: 1.2.x
65+
66+
- name: Download build artifacts
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: build-output
70+
3571
- name: Run tests
3672
id: test
3773
run: npm test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"parse-tc": "./bin/pdf2json.js -f ./test/pdf/misc/i293_pdfpac.pdf -o ./test/target/misc",
5050
"parse-rectFix": "./bin/pdf2json.js -f ./test/pdf/misc/pr298_rect_fix_from_upstream.pdf -o ./test/target/misc",
5151
"parse-e": "./bin/pdf2json.js -f ./test/pdf/misc/i306_err_invalid.pdf -o ./test/target/misc",
52-
"build:rollup": "./node_modules/.bin/rollup -c ./rollup.config.js",
52+
"build:rollup": "npx rollup -c ./rollup.config.js",
5353
"build:bundle-pdfjs-base": "node rollup/bundle-pdfjs-base.js",
5454
"build": "npm run build:bundle-pdfjs-base && npm run build:rollup",
5555
"build:clean": "rm -rf node_modules && rm -f package-lock.json && npm i && npm run build",

0 commit comments

Comments
 (0)