Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

Commit fe45e98

Browse files
committed
Update CI
1 parent c756de5 commit fe45e98

File tree

6 files changed

+126
-62
lines changed

6 files changed

+126
-62
lines changed

.github/workflows/ci.yml

+72-19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: ci
2+
23
on:
3-
- pull_request
4-
- push
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
release:
11+
types:
12+
- released
513

614
jobs:
7-
Test:
8-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
15+
test:
916
runs-on: ${{ matrix.os }}
1017
strategy:
1118
fail-fast: false
@@ -14,27 +21,31 @@ jobs:
1421
- ubuntu-latest
1522
- macos-latest
1623
- windows-latest
17-
node_version:
24+
node:
1825
- 14
1926
- 16
2027
- 18
21-
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
28+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
2229

2330
steps:
24-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
2532
with:
2633
submodules: true
27-
- name: Cache
28-
uses: actions/cache@v2
29-
with:
30-
path: |
31-
'node_modules'
32-
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json') }}
34+
fetch-depth: 0
3335

3436
- name: Setup node
35-
uses: actions/setup-node@v2-beta
37+
uses: actions/setup-node@v3
3638
with:
37-
node-version: ${{ matrix.node_version }}
39+
node-version: ${{ matrix.node }}
40+
41+
- name: Update node-gyp
42+
if: ${{ matrix.os == 'windows-latest' && matrix.node == '14' }}
43+
run: |
44+
$WhereNode = Get-Command node | Select-Object -ExpandProperty Definition
45+
$NodeDirPath = Split-Path $WhereNode -Parent
46+
$NodeModulesPath = $NodeDirPath + "\node_modules\npm\node_modules\npm-lifecycle"
47+
cd $NodeModulesPath
48+
npm install [email protected]
3849
3950
- name: Install dependencies
4051
run: npm install
@@ -47,9 +58,51 @@ jobs:
4758
npm run test:node
4859
npm run test:native
4960
50-
Skip:
51-
if: contains(github.event.head_commit.message, '[skip ci]')
61+
publish:
62+
if: ${{ github.event_name == 'release' }}
63+
name: Publishing to NPM
5264
runs-on: ubuntu-latest
65+
needs: test
66+
steps:
67+
- uses: actions/checkout@v3
68+
with:
69+
submodules: true
70+
fetch-depth: 0
71+
- uses: actions/setup-node@v3
72+
with:
73+
node-version: 18
74+
registry-url: https://registry.npmjs.org
75+
- run: npm publish --access public
76+
env:
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78+
79+
prebuild:
80+
strategy:
81+
matrix:
82+
os:
83+
- ubuntu-latest
84+
- macos-latest
85+
- windows-latest
86+
fail-fast: false
87+
name: Prebuild on ${{ matrix.os }}
88+
runs-on: ${{ matrix.os }}
89+
needs: publish
5390
steps:
54-
- name: Skip CI 🚫
55-
run: echo skip ci
91+
- uses: actions/checkout@v3
92+
with:
93+
submodules: true
94+
fetch-depth: 0
95+
- uses: actions/setup-node@v3
96+
with:
97+
node-version: 18
98+
- run: npm install --ignore-scripts
99+
- run: npx --no-install prebuild -r node -t 10.0.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 -t 18.0.0 -u ${{ secrets.GH_TOKEN }}
100+
# Prebuilding for Electron on Windows fails with
101+
# win_delay_load_hook.cc
102+
# text-buffer-wrapper.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ) referenced in function "public: virtual void __cdecl `private: static void __cdecl TextBufferWrapper::find_words_with_subsequence_in_range(class Nan::FunctionCallbackInfo<class v8::Value> const &)'::`2'::FindWordsWithSubsequenceInRangeWorker::HandleOKCallback(void)" (?HandleOKCallback@FindWordsWithSubsequenceInRangeWorker@?1??find_words_with_subsequence_in_range@TextBufferWrapper@@CAXAEBV?$FunctionCallbackInfo@VValue@v8@@@Nan@@@Z@UEAAXXZ) [D:\a\superstring\superstring\build\superstring.vcxproj]
103+
- if: matrix.os != 'windows-latest'
104+
run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 -u ${{ secrets.GH_TOKEN }}
105+
# - if: matrix.os == 'windows-latest'
106+
# run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 --arch ia32 -u ${{ secrets.GH_TOKEN }}
107+
- if: matrix.os == 'macos-latest'
108+
run: npx --no-install prebuild -r electron -t 21.0.0 -t 22.0.0 -t 23.0.0 --arch arm64 -u ${{ secrets.GH_TOKEN }}

.github/workflows/codeql.yml

-34
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
build
3+
prebuilds
34
.DS_Store
45
.clang_complete
56

binding.gyp

+37-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@
2121
"src/core",
2222
"<!(node -e \"require('nan')\")"
2323
],
24+
"cflags_cc": ["-std=c++17"],
25+
"xcode_settings": {
26+
"MACOSX_DEPLOYMENT_TARGET": "10.7",
27+
"OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"],
28+
},
29+
"msvs_settings": {
30+
"VCCLCompilerTool": {
31+
"AdditionalOptions": [
32+
"/std:c++17",
33+
],
34+
},
35+
},
2436
},
2537
{
2638
"target_name": "superstring_core",
@@ -44,6 +56,18 @@
4456
"include_dirs": [
4557
"vendor/libcxx"
4658
],
59+
"cflags_cc": ["-std=c++17"],
60+
"xcode_settings": {
61+
"MACOSX_DEPLOYMENT_TARGET": "10.7",
62+
"OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"],
63+
},
64+
"msvs_settings": {
65+
"VCCLCompilerTool": {
66+
"AdditionalOptions": [
67+
"/std:c++17",
68+
],
69+
},
70+
},
4771
"conditions": [
4872
['OS=="mac"', {
4973
'link_settings': {
@@ -67,7 +91,8 @@
6791
],
6892

6993
"variables": {
70-
"tests": 0
94+
"tests": 0,
95+
"openssl_fips": ""
7196
},
7297

7398
"conditions": [
@@ -105,6 +130,8 @@
105130
"xcode_settings": {
106131
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
107132
'MACOSX_DEPLOYMENT_TARGET': '10.8',
133+
'CLANG_CXX_LIBRARY': 'libc++',
134+
'CLANG_CXX_LANGUAGE_STANDARD':'c++17',
108135
}
109136
}]
110137
]
@@ -113,12 +140,12 @@
113140
],
114141

115142
"target_defaults": {
116-
"cflags_cc": ["-std=c++11"],
143+
"cflags_cc": ["-std=c++17"],
117144
"conditions": [
118145
['OS=="mac"', {
119146
"xcode_settings": {
120147
'CLANG_CXX_LIBRARY': 'libc++',
121-
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
148+
'CLANG_CXX_LANGUAGE_STANDARD':'c++17',
122149
}
123150
}],
124151
['OS=="win"', {
@@ -128,6 +155,13 @@
128155
"defines": [
129156
"NOMINMAX"
130157
],
158+
"msvs_settings": {
159+
"VCCLCompilerTool": {
160+
"AdditionalOptions": [
161+
"/std:c++17",
162+
],
163+
},
164+
},
131165
}]
132166
]
133167
}

package.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"main": "./index",
66
"browser": "./browser",
77
"scripts": {
8-
"build:node": "node-gyp rebuild",
9-
"build": "npm run build:node",
8+
"install": "prebuild-install || node-gyp rebuild",
9+
"build": "node-gyp build",
1010
"test:native": "node ./script/test-native.js",
1111
"test:node": "mocha test/js/*.js",
1212
"test": "npm run test:node",
@@ -31,11 +31,18 @@
3131
"devDependencies": {
3232
"chai": "^2.0.0",
3333
"mocha": "^2.3.4",
34-
"random-seed": "^0.2.0",
34+
"node-gyp": "^9.3.1",
35+
"prebuild": "^11.0.4",
36+
"random-seed": "^0.3.0",
3537
"standard": "^4.5.4",
36-
"temp": "^0.8.3",
38+
"temp": "^0.9.4",
3739
"unzip": "^0.1.11"
3840
},
41+
"overrides": {
42+
"prebuild": {
43+
"node-gyp": "$node-gyp"
44+
}
45+
},
3946
"standard": {
4047
"global": [
4148
"describe",

vendor/pcre/pcre.gyp

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,8 @@
5555
]
5656
}
5757
}
58-
]
59-
}
58+
],
59+
"variables": {
60+
"openssl_fips": ""
61+
},
62+
}

0 commit comments

Comments
 (0)