Skip to content
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

graphql_ppx 1.0 #86

Merged
merged 449 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
449 commits
Select commit Hold shift + click to select a range
4f46e45
Documentation WIP
jfrolich Apr 18, 2020
1b6c355
Documentation progress
jfrolich Apr 18, 2020
8d9b82e
Refactor
jfrolich Apr 24, 2020
a9904ff
Empty variant is not necessary
jfrolich Apr 24, 2020
70ba629
Doesn't need unsafe unwrap
jfrolich Apr 24, 2020
dd1947c
Explicitly add typenames
jfrolich Apr 24, 2020
77499f6
Fixes parse type names for variant record types
jsiebern Apr 24, 2020
ac7a4be
Fixes type generation for bucklescript variants
jsiebern Apr 24, 2020
0e51f0c
Adds bucklescript variant test case
jsiebern Apr 24, 2020
6621d15
Simplify implementation
jfrolich Apr 24, 2020
77c6939
Merge pull request #108 from jsiebern/fix-bucklescript-variants
jfrolich Apr 24, 2020
29c8283
bump version
jfrolich Apr 24, 2020
ebd3f6d
spacing
jfrolich Apr 24, 2020
e75ff00
Adds a more complex test case for bsVariant
jsiebern Apr 24, 2020
56bf938
Fix regression
jfrolich Apr 24, 2020
927f345
Merge pull request #109 from jsiebern/fix-bucklescript-variants
jfrolich Apr 24, 2020
a6ca69c
Improve apollo mode
jfrolich Apr 24, 2020
b781620
Adds bsconfig.json parser for default args
jsiebern Apr 24, 2020
5a5b803
Refactor
jfrolich Apr 25, 2020
29c4356
simplify
jfrolich Apr 25, 2020
5cc6072
Add documentation to rei file
jfrolich Apr 25, 2020
4e4588a
Schema.schema => Schema.t
jfrolich Apr 25, 2020
30938b3
Merge pull request #110 from reasonml-community/add-typename
jfrolich Apr 25, 2020
39046c7
fix bug when adding __typename twice
jfrolich Apr 25, 2020
ff47c9e
Do not add typenames to root query and do not add __typename twice
jfrolich Apr 25, 2020
db8afcf
eliminate makeVar
jfrolich Apr 25, 2020
fe77c9a
Do not create function `makeWithVariables` when there are no variables
jfrolich Apr 25, 2020
11f1d3b
Non dependent type definitions
jfrolich Apr 25, 2020
9a4cdab
Generate raw variable types
jfrolich Apr 25, 2020
9edfe13
Raw argument types working!
jfrolich Apr 25, 2020
1647bea
Changes config field name to graphql
jsiebern Apr 25, 2020
f0e8913
Changes ast-out option to an enum
jsiebern Apr 25, 2020
a8c58a4
Adds custom-types parsing to config
jsiebern Apr 25, 2020
e5ffcbe
Adds test case for custom types
jsiebern Apr 25, 2020
dd2ceca
Changes customTypes test case to check overriding the customTypes in …
jsiebern Apr 25, 2020
231a519
Adds custom field options to cli args
jsiebern Apr 25, 2020
1ef4f15
Adds final new lines to the edited files
jsiebern Apr 27, 2020
14ac466
Improve serialization
jfrolich Apr 28, 2020
b94a932
improve serialization
jfrolich Apr 28, 2020
6d31346
Attribution to reserved words
jfrolich Apr 28, 2020
0dc3b2e
Move to_valid_ident to utils
jfrolich Apr 28, 2020
3c47a63
Remove from types
jfrolich Apr 28, 2020
a15101d
add some metalocs
jfrolich Apr 28, 2020
22cdcc1
Fix metalocs
jfrolich Apr 28, 2020
32f62d5
Replace add_loc function to fix the buffer offset positions
jsiebern Apr 28, 2020
302f480
Merge pull request #111 from jsiebern/config-from-bsconfig-file
jfrolich Apr 29, 2020
26854a3
Locations across multiple lines
jsiebern Apr 29, 2020
392198d
Early morning mistake
jsiebern Apr 29, 2020
ee7e659
Merge branch '1.0' into serialize
jfrolich Apr 29, 2020
8859d7d
Fix issue with bsVariant
jfrolich Apr 29, 2020
96e9022
Merge branch '1.0' of github.com:reasonml-community/graphql_ppx into 1.0
jfrolich Apr 29, 2020
12e5bd6
Merge branch 'serialize' into 1.0
jfrolich Apr 29, 2020
7d4ca21
fix merge
jfrolich Apr 29, 2020
a929500
try new name
jfrolich Apr 29, 2020
df4bf4d
Revert "try new name"
jfrolich Apr 29, 2020
28f7be7
Fixes error for missing fragment type
jsiebern Apr 29, 2020
ead3dfe
Highlight the type name instead of the whole fragment on error
jsiebern Apr 29, 2020
d697662
Adds snapshot testing for compiler errors and a few cases
jsiebern Apr 29, 2020
b7c74ea
Merge branch '1.0' into fix-error-positions
jsiebern Apr 29, 2020
b217d73
Adjust ast_transform to only transform resolvable types (to allow err…
jsiebern Apr 29, 2020
46a1ce5
Show error highlight on the type rather than the whole selection set
jsiebern Apr 29, 2020
4e538ce
Updates test snapshots
jsiebern Apr 29, 2020
d39fa07
Do some filtering on the stderr output to only capture the relevant b…
jsiebern Apr 29, 2020
fc30336
Merge pull request #114 from jsiebern/fix-error-positions
jfrolich Apr 30, 2020
f9fb152
Changes error catching to an async test to catch warnings/alerts in a…
jsiebern Apr 30, 2020
7d2648c
Adds deprecated field alerts
jsiebern Apr 30, 2020
bfcd446
Add snapshot that shows failing arguments when using objects
Apr 30, 2020
6899cc2
First basic improvements and stopping parser / serializer from overwr…
jsiebern May 1, 2020
3816e31
Merge pull request #117 from jsiebern/deprecated-field-alerts
jfrolich May 1, 2020
97cf5bb
generate object instead of record for variables in object mode
jfrolich May 1, 2020
ca361f0
Merge pull request #116 from johnhaley81/add-arg-test-case
jfrolich May 1, 2020
af1ffa0
Fix some issues
jfrolich May 1, 2020
17e0811
Adds a simple schema printer and displays a doc comment for the full …
jsiebern May 1, 2020
b64e8bd
Add type location to fragment names
jsiebern May 1, 2020
4531ba8
Fixes error position for type alias
jsiebern May 1, 2020
ca525ca
Map type location onto operation keywords
jsiebern May 1, 2020
a895802
Fixes the type display of input args
jsiebern May 1, 2020
1fef950
Implements schema printing for type constrains on input args
jsiebern May 1, 2020
cc559c6
Fix some issues with objects
jfrolich May 2, 2020
5a28b89
Fix solo fragment spread and a typename issue
jfrolich May 2, 2020
f3a059b
Deduplicate input object creation on a argument list level
jfrolich May 2, 2020
70fd977
loosen constraint on reason, addresses #103
jfrolich May 2, 2020
92a11b3
update package lock
jfrolich May 2, 2020
8549e1c
add test case
jfrolich May 2, 2020
48de6a3
add tests_bucklescript/operations to sources and start fixing compile…
May 2, 2020
28bbd85
add test case 2/2
jfrolich May 2, 2020
9375406
Merge branch '1.0' into fix-type-locations
jsiebern May 2, 2020
f113c89
Fixes some more merging issues
jsiebern May 2, 2020
f3cb9e9
Maps type locations to union variants
jsiebern May 2, 2020
1c1e2f6
Fix a type error for bsVariant serialization
jsiebern May 2, 2020
cd1dc04
Merge remote-tracking branch 'upstream/fix-variant-serialization' int…
jsiebern May 2, 2020
0a4e619
Updates snapshots
jsiebern May 2, 2020
0ab6efe
Merge remote-tracking branch 'upstream/fix-variant-serialization' int…
jsiebern May 2, 2020
8eb8669
Maps type locations for variant fields
jsiebern May 2, 2020
12439a7
Adds serializer to test so it doesn't fail on compilation
jsiebern May 2, 2020
c76266f
Fixes regression from merge
jsiebern May 2, 2020
465a55b
Only print out gql type comments for complex input types
jsiebern May 2, 2020
91e6d63
Updates test snapshots
jsiebern May 2, 2020
aaf42f3
Fixes unnecessarily requiring arguments with default values in the sc…
jsiebern May 2, 2020
40a10e2
Fixes default object values on scalars
jsiebern May 3, 2020
5f94dcf
Adds according test case
jsiebern May 3, 2020
6cb8491
Merge pull request #118 from jsiebern/fix-type-locations
jfrolich May 3, 2020
d3088b2
Merge pull request #122 from jsiebern/fix-required-arguments-for-defa…
jfrolich May 3, 2020
5174810
Merge pull request #123 from jsiebern/fix-default-object-values-on-sc…
jfrolich May 3, 2020
6b534b4
Reverses error messages to display in order of occurence
jsiebern May 3, 2020
9593a22
Adds validation of default scalar type values
jsiebern May 3, 2020
76724ab
Adds test cases for invalid default values
jsiebern May 3, 2020
11a0a8d
Adds a rule for type checking applied variables
jsiebern May 3, 2020
43be14b
Adds some test cases
jsiebern May 3, 2020
e11fb95
Merge pull request #125 from jsiebern/error-on-invalid-default-value
jfrolich May 4, 2020
848143a
Removes unnecessary comment
jsiebern May 4, 2020
e192cbc
Adds new rule file
jsiebern May 4, 2020
bd4aa49
Fixes type location override of __typename in apollo-mode
jsiebern May 4, 2020
e3b4f9a
Improves location mapping for fragment types
jsiebern May 4, 2020
8074321
Updates test snapshots
jsiebern May 4, 2020
3f1f63f
Fixes invalid arg variables to cover list types correctly
jsiebern May 4, 2020
5fb0aa4
Abstracts generic value validation
jsiebern May 5, 2020
9386cdd
Creates new rule for input object validaton
jsiebern May 5, 2020
5e172c3
compile GraphQL_PPX again
jfrolich May 5, 2020
a639d0f
Merge pull request #127 from jsiebern/fix-apollo-mode-type-locations
jfrolich May 5, 2020
8b41eb4
Merge branch '1.0' of github.com:reasonml-community/graphql_ppx into 1.0
jfrolich May 5, 2020
bca8e05
Fix regression with js output, (a bit hacky, can refactor later)
jfrolich May 5, 2020
b90ff3c
bump version
jfrolich May 5, 2020
0a5d763
inline records
jfrolich May 5, 2020
e576171
Optimize performance
jfrolich May 6, 2020
6887515
Fix wrong float printing
jfrolich May 7, 2020
2c5c0b4
Refactors default / argument validity checking to use abstracted type…
jsiebern May 8, 2020
5a3b801
change module rewriter (make it simpler and more flexible for later i…
jfrolich May 8, 2020
8c8d44d
Refactors object value check to work with recursive objects
jsiebern May 8, 2020
8f4aa9d
Adds snapshots for input object validation
jsiebern May 8, 2020
8543ebc
Updates test schema
jsiebern May 8, 2020
16be67f
Adds validation of input objects inside of lists
jsiebern May 8, 2020
61e285e
Merge branch '1.0' into input-object-validation
jsiebern May 8, 2020
40d0325
Merge pull request #128 from jsiebern/input-object-validation
jsiebern May 8, 2020
b4c3b34
Merge branch '1.0' into documentation
jfrolich May 9, 2020
9a739d0
Adds config option & directive
jsiebern May 9, 2020
ab34c22
Extending graphql-ppx
jfrolich May 9, 2020
84d2b1e
Implements omitting of future value field
jsiebern May 9, 2020
1d7bc5f
Adds some test cases
jsiebern May 9, 2020
d6c0887
Adds readme entry
jsiebern May 9, 2020
b7d81e7
Moves helper types / values into Z__INTERNAL module
jsiebern May 9, 2020
5b60d31
Adds graphql type printing to field argument names
jsiebern May 9, 2020
a97be08
Adds graphql type printing to variables used in field arguments
jsiebern May 9, 2020
d2e4679
Updates test files / snapshots
jsiebern May 9, 2020
0c6bfea
Adds generic information about the module values to the extension
jsiebern May 9, 2020
ee47bd5
Updates tests / snapshots
jsiebern May 9, 2020
f227083
fix: omit double parse
Et7f3 May 12, 2020
7d39c92
add ocaml-lsp
jfrolich May 12, 2020
83976c0
Revert "fix: omit double parse"
jfrolich May 12, 2020
bda7e3d
prevent decoding scalar twice
jfrolich May 13, 2020
098168b
Merge pull request #135 from Et7f3/patch-3
jfrolich May 13, 2020
b74ef03
finalize supporting ocaml-lsp
jfrolich May 13, 2020
da905d9
Merge pull request #136 from reasonml-community/ocaml-lsp2
jfrolich May 13, 2020
73779b1
Merge branch '1.0' into pr/131
jfrolich May 13, 2020
3e84330
Merge pull request #131 from jsiebern/future-added-value-option
jfrolich May 13, 2020
c3b245f
Merge branch '1.0' into pr/132
jfrolich May 13, 2020
d200892
Merge branch '1.0' of github.com:reasonml-community/graphql_ppx into 1.0
jfrolich May 13, 2020
fc249bf
Fix merge conflicts
jfrolich May 13, 2020
eaace91
Hide generated files
jfrolich May 13, 2020
477e83a
add tests_bucklescript/operations to sources and start fixing compile…
May 2, 2020
b5f0c8b
Uncomment compile-able snapshot tests
May 4, 2020
b8f791c
Remove `operations` from bsconfig.json
May 4, 2020
d291893
temp
May 4, 2020
9696684
Restore original snapshot tests
May 11, 2020
51619a7
Add compilation tests
May 11, 2020
fb10555
Update customType to use the correct decoder
May 11, 2020
9ba4362
Add in `operations` temporarily to sources to build
May 11, 2020
127b5bc
Get manual build to work
May 12, 2020
9edab38
Fix `customTypes` snapshot
May 13, 2020
e6dab7c
Improvements
jfrolich May 14, 2020
f102aee
Merge branch 'add-test-ensuring-snapshot-compilation' of https://gith…
jfrolich May 14, 2020
63b2d73
Run tests again
jfrolich May 14, 2020
def34bd
Make tests pass
jfrolich May 14, 2020
7828c84
suppress npm warnings
jfrolich May 14, 2020
1971d36
No warngings
jfrolich May 14, 2020
4430e17
Try this
jfrolich May 14, 2020
979a9f2
oops
jfrolich May 14, 2020
7a91779
remove known errors
jfrolich May 14, 2020
1ee9b5b
escape
jfrolich May 14, 2020
b66898a
Merge pull request #120 from johnhaley81/add-test-ensuring-snapshot-c…
jfrolich May 15, 2020
87a8cd0
Generate packed module value
jfrolich May 15, 2020
be935fe
remove comment
jfrolich May 15, 2020
abecedc
Remove definition
jfrolich May 15, 2020
60f3105
add snapshots
jfrolich May 15, 2020
7775ed4
Add extension
jfrolich May 15, 2020
b5339d6
Fix query wrapping of fragments
jfrolich May 15, 2020
01ee951
Add t_variables even if there are no variables so module type is cons…
jfrolich May 15, 2020
4899526
Merge branch 'new-api' into functors
jfrolich May 15, 2020
84750a8
Make it work!
jfrolich May 15, 2020
152a58f
idiomatic query type name
jfrolich May 15, 2020
6005130
Merge branch 'functors' into new-api
jfrolich May 16, 2020
5f57a00
Working type
jfrolich May 18, 2020
d09ec44
Delete test3.ml
jfrolich May 18, 2020
b05cb2f
cleanup
jfrolich May 18, 2020
e909e08
Try with inferred module type
jfrolich May 19, 2020
c7ec0c3
Revert "Try with inferred module type"
jfrolich May 19, 2020
54cdf2f
Add type annotations
jfrolich May 19, 2020
1ccbac9
Remove self
jfrolich May 19, 2020
40d8e74
rename
jfrolich May 19, 2020
be9fa82
rename again
jfrolich May 19, 2020
fefbf83
Fix casing
jfrolich May 19, 2020
9c6b3b8
Fix
jfrolich May 19, 2020
422e915
Fix casing (some reason the underscore is causing wrong casing)
jfrolich May 19, 2020
2952e51
Manual edit snapshot
jfrolich May 19, 2020
9a5af55
Add js file
jfrolich May 19, 2020
d6c9fcb
Make tests pass
jfrolich May 23, 2020
330d582
Fix lident bug
jfrolich May 23, 2020
4ce846f
Fix snapshots
jfrolich May 23, 2020
fabc034
Merge pull request #138 from reasonml-community/new-api
jfrolich May 23, 2020
03f3dfd
Merge pull request #102 from reasonml-community/documentation
jfrolich May 23, 2020
e4f08b3
add unit type for empty input object
jfrolich Jun 5, 2020
039f211
Merge branch 'new-api' into 1.0
jfrolich Jun 5, 2020
dfde739
Has required variables
jfrolich Jun 5, 2020
92c10a3
Fix bug with unit and change snapshots
jfrolich Jun 5, 2020
13fae4f
set correct version
jfrolich Jun 5, 2020
aa8412e
Update package-lock
jfrolich Jun 5, 2020
115f639
Fix config and defaults
jfrolich Jun 5, 2020
d3c1771
fix signature
jfrolich Jun 5, 2020
043df46
Add verify function for parse (decouple from actual parse)
jfrolich Jun 6, 2020
23baaef
Add more docstrings
jfrolich Jun 6, 2020
1983c47
improve directives
jfrolich Jun 6, 2020
49de5ea
Update documentation
jfrolich Jun 6, 2020
619d0df
Add unsafe_fromJson and toJson
jfrolich Jun 6, 2020
044011c
Change naming
jfrolich Jun 6, 2020
e74bd1a
Upgrade documentation
jfrolich Jun 6, 2020
4acb15a
Update README
jfrolich Jun 6, 2020
f517ea1
fix badge
jfrolich Jun 6, 2020
c32d217
smaller logo
jfrolich Jun 6, 2020
897ae39
add fragment
jfrolich Jun 6, 2020
bce5b59
Update README.md
jfrolich Jun 6, 2020
3cd0cba
Update README.md
jfrolich Jun 6, 2020
fa33ecc
Fix build on OCaml 4.06 and clean up warnings
anmonteiro Jun 7, 2020
82a1162
use `Warnings.Preprocessor` that works across all versions
anmonteiro Jun 7, 2020
56c33a8
Merge pull request #144 from reasonml-community/anmonteiro/fix-build-…
jfrolich Jun 7, 2020
28553d7
Add build dev, upgrade ocaml-lsp
jfrolich Jun 7, 2020
cb28be2
Run snapshots
jfrolich Jun 7, 2020
551549d
Merge branch '1.0' of github.com:reasonml-community/graphql_ppx into 1.0
jfrolich Jun 7, 2020
76f0afd
variablesToJson function
jfrolich Jun 7, 2020
40813dc
Update to cache v2
jfrolich Jun 7, 2020
082fb4d
bump version
jfrolich Jun 14, 2020
c08a1f4
Try to recreate fragment an error
jfrolich Jun 18, 2020
63868f0
Will this work?
jfrolich Jun 18, 2020
ad29371
Adding serializeVariables when there are no variables
jfrolich Jun 18, 2020
2a41e87
Trigger CI
jfrolich Jun 18, 2020
af9918f
Fix CI
jfrolich Jun 18, 2020
f8107b8
Reasonml-community
jfrolich Jun 18, 2020
1a1a608
invalidate cache key on linux
jfrolich Jun 18, 2020
1edc499
Retry publish
jfrolich Jun 18, 2020
74d2ff2
Change name
jfrolich Jun 18, 2020
99e9127
fix
jfrolich Jun 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Hide generated files
tests_bucklescript/**/*.bs.js linguist-generated
tests_bucklescript/static_snapshots/**/* linguist-generated

*.re linguist-language=Reason
*.rei linguist-language=Reason


138 changes: 63 additions & 75 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: graphql_ppx pipeline
name: graphql-ppx-pipeline

on: [pull_request, push]

Expand All @@ -12,7 +12,6 @@ jobs:
os: [ubuntu-latest]

container:
# https://github.com/baransu/docker-esy
image: cichocinski/docker-esy:alpine3.8

steps:
Expand All @@ -22,47 +21,40 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Get esy store path
id: esy_cache_path
shell: bash
run: |
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
DESIRED_LEN="86"
HOME_ESY3="$HOME/.esy/3"
HOME_ESY3_LEN=${#HOME_ESY3}
NUM_UNDERS=$(echo "$(($DESIRED_LEN-$HOME_ESY3_LEN))")
UNDERS=$(printf "%-${NUM_UNDERS}s" "_")
UNDERS="${UNDERS// /_}"
THE_ESY__CACHE_INSTALL_PATH=${HOME_ESY3}${UNDERS}/i
echo "THE_ESY__CACHE_INSTALL_PATH: $THE_ESY__CACHE_INSTALL_PATH"
echo "##[set-output name=path;]$THE_ESY__CACHE_INSTALL_PATH"
- name: Restore esy cache
uses: actions/cache@v1
- name: Install
run: esy install

- name: Print esy cache
id: print_esy_cache
run: node .github/workflows/print_esy_cache.js

- name: Try to restore dependencies cache
id: deps-cache-macos
uses: actions/cache@v2
with:
path: ${{ steps.esy_cache_path.outputs.path }}
key: v1-esy-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
restore-keys: |
v1-esy-${{ matrix.os }}-
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.os }}--${{ hashFiles('**/index.json') }}

- name: install
run: |
esy install
- name: test-native
run: |
esy b dune runtest -f
- name: build
run: esy b

# - name: test-native
# run: |
# esy b dune runtest -f
# env:
# CI: true

- name: test-bucklescript
env:
NODE_NO_WARNINGS: 1
CI: true
- name: test-bucklescript
run: |
esy release-static
cd tests_bucklescript
npm ci --no-optional
npm run test
env:
CI: true

- name: (only on release) Upload artifacts ${{ matrix.os }}
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@master
with:
name: ${{ matrix.os }}
Expand All @@ -74,72 +66,60 @@ jobs:
strategy:
matrix:
node-version: [12.x]
os: [windows-2016, macOS-latest]
os: [windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v1

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install esy
run: |
npm install -g [email protected]

- name: Get esy store path
id: esy_cache_path
shell: bash
run: |
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
if [ "${{ matrix.os }}" == "windows-latest" ]; then
THE_ESY__CACHE_INSTALL_PATH=$HOME/.esy/3_/i
THE_ESY__CACHE_INSTALL_PATH=$( cygpath --mixed --absolute "$THE_ESY__CACHE_INSTALL_PATH")
else
DESIRED_LEN="86"
HOME_ESY3="$HOME/.esy/3"
HOME_ESY3_LEN=${#HOME_ESY3}
NUM_UNDERS=$(echo "$(($DESIRED_LEN-$HOME_ESY3_LEN))")
UNDERS=$(printf "%-${NUM_UNDERS}s" "_")
UNDERS="${UNDERS// /_}"
THE_ESY__CACHE_INSTALL_PATH=${HOME_ESY3}${UNDERS}/i
fi
echo "THE_ESY__CACHE_INSTALL_PATH: $THE_ESY__CACHE_INSTALL_PATH"
echo "##[set-output name=path;]$THE_ESY__CACHE_INSTALL_PATH"
- name: Restore esy cache
uses: actions/cache@v1
- name: Install
run: esy install

- name: Print esy cache
id: print_esy_cache
run: node .github/workflows/print_esy_cache.js

- name: Try to restore dependencies cache
id: deps-cache-macos
uses: actions/cache@v2
with:
path: ${{ steps.esy_cache_path.outputs.path }}
key: v1-esy-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
restore-keys: |
v1-esy-${{ matrix.os }}-
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.os }}-${{ hashFiles('**/index.json') }}

- name: build
run: esy b

# - name: test-native
# run: |
# esy b dune runtest -f
# env:
# CI: true

- name: install
run: |
esy install
- name: test-native
run: |
esy b dune runtest -f
env:
CI: true
- name: test-bucklescript
if: runner.os != 'Windows'
run: |
esy b
cd tests_bucklescript
npm ci --no-optional
npm run test
env:
CI: true

- name: (only on release) Upload artifacts ${{ matrix.os }}
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@master
with:
name: ${{ matrix.os }}
path: _build/default/src/bucklescript_bin/bin.exe

publish:
needs: test_and_build
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
needs: [test_and_build, test_and_build_linux]
name: (only on release) Publish
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -174,12 +154,20 @@ jobs:
if: success()
run: |
mkdir -p bin
mv binaries/darwin/bin.exe bin/graphql_ppx-darwin-x64.exe
mv binaries/windows/bin.exe bin/graphql_ppx-win-x64.exe
mv binaries/linux/bin.exe bin/graphql_ppx-linux-x64.exe
mv binaries/darwin/bin.exe bin/graphql-ppx-darwin-x64.exe
mv binaries/windows/bin.exe bin/graphql-ppx-win-x64.exe
mv binaries/linux/bin.exe bin/graphql-ppx-linux-x64.exe

- name: Publish
if: success() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/')
run: npm publish --tag=next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_JAAP }}

- name: Publish Prerelease
if: success()
run: npm publish
run: |
npm version prerelease -preid $(git rev-parse --short HEAD) -no-git-tag-version
npm publish --tag=dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_JAAP }}
13 changes: 13 additions & 0 deletions .github/workflows/print_esy_cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fs = require("fs");
const os = require("os");
const path = require("path");

const ESY_FOLDER = process.env.ESY__PREFIX
? process.env.ESY__PREFIX
: path.join(os.homedir(), ".esy");
const esy3 = fs
.readdirSync(ESY_FOLDER)
.filter((name) => name.length > 0 && name[0] === "3")
.sort()
.pop();
console.log(`::set-output name=esy_cache::${path.join(ESY_FOLDER, esy3, "i")}`);
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ _release
graphql_ppx.exe
yarn-error.log
/bin
.DS_Store
.bsb.lock
npm-debug.log
/lib
/build/
*.cmi
*.cmj
*.cmt
.vscode
Loading