-
Notifications
You must be signed in to change notification settings - Fork 6
135 lines (114 loc) · 3.01 KB
/
build.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
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
130
131
132
133
134
135
name: Build
on: [push]
jobs:
build:
name: "Deno tests and build npm files"
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Check formatting
run: deno fmt --check
- name: Run linter
run: deno lint
- name: Run tests
env:
SERPAPI_TEST_KEY: ${{ secrets.SERPAPI_TEST_KEY }}
run: deno task test:ci
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22.x" # Build files using a fixed node version
registry-url: "https://registry.npmjs.org"
- name: Build npm files
run: deno task npm
- name: Zip build files
run: zip npm.zip ./npm -r
- name: Upload build files for smoke tests
uses: actions/upload-artifact@v4
with:
name: npm
path: npm.zip
retention-days: 1
smoke-tests-commonjs:
name: "Smoke tests (CommonJS)"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [
7.x,
8.x,
9.x,
10.x,
11.x,
12.x,
13.x,
14.x,
15.x,
16.x,
17.x,
18.x,
19.x,
]
include:
- command: test
- command: test:use-openssl-ca
node-version: 7.x
- command: test:use-openssl-ca
node-version: 8.x
- command: test:use-openssl-ca
node-version: 9.x
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- name: Download build files
uses: actions/download-artifact@v4
with:
name: npm
- name: Unzip build files
run: unzip npm.zip
- name: Run smoke tests
env:
SERPAPI_TEST_KEY: ${{ secrets.SERPAPI_TEST_KEY }}
run: |
cd smoke_tests/commonjs
npm i
npm run ${{ matrix.command }}
smoke-tests-esm:
name: "Smoke tests (ESM)"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 15.x, 16.x, 17.x, 18.x, 19.x]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- name: Download build files
uses: actions/download-artifact@v4
with:
name: npm
- name: Unzip build files
run: unzip npm.zip
- name: Run smoke tests
env:
SERPAPI_TEST_KEY: ${{ secrets.SERPAPI_TEST_KEY }}
run: |
cd smoke_tests/esm
npm i
npm test