From a8b7cda706a6a6a46108094ce1bc4afa3a985c5a Mon Sep 17 00:00:00 2001 From: sleepyfran Date: Thu, 25 Jul 2024 23:49:06 +0200 Subject: [PATCH] Add CI on push/PR --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ .husky/pre-commit | 2 +- package.json | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..11d36b5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: Lint, format, build + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x, 21.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + - run: yarn + - run: yarn ci diff --git a/.husky/pre-commit b/.husky/pre-commit index d11a0f3..a66ac16 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn typecheck && yarn lint && yarn format \ No newline at end of file +yarn format \ No newline at end of file diff --git a/package.json b/package.json index b6c8578..63b2fc7 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { + "ci": "yarn typecheck && yarn lint && yarn format", "dev": "yarn workspace @echo/web vite", "build": "yarn workspace @echo/web tsc && vite build", "format": "prettier --check \"packages/**/*.{ts, tsx}\"",