Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 69f5f66

Browse files
committed
Setup prebuildify and Electron tests
1 parent 334af2c commit 69f5f66

File tree

4 files changed

+109
-30
lines changed

4 files changed

+109
-30
lines changed

.travis.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,56 @@
1-
sudo: false
2-
31
language: node_js
42

3+
jobs:
4+
include:
5+
- os: linux
6+
node_js: 8
7+
env: [TEST=1]
8+
- os: linux
9+
node_js: 10
10+
env: [TEST=1]
11+
- os: linux
12+
node_js: node
13+
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=linux-x64]
14+
addons:
15+
apt:
16+
packages:
17+
- xvfb
18+
before_script:
19+
- export DISPLAY=':99.0'
20+
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
21+
- os: osx
22+
node_js: 8
23+
env: [TEST=1]
24+
- os: osx
25+
node_js: 10
26+
env: [TEST=1]
27+
- os: osx
28+
node_js: node
29+
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=darwin-x64]
30+
531
before_install:
632
- export JOBS=max
733
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export JOBS=4; fi
834

9-
os:
10-
- osx
11-
- linux
35+
script:
36+
- if [[ ! -z "$TEST" ]]; then npm run test; fi
37+
- if [[ ! -z "$TEST_ELECTRON" ]]; then npm run test-electron; fi
38+
39+
after_success:
40+
- if [[ ! -z "$TEST" ]]; then npm run coverage; fi
1241

13-
node_js:
14-
- 6
15-
- 8
16-
- 10
42+
before_deploy:
43+
- export ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$BUILD_GROUP.tar.gz"
44+
- npm run $BUILD_CMD
45+
- file prebuilds/*/*
46+
- tar -zcvf "$ARCHIVE_NAME" -C prebuilds .
1747

18-
after_success: npm run coverage
48+
deploy:
49+
provider: releases
50+
draft: false
51+
api_key: "$PREBUILD_TOKEN"
52+
file: "$ARCHIVE_NAME"
53+
skip_cleanup: true
54+
on:
55+
tags: true
56+
condition: "! -z $BUILD_CMD"

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,19 @@ It is **strongly recommended** that you use LevelUP in preference to `rocksdb` u
2222
<a name="platforms"></a>
2323
## Supported Platforms
2424

25-
* **Linux** (including ARM platforms such as Raspberry Pi *and Kindle!*)
26-
* **Mac OS**
27-
* **Solaris** (SmartOS & Nodejitsu)
28-
* **FreeBSD**
29-
* **Windows**
30-
* See installation instructions for *node-gyp* dependencies [here](https://github.com/TooTallNate/node-gyp#installation), you'll need these (free) components from Microsoft to compile and run any native Node add-on in Windows.
25+
We aim to support _at least_ Active LTS and Current Node.js releases, Electron 4.0.0, as well as any future Node.js and Electron releases thanks to [N-API](https://nodejs.org/api/n-api.html). Because N-API has an experimental status in node 6 and early 8.x releases, the minimum node version for `rocksdb` is `8.6.0`.
26+
27+
The `rocksdb` npm package ships with prebuilt binaries for popular 64-bit platforms ~~as well as ARM, Android and Alpine (musl)~~ and is known to work on:
28+
29+
- **Linux** (including ARM platforms such as Raspberry Pi and Kindle)
30+
- **Mac OS**
31+
- **Solaris** (SmartOS & Nodejitsu)
32+
- **FreeBSD**
33+
- **Windows**
34+
35+
When installing `rocksdb`, [`node-gyp-build`](https://github.com/prebuild/node-gyp-build) will check if a compatible binary exists and fallback to a compile step if it doesn't. In that case you'll need a [valid `node-gyp` installation](https://github.com/nodejs/node-gyp#installation).
36+
37+
If you don't want to use the prebuilt binary for the platform you are installing on, specify the `--build-from-source` flag when you install. If you are working on `rocksdb` itself and want to re-compile the C++ code it's enough to do `npm install`.
3138

3239
<a name="api"></a>
3340
## API
@@ -51,13 +58,16 @@ There are multiple ways you can find help in using LevelDB in Node.js:
5158
5259
See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.
5360

54-
## Prebuilt Binaries
55-
56-
`rocksdb` uses `prebuild` and `prebuild-install` for handling prebuilt binaries. See [this list](https://github.com/Level/rocksdb/releases) of supported prebuilt platform binaries. When installing rocksdb `prebuild-install` will install prebuilt binaries from GitHub if they exist and fallback to a compile step if they don't.
57-
58-
If you are working on `rocksdb` and want to re-compile the C++ code it's enough to do `npm install`.
61+
### Publishing
5962

60-
If you don't want to use the `prebuild` for the platform you are installing on, specify the `--build-from-source` flag when you install.
63+
1. Increment the version: `npm version ..`
64+
2. Push to GitHub: `git push --follow-tags`
65+
3. Wait for Travis and AppVeyor builds to complete
66+
4. Download prebuilds into `./prebuilds`: `npm run download-prebuilds`
67+
5. Optionally verify loading a prebuild: `npm run test-prebuild`
68+
6. Optionally verify which files npm will include: `canadian-pub`
69+
7. Add changelog to the GitHub release
70+
8. Finally: `npm publish`
6171

6272
## Donate
6373

appveyor.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
1-
version: "{build}"
2-
build: off
3-
skip_tags: true
1+
build: false
2+
skip_branch_with_pr: true
43

54
environment:
65
matrix:
7-
- nodejs_version: "6"
86
- nodejs_version: "8"
97
- nodejs_version: "10"
8+
- nodejs_version: "Current"
109

10+
configuration: Release
1111
platform:
1212
- x64
1313

1414
install:
15+
- SET PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;%PATH%
1516
- ps: Install-Product node $env:nodejs_version $env:platform
16-
- set PATH=%APPDATA%\npm;%APPVEYOR_BUILD_FOLDER%\node_modules\.bin;%PATH%
17+
- SET PATH=%APPDATA%\npm;%APPVEYOR_BUILD_FOLDER%\node_modules\.bin;%PATH%
1718
- npm i
1819

1920
test_script:
21+
- node --version
22+
- npm --version
2023
- npm test
24+
- ps: if ($env:nodejs_version -eq "Current") { npm run test-electron }
25+
26+
before_deploy:
27+
- SET ARCHIVE_NAME=%APPVEYOR_REPO_TAG_NAME%-win32-%PLATFORM%.tar.gz
28+
- npm run prebuild
29+
- tar -zcvf "%ARCHIVE_NAME%" -C prebuilds .
30+
- appveyor PushArtifact %ARCHIVE_NAME%
31+
32+
deploy:
33+
- provider: GitHub
34+
artifact: $(ARCHIVE_NAME)
35+
auth_token:
36+
secure: AjmYV2zeogfen7F6tXvR9PO1zynJVF/jhMCExQ9RMtqEHDMH8Frclym3GniZkEB0
37+
draft: false
38+
on:
39+
appveyor_repo_tag: true
40+
nodejs_version: "Current"

package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
"main": "leveldown.js",
77
"scripts": {
88
"install": "node-gyp-build",
9-
"test": "standard && hallmark && verify-travis-appveyor && nyc tape test/*-test.js",
9+
"test": "standard && hallmark && nyc tape test/*-test.js",
10+
"test-gc": "npx -n=--expose-gc tape test/{cleanup,iterator-gc,chained-batch-gc}*-test.js",
11+
"test-electron": "electron test/electron.js",
12+
"test-prebuild": "cross-env PREBUILDS_ONLY=1 npm t",
1013
"coverage": "nyc report --reporter=text-lcov | coveralls",
14+
"rebuild": "node-gyp rebuild",
15+
"prebuild": "prebuildify -t 8.14.0 --napi --strip",
16+
"download-prebuilds": "prebuildify-ci download",
1117
"hallmark": "hallmark --fix",
1218
"dependency-check": "dependency-check . test/*.js",
1319
"prepublishOnly": "npm run dependency-check"
@@ -21,20 +27,25 @@
2127
"devDependencies": {
2228
"async": "^2.0.1",
2329
"coveralls": "^3.0.2",
30+
"cross-env": "^5.2.0",
2431
"delayed": "^1.0.1",
2532
"dependency-check": "^3.3.0",
2633
"du": "~0.1.0",
34+
"electron": "^5.0.1",
35+
"glob": "^7.1.4",
2736
"hallmark": "^0.1.0",
2837
"level-community": "^3.0.0",
2938
"level-concat-iterator": "^2.0.0",
3039
"mkfiletree": "^1.0.1",
40+
"node-gyp": "^4.0.0",
3141
"nyc": "^14.0.0",
42+
"prebuildify": "^3.0.0",
43+
"prebuildify-ci": "^1.0.4",
3244
"readfiletree": "~0.0.1",
3345
"rimraf": "^2.6.1",
3446
"standard": "^12.0.0",
3547
"tape": "^4.10.0",
36-
"tempy": "^0.2.1",
37-
"verify-travis-appveyor": "^3.0.0"
48+
"tempy": "^0.2.1"
3849
},
3950
"standard": {
4051
"ignore": [

0 commit comments

Comments
 (0)