From 3c1177539c1a216084f922ea52e56dd719a25945 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Thu, 27 Feb 2025 14:47:10 +0330 Subject: [PATCH] ci: update test workflow Signed-off-by: Ardalan Amini --- .github/dependabot.yml | 2 +- .github/workflows/test.yml | 72 ++++++++++++++++++++++++++++++-------- package.json | 2 +- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f1b8caf..8822227 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,6 +21,6 @@ updates: day : monday versioning-strategy: increase commit-message : - prefix : build(deps) + prefix: build(deps) reviewers : - ardalanamini diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 505385e..0abf587 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on : # rebuild any PRs and main branch changes workflow_call: jobs: - build : # make sure build/ci work properly + build : # make sure build/ci work properly name : Build runs-on: ubuntu-latest @@ -19,7 +19,35 @@ jobs: - name: Use PNPM uses: pnpm/action-setup@v4 with: - version: 8 + version: 10 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + cache : pnpm + node-version: 20 + + - name: Install dependencies + run : pnpm i + + - name: Build using TypeScript + run : pnpm build + + - name: Package using ncc + run : pnpm package + + lint : # make sure build/ci work properly + name : Lint + + runs-on: ubuntu-latest + + steps : + - uses: actions/checkout@v4 + + - name: Use PNPM + uses: pnpm/action-setup@v4 + with: + version: 10 - name: Use Node.js 20 uses: actions/setup-node@v4 @@ -33,20 +61,36 @@ jobs: - name: Check code styles run : pnpm lint - - name: Run unit tests - run : pnpm test - - - name: Build using TypeScript - run : pnpm build - - - name: Package using ncc - run : pnpm package - - test : # make sure the action works on a clean machine without building + test : # make sure build/ci work properly name : Test runs-on: ubuntu-latest + steps : + - uses: actions/checkout@v4 + + - name: Use PNPM + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + cache : pnpm + node-version: 20 + + - name: Install dependencies + run : pnpm i + + - name: Run unit tests + run : pnpm test:coverage + + live-test : # make sure the action works on a clean machine without building + name : Live Test + + runs-on: ubuntu-latest + steps : - uses: actions/checkout@v4 @@ -56,8 +100,8 @@ jobs: semver : ${{ startsWith(github.ref, 'refs/tags/') }} mention-new-contributors: ${{ github.ref_protected }} - test-with-inputs: # make sure the action works on a clean machine without building - name : Test with inputs + live-test-with-inputs: # make sure the action works on a clean machine without building + name : Live Test with inputs runs-on: ubuntu-latest diff --git a/package.json b/package.json index 28d2235..508c179 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "package": "ncc build --out action --minify --source-map --license licenses.txt", "all": "pnpm lint:fix && pnpm build && pnpm package", "test": "node --expose-gc node_modules/jest/bin/jest -c jest.config.ts", - "test:coverage": "pnpm test -- --coverage" + "test:coverage": "pnpm test --coverage" }, "dependencies": { "@actions/core": "^1.11.1",