diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml index 7addece4a..a3ec992e3 100644 --- a/.github/workflows/core.yaml +++ b/.github/workflows/core.yaml @@ -7,6 +7,8 @@ on: paths: - "core/**" pull_request: + paths: + - "core/**" defaults: run: @@ -18,18 +20,31 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Node + - name: Set up Node in root + uses: actions/setup-node@v4 + with: + node-version-file: "./.nvmrc" + cache: "yarn" + cache-dependency-path: "./yarn.lock" + + - name: Install Dependencies in root + run: cd .. && yarn install --prefer-offline --frozen-lockfile + + - name: Set up Node in core package uses: actions/setup-node@v4 with: node-version-file: "core/.nvmrc" cache: "yarn" cache-dependency-path: "core/yarn.lock" - - name: Install Dependencies + - name: Install Dependencies in core package run: yarn install --prefer-offline --frozen-lockfile + - name: Make the script file executable + run: cd .. && chmod +x lint.sh + - name: Format - run: yarn format + run: cd .. && yarn format -w core core-build: runs-on: ubuntu-latest diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml new file mode 100644 index 000000000..101a64f75 --- /dev/null +++ b/.github/workflows/website.yaml @@ -0,0 +1,47 @@ +name: Website + +on: + push: + branches: + - main + paths: + - "website/**" + pull_request: + paths: + - "website/**" + +defaults: + run: + working-directory: ./website + +jobs: + core-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Node in root + uses: actions/setup-node@v4 + with: + node-version-file: "./.nvmrc" + cache: "yarn" + cache-dependency-path: "./yarn.lock" + + - name: Install Dependencies in root + run: cd .. && yarn install --prefer-offline --frozen-lockfile + + - name: Set up Node in website package + uses: actions/setup-node@v4 + with: + node-version-file: "website/.nvmrc" + cache: "yarn" + cache-dependency-path: "website/yarn.lock" + + - name: Install Dependencies in website package + run: yarn install --prefer-offline --frozen-lockfile + + - name: Make the script file executable + run: cd .. && chmod +x lint.sh + + - name: Format + run: cd .. && yarn format -w website diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..9de225682 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/iron diff --git a/lint.sh b/lint.sh index 60f94544b..bd23a91ce 100755 --- a/lint.sh +++ b/lint.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -euo pipefail # Defaults, can be overwritten by input parameters. diff --git a/package.json b/package.json index 2b7d9115b..c9f9b665f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "license": "MIT", "private": true, "scripts": { + "format": "./lint.sh", + "format:fix": "npm run format -- -f", "lint:js": "./lint.sh -t js", "lint:js:fix": "npm run lint:js -- -f", "lint:config": "./lint.sh -t config",