-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release version 0.2.0 on NPM and include pre-built binaries
This adds Windows and Mac CI and binary bundling
- Loading branch information
Showing
11 changed files
with
249 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/_build | ||
/bin | ||
/graphql_ppx.native | ||
/node_modules | ||
/tests/lib | ||
|
This file contains 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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
/_build | ||
/.vscode | ||
/graphql_ppx.native | ||
/node_modules | ||
/tests/lib | ||
/tests_apollo/lib | ||
/lib | ||
/ppx | ||
/graphql_ppx.* | ||
/doc | ||
/lib | ||
/ci | ||
/src |
This file contains 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 |
---|---|---|
@@ -1,20 +1,72 @@ | ||
language: node_js | ||
language: generic | ||
|
||
node_js: | ||
- "8" | ||
os: | ||
- linux | ||
- osx | ||
|
||
addons: | ||
apt: | ||
sources: | ||
- avsm | ||
packages: | ||
- ocaml | ||
- ocaml-native-compilers | ||
- camlp4-extra | ||
- opam | ||
|
||
before_install: | ||
- sudo add-apt-repository ppa:avsm/ppa -y | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y ocaml ocaml-native-compilers camlp4-extra opam | ||
- OPAMYES=1 opam init | ||
- bash -e ci/travis_before_install.sh | ||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export TARGET_NAME=darwin-x64; export OCAMLBUILDFLAGS=""; fi | ||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then export TARGET_NAME=linux-x64; export OCAMLBUILDFLAGS="-lflags '-ccopt -static'"; fi | ||
- eval `opam config env` | ||
|
||
before_script: | ||
- ln -fs graphql_ppx.native ppx | ||
- yarn | ||
- IS_GRAPHQL_PPX_CI=true yarn | ||
- OPAMYES=1 opam pin add graphql_ppx . -n | ||
- OPAMYES=1 opam install graphql_ppx --deps-only | ||
|
||
script: | ||
- OPAMYES=1 opam pin add graphql_ppx . | ||
- make | ||
- make test | ||
- make "OCAMLBUILDFLAGS=$OCAMLBUILDFLAGS" | ||
- make test "OCAMLBUILDFLAGS=$OCAMLBUILDFLAGS" | ||
- cp _build/src/graphql_ppx.native graphql_ppx-$TARGET_NAME.exe | ||
|
||
deploy: | ||
provider: releases | ||
skip_cleanup: true | ||
file_glob: true | ||
file: graphql_ppx-*.exe | ||
api_key: | ||
secure: "xFRAioN2zdN/iDNFNTzjTp+bRPBxpdokJRYCWo4sA4FExvSrf5pibHGjapmESTdWkSziNHVWDqQr8oWeN93sGEuPn/faKhhqtn8ikeqMpB9PVIc/1X9+ScIWD9meMG8hPEDJsD5W/dgsJs75M4P9bmVDKvQ4X96rSyl0r5RRRFqTHc4Irc1Io5XoLSftuA++DVFvDUAlrfOHguGRK1LtMcDX7ei8CTbiTrYshn6LabeqV12nVxVYCqKQROqQ/RQCFtRvWKe6z98Zp1roOafX4X4k9Q0w5BUx6x7hniOQoaQZpyZukrOlAqwJsURxiH+MrwJPv52steFz2CXPTSPY6LTHlmc39yhULmnkwMIFjJGQJQbgmb+7XWMfZZV5he7OarnqiCVJRIoTvOMbPfKEhswns4mf1NrEsSBoWJMGAot+q8/Gx5eMZaPRnr8SNYL5e3TJmu7g/J/0nJb7gZHZieljiZotwadS1AA2JUoqhPnkuZpVK9xMXOVbzOUuqhOF3P/fbT2FTpMjCtUPxpf0A7nBC92kb5uVKw/WKQVZUe3D1fjh/a8dzUPHyQ9a+7wnfOPId36GM0tFGZhvpuFgt/+lCh7d1MJFOvn5Y3nPIqUHJT6pWvLckBCY//lUkVF7d5ddXrEXNywA62ZOYojPK5qYQIGyWNeE9x8kpiVaYfs=" | ||
on: | ||
tags: true | ||
|
||
|
||
jobs: | ||
include: | ||
- stage: Wait for Windows binaries to become available | ||
addons: | ||
apt: | ||
sources: [] | ||
packages: [] | ||
before_install: skip | ||
before_script: skip | ||
deploy: [] | ||
script: bash -e ci/wait_for_builds.sh | ||
|
||
- stage: Deploy to npmjs | ||
addons: | ||
apt: | ||
sources: [] | ||
packages: [] | ||
before_install: skip | ||
before_script: skip | ||
script: | ||
- bash -e ci/download_binaries.sh | ||
deploy: | ||
provider: npm | ||
email: [email protected] | ||
api_key: | ||
secure: "WrVb4p1hoobkvcL5B0Tx+6H/+6wNqJbHc5/BfsXCLautjk4kEjgWFfpNOGKtww+vXm2O/huzmkJgoieRUXFmTxD/enC0jWthv5JCCtGPtBNjvPGv000M0PNoamcy9Cmmn9NbJ8oAjCp8vDH9TLnielP7sPnUtqiBbi0igzcQu7UJoXgN+oCcs0d+L4rGHDD+EyJ5UugcXWefY9U/vWzec5fcIjazATMjl1yIGn9Mq4ldFp/ekzsOMXf5rlVeN0UZJ8tsAMY+tdMruZgmqC/h4f/nVeVxXaGqF/2AWlfdD/YGIN8HABK1Z6yHp1JHiG4BbY6r3OIygiva2FMXVS5MOpFIpfgr65LvMvV01M9KrQrTSF44cCJBmtYJdmDjvgvBSAY4Ifzl1DpD96W9SW5pRXXIPEGpn1ByTJYZiXs1I4T0T6hEWSNIHMX0TASR/bhyvC38MfoSd9/RmRH89avN4v+5jeSaIJPwVHxzvieF9iD+i+sFUMLDcEbcLRDhhIuEfsgzEW4lf0iVJC2/EvissQu64nYWAv0dKr1I/K+ahn9uWnrWBxFGbLIJydDQieLGtu1sfjfEuroLH+no6mpHeGAQQ4GYDJ38WtDxzmAOn5HolotKMsLG3GgYiNrmyoWA55LRRiWcEoYj4Spe/nAd/dCjjms82SezNK9a7/D2VJI=" | ||
on: | ||
tags: true | ||
skip_cleanup: true |
This file contains 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 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 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,51 @@ | ||
platform: | ||
- x64 | ||
|
||
environment: | ||
matrix: | ||
- FORK_USER: ocaml | ||
FORK_BRANCH: master | ||
CYG_ROOT: C:\cygwin64 | ||
OPAM_SWITCH: 4.02.3+mingw64c | ||
PACKAGE: graphql_ppx | ||
OPAMYES: 1 | ||
INSTALL: false | ||
REVDEPS: false | ||
IS_GRAPHQL_PPX_CI: true | ||
TARGET_PLATFORM: win-x64 | ||
|
||
- FORK_USER: ocaml | ||
FORK_BRANCH: master | ||
CYG_ROOT: C:\cygwin | ||
OPAM_SWITCH: 4.02.3+mingw32c | ||
PACKAGE: graphql_ppx | ||
OPAMYES: 1 | ||
INSTALL: false | ||
REVDEPS: false | ||
IS_GRAPHQL_PPX_CI: true | ||
TARGET_PLATFORM: win-x86 | ||
|
||
install: | ||
- ps: Install-Product node LTS | ||
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/$env:FORK_USER/ocaml-ci-scripts/$env:FORK_BRANCH/appveyor-install.ps1")) | ||
- yarn | ||
|
||
build_script: | ||
- call %CYG_ROOT%\bin\bash.exe -l %APPVEYOR_BUILD_FOLDER%\appveyor-opam.sh | ||
- call %CYG_ROOT%\bin\bash.exe -l -c "cd /cygdrive/c/projects/graphql-ppx && make build" | ||
|
||
test_script: | ||
- node node_modules/gql-tools/cli/gqlschema.js -o tests/graphql_schema.json tests/schema.gql | ||
- call %CYG_ROOT%\bin\bash.exe -l -c "cd /cygdrive/c/projects/graphql-ppx && make test" | ||
- copy graphql_ppx.native graphql_ppx-%TARGET_PLATFORM%.exe | ||
|
||
artifacts: | ||
- path: graphql_ppx-*.exe | ||
|
||
deploy: | ||
provider: GitHub | ||
auth_token: | ||
secure: cNoylUr8IbJuXONnyQFAUTNzU0GsZkq4mnAhvyzqPgbtesQSJM0rCJGDPhLjMHo+ | ||
artifact: /graphql_ppx-.*\.exe/ | ||
on: | ||
appveyor_repo_tag: true |
This file contains 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,14 @@ | ||
set -e | ||
|
||
if [ -z "$TRAVIS_TAG" ]; then | ||
echo "TRAVIS_TAG variable empty, will not download binaries" | ||
exit 0 | ||
fi | ||
|
||
BASE_URL=https://github.com/mhallin/graphql_ppx/releases/download/$TRAVIS_TAG/graphql_ppx- | ||
|
||
mkdir -p bin | ||
|
||
for platform in linux-x64 darwin-x64 win-x64 win-x86; do | ||
(cd bin && curl -fOL $BASE_URL$platform.exe) | ||
done |
This file contains 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,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
case "$TRAVIS_OS_NAME" in | ||
osx) | ||
brew update | ||
brew install aspcud awscli yarn opam ocaml | ||
curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2 | tar xjf - | ||
mv bin/darwin/amd64/github-release . | ||
;; | ||
linux) | ||
source "$HOME/.nvm/nvm.sh" | ||
nvm install 9 | ||
nvm use 9 | ||
curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar xjf - | ||
mv bin/linux/amd64/github-release . | ||
;; | ||
esac | ||
|
||
OPAMYES=1 opam init | ||
OPAMYES=1 opam switch 4.02.3 | ||
|
||
eval `opam config env` |
This file contains 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,28 @@ | ||
set -e | ||
|
||
if [ -z "$TRAVIS_TAG" ]; then | ||
echo "TRAVIS_TAG variable empty, will not wait for builds" | ||
exit 0 | ||
fi | ||
|
||
CURL="curl -ifs" | ||
BASE_URL=https://github.com/mhallin/graphql_ppx/releases/download/$TRAVIS_TAG/graphql_ppx- | ||
START_TIME=$(date "+%s") | ||
|
||
## Wait at most 30 minutes for all platform binaries to be ready | ||
|
||
for platform in linux-x64 darwin-x64 win-x64 win-x86; do | ||
echo Checking binary for $platform | ||
|
||
while ! $CURL $BASE_URL$platform.exe > /dev/null; do | ||
if [ $(( $(date "+%s") - $START_TIME )) -gt 1800 ]; then | ||
echo Timed out waiting for builds to finish | ||
exit 1 | ||
fi | ||
|
||
echo Build task for $platform not yet finished, waiting... | ||
sleep 10 | ||
done | ||
done | ||
|
||
echo 'All binaries found' |
This file contains 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,43 @@ | ||
#!/usr/bin/env node | ||
|
||
var fs = require('fs'); | ||
|
||
var arch = process.arch; | ||
var platform = process.platform; | ||
|
||
if (arch === 'ia32') { | ||
arch = 'x86'; | ||
} | ||
|
||
if (platform === 'win32') { | ||
platform = 'win'; | ||
} | ||
|
||
var filename = 'bin/graphql_ppx-' + platform + '-' + arch + '.exe'; | ||
var supported = fs.existsSync(filename); | ||
|
||
if (!supported) { | ||
console.error('graphql_ppx does not support this platform :('); | ||
console.error(''); | ||
console.error('graphql_ppx comes prepacked as built binaries to avoid large'); | ||
console.error('dependencies at build-time.'); | ||
console.error(''); | ||
console.error('If you want graphql_ppx to support this platform natively,'); | ||
console.error('please open an issue at our repository, linked above. Please'); | ||
console.error('specify that you are on the ' + platform + ' platform,'); | ||
console.error('on the ' + arch + ' architecture.'); | ||
|
||
if (!process.env.IS_GRAPHQL_PPX_CI) { | ||
process.exit(1); | ||
} | ||
} | ||
|
||
if (process.env.IS_GRAPHQL_PPX_CI) { | ||
console.log('graphql_ppx: IS_GRAPHQL_PPX_CI has been set, skipping moving binary in place'); | ||
process.exit(0); | ||
} | ||
|
||
if (!fs.existsSync('ppx')) { | ||
fs.copyFileSync(filename, 'ppx'); | ||
fs.chmodSync('ppx', 0755); | ||
} |
This file contains 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