From d0fc995ad78fbfde800b89911da387b924266cda Mon Sep 17 00:00:00 2001 From: Roland Peelen Date: Fri, 19 Jan 2024 13:50:19 +0100 Subject: [PATCH] :green_heart: - Fix CI Build. --- .github/workflows/pipeline.yml | 117 ++++++--------------------- .github/workflows/print_esy_cache.js | 13 --- Makefile | 18 +++-- yarn.lock | 13 --- 4 files changed, 37 insertions(+), 124 deletions(-) delete mode 100644 .github/workflows/print_esy_cache.js delete mode 100644 yarn.lock diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 202255b4..52dc823f 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -1,18 +1,22 @@ 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.15.0 steps: - uses: actions/checkout@v1 @@ -21,117 +25,44 @@ jobs: 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 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 esy@0.6.12 - - - 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 diff --git a/.github/workflows/print_esy_cache.js b/.github/workflows/print_esy_cache.js deleted file mode 100644 index 570c32ea..00000000 --- a/.github/workflows/print_esy_cache.js +++ /dev/null @@ -1,13 +0,0 @@ -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")}`); diff --git a/Makefile b/Makefile index d2ed7d5a..23839829 100644 --- a/Makefile +++ b/Makefile @@ -23,18 +23,26 @@ 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 - $(DUNE) build - ./tests.sh + 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 '#{self.name}' --ignore-promoted-rules --no-config --profile release-static +.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 diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 9cb21891..00000000 --- a/yarn.lock +++ /dev/null @@ -1,13 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -graphql@^15.5.0: - version "15.8.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38" - integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw== - -rescript@10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/rescript/-/rescript-10.0.1.tgz#5b2da8a8bcfb994bed1eb24820bf10cfb9d8c440" - integrity sha512-XwO1GPDtoEU4H03xQE5bp0/qtSVR6YLaJRPxWKrfFgKc+LI36ODOCie7o9UJfgzQdoMYkkZyiTGZ4N9OQEaiUw==