-
Notifications
You must be signed in to change notification settings - Fork 30
Add travis and appveyor for prebuilding binaries #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Prior99
wants to merge
2
commits into
google:master
Choose a base branch
from
Prior99:feat/prebuilt-binaries
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ demo/train-* | |
| .nyc_output/ | ||
| coverage/ | ||
| .DS_Store | ||
| *.node | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| language: node_js | ||
| compiler: gcc | ||
| env: | ||
| global: | ||
| - NODE_GLES_SKIP_BINARY_DOWNLOAD_FOR_CI=true | ||
| jobs: | ||
| include: | ||
| - stage: build | ||
| node_js: "10" | ||
| os: linux | ||
| - stage: build | ||
| node_js: "11" | ||
| os: linux | ||
| - stage: build | ||
| node_js: "12" | ||
| os: linux | ||
| - stage: build | ||
| node_js: "13" | ||
| os: linux | ||
| - stage: build | ||
| node_js: "14" | ||
| os: linux | ||
| - stage: build | ||
| node_js: "10" | ||
| os: osx | ||
| - stage: build | ||
| node_js: "11" | ||
| os: osx | ||
| - stage: build | ||
| node_js: "12" | ||
| os: osx | ||
| - stage: build | ||
| node_js: "13" | ||
| os: osx | ||
| - stage: build | ||
| node_js: "14" | ||
| os: osx | ||
| addons: | ||
| apt: | ||
| sources: | ||
| - ubuntu-toolchain-r-test | ||
| packages: | ||
| - gcc-7 | ||
| - g++-7 | ||
| - make | ||
| - git | ||
| before_install: | ||
| - npm install -g yarn | ||
| - if [ $TRAVIS_OS_NAME == "linux" ]; then | ||
| export CC="gcc-7"; | ||
| export CXX="g++-7"; | ||
| export LINK="gcc-7"; | ||
| export LINKXX="g++-7"; | ||
| fi | ||
| - node --version | ||
| - yarn --version | ||
| script: | ||
| - yarn build | ||
| after_script: | ||
| - "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
| cache: yarn | ||
| deploy: | ||
| provider: releases | ||
| api_key: | ||
| secure: ADD YOUR TRAVIS KEY HERE | ||
| file_glob: true | ||
| file: "node-gles-*-*-*.node" | ||
| skip_cleanup: true | ||
| on: | ||
| tags: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| # The release configuration. | ||
| # This is executed for releases only and will upload the artifact to Github. | ||
| - configuration: release | ||
| version: "{build}" | ||
| branches: | ||
| only: | ||
| - release | ||
| - /\d\.\d\.\d/ | ||
| except: | ||
| - master | ||
| os: Visual Studio 2013 | ||
| platform: | ||
| - x64 | ||
| build: off | ||
| clone_folder: C:\repositories\node-gles | ||
| # This is adapted from the appveyor.yml in node-sass. | ||
| # http://www.wintellect.com/devcenter/jrobbins/pdb-files-what-every-developer-must-know | ||
| # http://help.appveyor.com/discussions/kb/32-how-to-build-on-logical-drive-created-by-subst | ||
| init: | ||
| - cmd: >- | ||
| subst S: C:\repositories | ||
| - ps: set-location -path S:\node-gles | ||
| environment: | ||
| NODE_GLES_SKIP_BINARY_DOWNLOAD_FOR_CI: true | ||
| matrix: | ||
| - nodejs_version: 10 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 11 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 12 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 13 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 14 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| install: | ||
| - git submodule update --init --recursive | ||
| - ps: Install-Product node $env:nodejs_version $env:platform | ||
| - node --version | ||
| - npm --version | ||
| - npm install -g yarn | ||
| - yarn --version | ||
| - yarn install | ||
| build_script: | ||
| - yarn build | ||
| artifacts: | ||
| - path: node-gles-*-*-*.node | ||
| name: node-gles | ||
| deploy: | ||
| - provider: GitHub | ||
| artifact: node-gles | ||
| auth_token: | ||
| secure: ADD YOUR APPVEYOR KEY HERE | ||
| draft: false | ||
| prerelease: false | ||
| on: | ||
| appveyor_repo_tag: true | ||
| # The testing configuration. | ||
| # This will be executed for master and all pull requests and wont upload any artifacts. | ||
| - configuration: testing | ||
| version: "{build}" | ||
| branches: | ||
| except: | ||
| - release | ||
| - /\d\.\d\.\d/ | ||
| skip_tags: true | ||
| os: Visual Studio 2013 | ||
| platform: | ||
| - x64 | ||
| build: off | ||
| clone_folder: C:\repositories\node-gles | ||
| # This is adapted from the appveyor.yml in node-sass. | ||
| # http://www.wintellect.com/devcenter/jrobbins/pdb-files-what-every-developer-must-know | ||
| # http://help.appveyor.com/discussions/kb/32-how-to-build-on-logical-drive-created-by-subst | ||
| init: | ||
| - cmd: >- | ||
| subst S: c:\repositories | ||
| - ps: set-location -path S:\node-gles | ||
| environment: | ||
| NODE_GLES_SKIP_BINARY_DOWNLOAD_FOR_CI: true | ||
| matrix: | ||
| - nodejs_version: 10 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 11 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 12 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 13 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| - nodejs_version: 14 | ||
| GYP_MSVS_VERSION: 2015 | ||
| APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
| install: | ||
| - ps: Install-Product node $env:nodejs_version $env:platform | ||
| - node --version | ||
| - npm --version | ||
| - npm install -g yarn | ||
| - yarn --version | ||
| - yarn install | ||
| build_script: | ||
| - yarn build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2019 Google Inc. All Rights Reserved. | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * ============================================================================= | ||
| */ | ||
|
|
||
| const cp = require('child_process'); | ||
| const fs = require('fs'); | ||
| const https = require('https'); | ||
| const path = require('path'); | ||
| const rimraf = require('rimraf'); | ||
| const tar = require('tar'); | ||
| const util = require('util'); | ||
| const os = require('os'); | ||
| const url = require('url'); | ||
| const zip = require('adm-zip'); | ||
| const HttpsProxyAgent = require('https-proxy-agent'); | ||
| const ProgressBar = require('progress'); | ||
|
|
||
| const mkdir = util.promisify(fs.mkdir); | ||
| const exists = util.promisify(fs.exists); | ||
| const rename = util.promisify(fs.rename); | ||
| const unlink = util.promisify(fs.unlink); | ||
|
|
||
| // Determine which tarball to download based on the OS platform and arch: | ||
| const platform = os.platform().toLowerCase(); | ||
| const platformArch = `${platform}-${os.arch().toLowerCase()}`; | ||
| let ANGLE_BINARY_URI = 'https://storage.googleapis.com/angle-builds/'; | ||
| if (platform === 'darwin') { | ||
| // TODO(add debug flag?) | ||
| ANGLE_BINARY_URI += `angle-3729-${platformArch}.tar.gz`; | ||
| } else if (platform === 'linux') { | ||
| // TODO(add debug flag?) | ||
| ANGLE_BINARY_URI += `angle-3729-${platformArch}.tar.gz`; | ||
| } else if (platform === 'win32') { | ||
| ANGLE_BINARY_URI += `angle-3729-${platformArch}.zip`; | ||
| } else { | ||
| console.log('platform: ' + platform); | ||
| throw new Error(`The platform ${platformArch} is not currently supported!`); | ||
| } | ||
|
|
||
| console.log(`Downloading ANGLE from: ${ANGLE_BINARY_URI}`); | ||
|
|
||
| // Dependency storage paths: | ||
| const depsPath = path.join(__dirname, '..', 'deps'); | ||
|
|
||
| // | ||
| // Ensures that a directory exists at a given path. | ||
| // | ||
| async function ensureDir(dirPath) { | ||
| if (!await exists(dirPath)) { | ||
| await mkdir(dirPath); | ||
| } | ||
| } | ||
|
|
||
| // | ||
| // Downloads the ANGLE tarball set at `ANGLE_BINARY_URI` with an optional | ||
| // callback when downloading and extracting has finished. | ||
| // | ||
| async function downloadAngleLibs(callback) { | ||
| console.error('* Downloading ANGLE'); | ||
| await ensureDir(depsPath); | ||
|
|
||
| // If HTTPS_PROXY, https_proxy, HTTP_PROXY, or http_proxy is set | ||
| const proxy = process.env['HTTPS_PROXY'] || process.env['https_proxy'] || | ||
| process.env['HTTP_PROXY'] || process.env['http_proxy'] || ''; | ||
|
|
||
| // Using object destructuring to construct the options object for the | ||
| // http request. the '...url.parse(ANGLE_BINARY_URI)' part fills in the host, | ||
| // path, protocol, etc from the ANGLE_BINARY_URI and then we set the agent to | ||
| // the default agent which is overridden a few lines down if there is a proxy | ||
| const options = { | ||
| ...url.parse(ANGLE_BINARY_URI), | ||
| agent: https.globalAgent, | ||
| headers: { 'Cache-Control': 'no-cache' } | ||
| }; | ||
|
|
||
| if (proxy !== '') { | ||
| options.agent = new HttpsProxyAgent(proxy); | ||
| } | ||
|
|
||
| const request = https.get(options, response => { | ||
| const bar = new ProgressBar('[:bar] :rate/bps :percent :etas', { | ||
| complete: '=', | ||
| incomplete: ' ', | ||
| width: 30, | ||
| total: parseInt(response.headers['content-length'], 10) | ||
| }); | ||
|
|
||
| if (platform === 'win32') { | ||
| // Save zip file to disk, extract, and delete the downloaded zip file. | ||
| const tempFileName = path.join(__dirname, '_tmp.zip'); | ||
| const outputFile = fs.createWriteStream(tempFileName); | ||
|
|
||
| response.on('data', chunk => bar.tick(chunk.length)) | ||
| .pipe(outputFile) | ||
| .on('close', async () => { | ||
| const zipFile = new zip(tempFileName); | ||
| zipFile.extractAllTo(depsPath, true /* overwrite */); | ||
|
|
||
| await unlink(tempFileName); | ||
|
|
||
| // The .lib files for the two .dll files we care about have a name | ||
| // the compiler doesn't like - rename them: | ||
| await rename( | ||
| path.join( | ||
| depsPath, 'angle', 'out', 'Release', 'libGLESv2.dll.lib'), | ||
| path.join( | ||
| depsPath, 'angle', 'out', 'Release', 'libGLESv2.lib')); | ||
| await rename( | ||
| path.join( | ||
| depsPath, 'angle', 'out', 'Release', 'libEGL.dll.lib'), | ||
| path.join(depsPath, 'angle', 'out', 'Release', 'libEGL.lib')); | ||
|
|
||
| if (callback !== undefined) { | ||
| callback(); | ||
| } | ||
| }); | ||
| } else { | ||
| // All other platforms use a tarball: | ||
| response | ||
| .on('data', | ||
| (chunk) => { | ||
| bar.tick(chunk.length); | ||
| }) | ||
| .pipe(tar.x({ C: depsPath, strict: true })) | ||
| .on('close', () => { | ||
| if (callback !== undefined) { | ||
| callback(); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| request.end(); | ||
| } | ||
|
|
||
| // | ||
| // Wraps and executes a node-gyp rebuild command. | ||
| // | ||
| async function buildBindings() { | ||
| console.error('* Building ANGLE bindings') | ||
| cp.execSync('node-gyp rebuild', (err) => { | ||
| if (err) { | ||
| throw new Error('node-gyp failed with: ' + err); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| // | ||
| // Main execution function for this script. | ||
| // | ||
| async function run() { | ||
| await downloadAngleLibs(buildBindings); | ||
| } | ||
|
|
||
| run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export const suffix: string; | ||
| export const baseName: string; | ||
| export const qualifiedName: string; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just specify "gcc"? These should be symlink'd on linux.