From e1baf43c80f5cdc631a3fe65b07183116ec5667c Mon Sep 17 00:00:00 2001 From: Michael Heuer Date: Fri, 13 Oct 2023 10:58:02 +0200 Subject: [PATCH] build: improve package.json and adapted workflows --- .github/workflows/contracts-tests.yml | 47 +++++++++++++++++++++++++++ .github/workflows/style-check.yml | 2 +- package.json | 10 +++--- 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/contracts-tests.yml diff --git a/.github/workflows/contracts-tests.yml b/.github/workflows/contracts-tests.yml new file mode 100644 index 00000000..3aa298d2 --- /dev/null +++ b/.github/workflows/contracts-tests.yml @@ -0,0 +1,47 @@ +name: 'Contracts' + +env: + INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} + working-directory: . + +on: + workflow_dispatch: + push: + paths: + - 'contracts/**' + - '.github/workflows/contracts-*.yml' + +jobs: + tests: + runs-on: 'ubuntu-latest' + defaults: + run: + working-directory: ${{env.working-directory}} + steps: + - name: 'Check out the repo' + uses: 'actions/checkout@v3' + + - name: 'Install Node.js' + uses: 'actions/setup-node@v3' + with: + cache: 'yarn' + node-version: 16 + + - name: 'Install general dependencies' + run: 'yarn install' + + - name: 'Install contracts dependencies' + run: 'yarn install' + working-directory: contracts + + - name: 'Lint the contracts' + run: 'yarn lint:sol' + working-directory: contracts + + - name: 'Build the contracts' + run: 'yarn build' + working-directory: contracts + + - name: 'Test the contracts and generate the coverage report' + run: 'yarn coverage' + working-directory: contracts diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml index 1de81867..3b5c4c5d 100644 --- a/.github/workflows/style-check.yml +++ b/.github/workflows/style-check.yml @@ -27,7 +27,7 @@ jobs: run: 'yarn install' - name: 'Lint the code' - run: 'yarn lint:ts' + run: 'yarn lint' - name: 'Check code formatting' run: yarn prettier:check diff --git a/package.json b/package.json index 8eb4c8e2..c01ce5d3 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,10 @@ "typescript": "^5.2.2" }, "scripts": { - "build": "cd ./contracts && yarn build && cd ../subgraph && yarn build", - "test": "cd ./contracts && yarn test && cd ../subgraph && yarn test", - "lint:ts": "eslint --ignore-path ./.eslintignore --ext .js,.ts .", - "clean": "cd ./contracts && yarn clean && yarn clean && cd ../subgraph && yarn clean", + "test": "yarn --cwd ./subgraph test", + "lint": "eslint --ignore-path ./.eslintignore --ext .js,.ts .", + "clean": "yarn clean && yarn --cwd ./subgraph clean", "prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yml}\"", "prettier:write": "prettier --write \"**/*.{js,json,md,sol,ts,yml}\"" - }, - "packageManager": "yarn@3.6.4" + } }