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

Commit

Permalink
Setup prebuildify and Electron tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed May 22, 2019
1 parent 334af2c commit 69f5f66
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 30 deletions.
58 changes: 48 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
sudo: false

language: node_js

jobs:
include:
- os: linux
node_js: 8
env: [TEST=1]
- os: linux
node_js: 10
env: [TEST=1]
- os: linux
node_js: node
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=linux-x64]
addons:
apt:
packages:
- xvfb
before_script:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- os: osx
node_js: 8
env: [TEST=1]
- os: osx
node_js: 10
env: [TEST=1]
- os: osx
node_js: node
env: [TEST=1, TEST_ELECTRON=1, BUILD_CMD=prebuild, BUILD_GROUP=darwin-x64]

before_install:
- export JOBS=max
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export JOBS=4; fi

os:
- osx
- linux
script:
- if [[ ! -z "$TEST" ]]; then npm run test; fi
- if [[ ! -z "$TEST_ELECTRON" ]]; then npm run test-electron; fi

after_success:
- if [[ ! -z "$TEST" ]]; then npm run coverage; fi

node_js:
- 6
- 8
- 10
before_deploy:
- export ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$BUILD_GROUP.tar.gz"
- npm run $BUILD_CMD
- file prebuilds/*/*
- tar -zcvf "$ARCHIVE_NAME" -C prebuilds .

after_success: npm run coverage
deploy:
provider: releases
draft: false
api_key: "$PREBUILD_TOKEN"
file: "$ARCHIVE_NAME"
skip_cleanup: true
on:
tags: true
condition: "! -z $BUILD_CMD"
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ It is **strongly recommended** that you use LevelUP in preference to `rocksdb` u
<a name="platforms"></a>
## Supported Platforms

* **Linux** (including ARM platforms such as Raspberry Pi *and Kindle!*)
* **Mac OS**
* **Solaris** (SmartOS & Nodejitsu)
* **FreeBSD**
* **Windows**
* 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.
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`.

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:

- **Linux** (including ARM platforms such as Raspberry Pi and Kindle)
- **Mac OS**
- **Solaris** (SmartOS & Nodejitsu)
- **FreeBSD**
- **Windows**

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).

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`.

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

## Prebuilt Binaries

`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.

If you are working on `rocksdb` and want to re-compile the C++ code it's enough to do `npm install`.
### Publishing

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.
1. Increment the version: `npm version ..`
2. Push to GitHub: `git push --follow-tags`
3. Wait for Travis and AppVeyor builds to complete
4. Download prebuilds into `./prebuilds`: `npm run download-prebuilds`
5. Optionally verify loading a prebuild: `npm run test-prebuild`
6. Optionally verify which files npm will include: `canadian-pub`
7. Add changelog to the GitHub release
8. Finally: `npm publish`

## Donate

Expand Down
30 changes: 25 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
version: "{build}"
build: off
skip_tags: true
build: false
skip_branch_with_pr: true

environment:
matrix:
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "Current"

configuration: Release
platform:
- x64

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

test_script:
- node --version
- npm --version
- npm test
- ps: if ($env:nodejs_version -eq "Current") { npm run test-electron }

before_deploy:
- SET ARCHIVE_NAME=%APPVEYOR_REPO_TAG_NAME%-win32-%PLATFORM%.tar.gz
- npm run prebuild
- tar -zcvf "%ARCHIVE_NAME%" -C prebuilds .
- appveyor PushArtifact %ARCHIVE_NAME%

deploy:
- provider: GitHub
artifact: $(ARCHIVE_NAME)
auth_token:
secure: AjmYV2zeogfen7F6tXvR9PO1zynJVF/jhMCExQ9RMtqEHDMH8Frclym3GniZkEB0
draft: false
on:
appveyor_repo_tag: true
nodejs_version: "Current"
17 changes: 14 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
"main": "leveldown.js",
"scripts": {
"install": "node-gyp-build",
"test": "standard && hallmark && verify-travis-appveyor && nyc tape test/*-test.js",
"test": "standard && hallmark && nyc tape test/*-test.js",
"test-gc": "npx -n=--expose-gc tape test/{cleanup,iterator-gc,chained-batch-gc}*-test.js",
"test-electron": "electron test/electron.js",
"test-prebuild": "cross-env PREBUILDS_ONLY=1 npm t",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"rebuild": "node-gyp rebuild",
"prebuild": "prebuildify -t 8.14.0 --napi --strip",
"download-prebuilds": "prebuildify-ci download",
"hallmark": "hallmark --fix",
"dependency-check": "dependency-check . test/*.js",
"prepublishOnly": "npm run dependency-check"
Expand All @@ -21,20 +27,25 @@
"devDependencies": {
"async": "^2.0.1",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"delayed": "^1.0.1",
"dependency-check": "^3.3.0",
"du": "~0.1.0",
"electron": "^5.0.1",
"glob": "^7.1.4",
"hallmark": "^0.1.0",
"level-community": "^3.0.0",
"level-concat-iterator": "^2.0.0",
"mkfiletree": "^1.0.1",
"node-gyp": "^4.0.0",
"nyc": "^14.0.0",
"prebuildify": "^3.0.0",
"prebuildify-ci": "^1.0.4",
"readfiletree": "~0.0.1",
"rimraf": "^2.6.1",
"standard": "^12.0.0",
"tape": "^4.10.0",
"tempy": "^0.2.1",
"verify-travis-appveyor": "^3.0.0"
"tempy": "^0.2.1"
},
"standard": {
"ignore": [
Expand Down

0 comments on commit 69f5f66

Please sign in to comment.