Skip to content

Commit

Permalink
Fix CI for earlier node versions
Browse files Browse the repository at this point in the history
Node hardcodes its default TLS certificates, meaning older versions do
not support the root certificate currently used by LetsEncrypt.

Use --use-openssl-ca to enable the use of the system's OpenSSL
certificates.

Since node v7 doesn't support NODE_OPTIONS, conditionally modify the
test script with sed.
  • Loading branch information
Freaky authored and zyc9012 committed Mar 12, 2024
1 parent 7610f9f commit d9385fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push, pull_request]
on: [push]

jobs:
build:
Expand Down Expand Up @@ -52,6 +52,15 @@ jobs:
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@v3
Expand All @@ -76,7 +85,7 @@ jobs:
run: |
cd smoke_tests/commonjs
npm i
npm test
npm run ${{ matrix.command }}
smoke-tests-esm:
name: "Smoke tests (ESM)"
Expand Down
3 changes: 2 additions & 1 deletion smoke_tests/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"serpapi": "../../npm"
},
"scripts": {
"test": "node commonjs.js"
"test": "node commonjs.js",
"test:use-openssl-ca": "node --use-openssl-ca commonjs.js"
}
}

0 comments on commit d9385fc

Please sign in to comment.