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

Opam #291

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Opam #291

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 27 additions & 97 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,137 +1,67 @@
name: graphql-ppx-pipeline

on: [pull_request, push]
on:
pull_request:
types: [opened, synchronize]

jobs:
test_and_build_linux:
test_and_build:
name: ${{ matrix.os }}/node-${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
node-version:
- 18.x
ocaml-compiler:
- 5.1.0
os: [ubuntu-latest]

container:
image: alexfedoseev/alpine-node-yarn-esy:0.0.4
image: ocaml/opam:alpine-ocaml-5.1-afl

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

- name: Add tar
run: apk add --no-cache tar
- 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
uses: actions/cache@v2
id: deps-cache
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.os }}-${{ hashFiles('**/index.json') }}
restore-keys: |
${{ matrix.os }}-

- name: build
run: esy b

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

- name: snapshot tests
env:
GRAPHQL_CI: true
- name: Install NPM
run: apk add --update nodejs npm

- name: Install Deps
run: |
make install
npm ci --no-optional --ignore-scripts
esy test
esy release-static

- name: (only on release) Upload artifacts ${{ matrix.os }}
uses: actions/upload-artifact@master
with:
name: ${{ matrix.os }}
path: _build/default/src/bin/bin.exe
- name: Build
run: make build

test_and_build:
name: ${{ matrix.os }}/node-${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
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: 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
uses: actions/cache@v2
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.os }}-${{ hashFiles('**/index.json') }}

- name: build
run: esy b
- name: Native Tests
run: make native-tests
env:
CI: true

- name: test-native
run: |
esy b dune runtest -f
- name: Snapshot Tests
run: make snapshot-tests
env:
CI: true

- name: npm ci
if: runner.os != 'Windows'
run: |
npm ci --no-optional
- name: Release Static
env:
GRAPHQL_CI: true
run: make release-static

- name: snaphot tests
if: runner.os != 'Windows'
run: |
esy test

- name: (only on release) Upload artifacts ${{ matrix.os }}
- name: Upload artifacts ${{ matrix.os }} (Only on release)
uses: actions/upload-artifact@master
with:
name: ${{ matrix.os }}
path: _build/default/src/bin/bin.exe

publish:
needs: [test_and_build, test_and_build_linux]
needs: [test_and_build]
name: (only on release) Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12.x"
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- name: Download linux artifacts
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/print_esy_cache.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ npm-debug.log
*.cmt
.vscode
.vim
_opam
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
project_name = graphql_ppx

DUNE = opam exec -- dune

.DEFAULT_GOAL := help

.PHONY: help
help: ## Print this help message
@echo "List of available make commands";
@echo "";
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}';
@echo "";

.PHONY: create-switch
create-switch: ## Create opam switch
opam switch create . 5.1.0 -y --deps-only

.PHONY: init
init: create-switch install ## Configure everything to develop this repository in local

.PHONY: install
install: ## Install development dependencies
opam update
opam install -y . --deps-only --with-test

.PHONY: native-tests
native-tests: ## Run native tests
$(DUNE) runtest -f

.PHONY: snapshot-tests
snapshot-tests: ## Run snapshot tests
./tests.sh

.PHONY: test
test: ## Run tests using yest
make native-tests
make snapshot-tests

.PHONY: build
build: ## Build the project
$(DUNE) build

.PHONY: release-static
release-static: ## Release the project
$(DUNE) build --root . --only-packages ${project_name} --ignore-promoted-rules --no-config --profile release-static

.PHONY: build_verbose
build_verbose: ## Build the project
$(DUNE) build --verbose

.PHONY: clean
clean: ## Clean build artifacts and other generated files
$(DUNE) clean

.PHONY: format
format: ## Format the codebase with ocamlformat
$(DUNE) build @fmt --auto-promote

.PHONY: format-check
format-check: ## Checks if format is correct
$(DUNE) build @fmt

.PHONY: watch
watch: ## Watch for the filesystem and rebuild on every change
$(DUNE) build --promote-install-files --root . --watch


Empty file modified README.md
100755 → 100644
Empty file.
Empty file modified dslToJson.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion dune-project
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(lang dune 2.0)
(lang dune 3.12)

(name graphql_ppx)
2 changes: 1 addition & 1 deletion dune-workspace
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 1.1)
(lang dune 3.12)

(env
(release-static
Expand Down
24 changes: 0 additions & 24 deletions esy.json

This file was deleted.

3 changes: 0 additions & 3 deletions esy.lock/.gitattributes

This file was deleted.

3 changes: 0 additions & 3 deletions esy.lock/.gitignore

This file was deleted.

Loading
Loading