Skip to content

Commit 5f85b79

Browse files
committed
WIP
1 parent b446e46 commit 5f85b79

13 files changed

+1947
-111
lines changed

.gitlab-ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,51 @@ build:macos:
199199
# Runs on tag pipeline where the tag is a prerelease or release version
200200
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
201201

202+
build:prerelease:
203+
stage: build
204+
needs:
205+
- build:linux
206+
- build:windows
207+
- build:macos
208+
# Don't interrupt publishing job
209+
interruptible: false
210+
before_script:
211+
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
212+
script:
213+
- echo 'Publishing library prerelease'
214+
- >
215+
nix-shell --run '
216+
npm publish --tag prerelease --access public;
217+
'
218+
- >
219+
for d in prebuilds/*; do
220+
tar \
221+
--create \
222+
--verbose \
223+
--file="prebuilds/$(basename $d).tar" \
224+
--directory=prebuilds \
225+
"$(basename $d)";
226+
done
227+
- >
228+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
229+
gh release \
230+
create "$CI_COMMIT_TAG" \
231+
prebuilds/*.tar \
232+
--title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
233+
--notes "" \
234+
--prerelease \
235+
--target staging \
236+
--repo "$GH_PROJECT_PATH";
237+
'
238+
after_script:
239+
- rm -f ./.npmrc
240+
rules:
241+
# Only runs on tag pipeline where the tag is a prerelease version
242+
# This requires dependencies to also run on tag pipeline
243+
# However version tag comes with a version commit
244+
# Dependencies must not run on the version commit
245+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
246+
202247
integration:merge:
203248
stage: integration
204249
needs:
@@ -229,3 +274,48 @@ integration:merge:
229274
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
230275
# Runs on tag pipeline where the tag is a prerelease or release version
231276
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
277+
278+
release:distribution:
279+
stage: release
280+
needs:
281+
- build:linux
282+
- build:windows
283+
- build:macos
284+
- integration:merge
285+
# Don't interrupt publishing job
286+
interruptible: false
287+
before_script:
288+
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
289+
script:
290+
- echo 'Publishing library'
291+
- >
292+
nix-shell --run '
293+
npm publish --access public;
294+
'
295+
- >
296+
for d in prebuilds/*; do
297+
tar \
298+
--create \
299+
--verbose \
300+
--file="prebuilds/$(basename $d).tar" \
301+
--directory=prebuilds \
302+
"$(basename $d)";
303+
done
304+
- >
305+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
306+
gh release \
307+
create "$CI_COMMIT_TAG" \
308+
prebuilds/*.tar \
309+
--title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
310+
--notes "" \
311+
--target master \
312+
--repo "$GH_PROJECT_PATH";
313+
'
314+
after_script:
315+
- rm -f ./.npmrc
316+
rules:
317+
# Only runs on tag pipeline where the tag is a release version
318+
# This requires dependencies to also run on tag pipeline
319+
# However version tag comes with a version commit
320+
# Dependencies must not run on the version commit
321+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/

binding.gyp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
'targets': [{
3+
'target_name': 'native',
4+
'include_dirs': [
5+
"<!(node -e \"require('napi-macros')\")"
6+
],
7+
'sources': ['./src/native/index.c'],
8+
'conditions': [
9+
['OS=="linux"', {
10+
'cflags': [ '-std=c99', '-Wpedantic' ],
11+
'cflags_cc': [ '-std=c++17', '-Wpedantic' ],
12+
}],
13+
['OS=="win"', {
14+
'msvs_settings': {
15+
'VCCLCompilerTool': {
16+
'AdditionalOptions': [ '/std:c++17' ]
17+
}
18+
},
19+
}],
20+
['OS=="mac"', {
21+
'xcode_settings': {
22+
# Minimum mac osx target version (matches node v16.14.2)
23+
'MACOSX_DEPLOYMENT_TARGET': '10.13',
24+
'OTHER_CFLAGS': [
25+
'-std=c99',
26+
'-arch x86_64',
27+
'-arch arm64'
28+
],
29+
'OTHER_CPLUSPLUSFLAGS': [
30+
'-std=c++17'
31+
'-arch x86_64',
32+
'-arch arm64'
33+
],
34+
'OTHER_LDFLAGS': [
35+
'-arch x86_64',
36+
'-arch arm64'
37+
]
38+
}
39+
}]
40+
]
41+
}]
42+
}

0 commit comments

Comments
 (0)