Skip to content

Commit

Permalink
Merge pull request #14 from nrabinowitz/docker-build
Browse files Browse the repository at this point in the history
Build C library with docker
  • Loading branch information
nrabinowitz authored Aug 10, 2018
2 parents d11ab1d + db23bea commit f57b6e9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
23 changes: 18 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
language: node_js

node_js:
- '6'
- '8'
- '10'

sudo: required

services:
- docker

before_install:
- yarn init-docker

before_script:
- yarn run dist-test
- yarn build-emscripten
- yarn dist-test

script:
- yarn lint
- yarn run test-es6
- yarn run test-dist
- yarn run test-parity
- yarn run prettier && git diff --exit-code
- yarn test-es6
- yarn test-dist
- yarn test-parity
- yarn prettier && git diff --exit-code
- yarn cover

after_success:
- npm install -g coveralls
- cat coverage/lcov.info | coveralls
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,15 @@ When making code changes that may affect performance, please run benchmarks agai

### Transpiling the C Source

You need to have emscripten's `emcc` in your `$PATH`. I highly recommend [the portable install](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) as easiest to update and maintain.
The core library is transpiled using [emscripten](http://kripken.github.io/emscripten-site). The easiest way to build from source locally is by using Docker. Make sure Docker is installed, then:

Once you finished the installation, run the following command to check the precompiled package versions:
yarn init-docker
yarn run build-emscripten

emsdk list
The build script uses the `H3_VERSION` file to determine the version of the core library to build.

NOTE: The current `h3-js` is built with `emscripten-1.37.40`. Earlier or later versions MAY NOT WORK (emscripten does not follow semver, so patch updates may include breaking changes).

Note that you'll need to add the emscripten PATH and env variables to your current terminal (unless you add this to your `.bash_profile`):

source /path/to/emsdk_portable/emsdk_env.sh

Then simply:

yarn run build-emscripten

The build script automatically uses the `package.json` version as the version of `libh3` to build, so these versions are completely in sync with the upstream C code.

## Contributing

Pull requests and [Github issues](https://github.com/uber/h3-js/issues) are welcome. Please include tests for new work, and keep the library test coverage at 100%. Please note that the purpose of this module is to expose the API of the [H3 Core library](https://github.com/uber/h3), so we will rarely accept new features that are not part of that API. New proposed feature work is more appropriate in the core C library or in a new JS library that depends on `h3-js`.
Expand Down
2 changes: 1 addition & 1 deletion out/libh3.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"dist-test": "yarn run dist && buble -i test -o dist/test",
"benchmarks": "yarn run dist-test && node dist/test/benchmarks.js",
"prepublish": "yarn run dist",
"build-emscripten": "./.build-emscripten.sh",
"init-docker": "docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-tag-1.37.40-64bit bash",
"build-emscripten": "docker exec -it emscripten bash .build-emscripten.sh",
"cover": "istanbul cover -x out/*.js -- test/index.js",
"prettier": "prettier --write --single-quote --no-bracket-spacing --print-width=100 'lib/**/*.js' 'build/**/*.js' 'test/**/*.js'"
},
Expand Down

0 comments on commit f57b6e9

Please sign in to comment.