From 0ec16641cb2b2bc8cd40503814193a223bc2790a Mon Sep 17 00:00:00 2001 From: Jakob Helgesson Date: Wed, 1 May 2024 12:57:57 +0200 Subject: [PATCH] Introduce CI/CD for testing --- .github/actions/setup/action.yml | 20 ++++++++ .github/workflows/verify.yml | 49 +++++++++++++++++++ ...state.spec.ts => enstate.disabled-spec.ts} | 0 3 files changed, 69 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/verify.yml rename test/mocks/{enstate.spec.ts => enstate.disabled-spec.ts} (100%) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..a9c1b44 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,20 @@ +name: "Setup dependencies" +description: "Prepare repository and all dependencies" + +runs: + using: "composite" + steps: + - name: Set up pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + cache: 'pnpm' + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 0000000..9bb6f7b --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,49 @@ +name: Verify +on: [push, pull_request] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Lint code + run: pnpm lint + + build: + name: Build + needs: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Build + run: pnpm build + + test: + name: Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Run tests + uses: nick-fields/retry@v2 + with: + timeout_minutes: 20 + max_attempts: 3 + command: pnpm test diff --git a/test/mocks/enstate.spec.ts b/test/mocks/enstate.disabled-spec.ts similarity index 100% rename from test/mocks/enstate.spec.ts rename to test/mocks/enstate.disabled-spec.ts