From 21c35ee5934e99a0f88af1a3d9f746eec2d4849d Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 2 Nov 2023 11:08:19 -0500 Subject: [PATCH] ci: Separate validation into multiple jobs (#203) --- .github/actions/setup/action.yml | 17 +++ .github/workflows/release.yml | 17 +-- .github/workflows/validate.yml | 183 ++++++++++--------------------- demo/package.json | 4 +- 4 files changed, 77 insertions(+), 144 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..46d066f5 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,17 @@ +name: Basic Setup +description: Install PNPM, Node, and dependencies +runs: + using: composite + steps: + - name: Setup PNPM + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: pnpm + - name: Install Dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52865dcb..ac4472eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,24 +11,11 @@ jobs: needs: - validate steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup PNPM - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Setup NodeJS - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install + - uses: ./.github/actions/setup - name: Bump and Tag run: | diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 823ec872..5df5e4a8 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -7,141 +7,70 @@ on: - main jobs: - checks: - name: Checks + formatting: runs-on: ubuntu-22.04 steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Setup NodeJS - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Formatting - run: pnpm format:check - - - name: Type Check - run: pnpm compile - - - name: Build Demo - run: | - pnpm build:all:chrome-mv2 - pnpm build:all:chrome-mv3 - pnpm build:all:firefox-mv2 - pnpm build:all:firefox-mv3 - pnpm tsc --noEmit - pnpm wxt zip - pnpm vitest run + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: pnpm format:check + type-check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: pnpm compile + validate-demo: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: pnpm build:all working-directory: demo - - - name: Tests + - run: pnpm tsc --noEmit + working-directory: demo + - run: pnpm wxt zip + working-directory: demo + - run: pnpm vitest run + working-directory: demo + tests: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - name: pnpm test:coverage run: pnpm test:coverage --reporter=default --reporter=hanging-process - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + - uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - windows-tests: - name: Windows Tests runs-on: windows-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Setup NodeJS - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Tests - run: pnpm test:coverage --reporter=default --reporter=hanging-process - - project-templates: - name: Project Templates + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: pnpm test run + template: runs-on: ubuntu-22.04 + strategy: + matrix: + template: + - react + - solid + - svelte + - vanilla + - vue steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup PNPM - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Setup NodeJS - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build Local Tarball - run: pnpm pack - - - name: Validate Vanilla - working-directory: templates/vanilla - run: | - npm i - npm i -D ../../wxt-*.tgz - npm ls vite - npm run build - npm run compile - - - name: Validate Vue - working-directory: templates/vue - run: | - npm i - npm i -D ../../wxt-*.tgz - npm ls vite - npm run build - npm run compile - - - name: Validate React - working-directory: templates/react - run: | - npm i - npm i -D ../../wxt-*.tgz - npm ls vite - npm run build - npm run compile - - - name: Validate Svelte - working-directory: templates/svelte - run: | - npm i - npm i -D ../../wxt-*.tgz - npm ls vite - npm run build - npm run check - - - name: Validate Solid - working-directory: templates/solid - run: | - npm i - npm i -D ../../wxt-*.tgz - npm ls vite - npm run build - npm run compile + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup + - run: pnpm pack + - run: npm i + working-directory: templates/${{ matrix.template }} + - run: npm i -D ../../wxt-*.tgz + working-directory: templates/${{ matrix.template }} + - run: npm run compile + if: matrix.template != 'svelte' + working-directory: templates/${{ matrix.template }} + - run: npm run check + if: matrix.template == 'svelte' + working-directory: templates/${{ matrix.template }} + - run: npm run build + working-directory: templates/${{ matrix.template }} diff --git a/demo/package.json b/demo/package.json index 0a19309b..7ba78c26 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,12 +1,12 @@ { - "name": "WXT Demo", + "name": "demo", "version": "1.0.0", "description": "Demo extension for WXT", "type": "module", "scripts": { "dev": "pnpm -w build && wxt", "build": "pnpm -w build && wxt build", - "build:all": "pnpm -w build && run-s -s build:all:*", + "build:all": "pnpm -w build && run-s -s 'build:all:*'", "build:all:chrome-mv3": "wxt build", "build:all:chrome-mv2": "wxt build --mv2", "build:all:firefox-mv3": "wxt build -b firefox --mv3",