From dcf4468c742e27c2aef314ea93daf171534670df Mon Sep 17 00:00:00 2001 From: Joe Pegler Date: Fri, 23 Aug 2024 15:27:36 +0100 Subject: [PATCH] chore: workflow --- .github/workflows/build.yml | 3 ++- .github/workflows/coverage.yml | 6 ++++-- .github/workflows/docs.yml | 4 +++- .github/workflows/playground.yml | 9 ++++++--- .github/workflows/pr-lint.yml | 2 +- .github/workflows/size-report.yml | 2 +- .github/workflows/unit-tests.yml | 9 ++++++--- package.json | 6 ++---- tests/instances/account.test.ts | 14 ++------------ tests/testSetup.ts | 2 +- tests/vitest.config.ts | 6 +++--- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08c18cd34..253b4c93e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,8 @@ jobs: name: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Build uses: ./.github/actions/build diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e70533cad..9267e8bfb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,17 +14,19 @@ jobs: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Install dependencies uses: ./.github/actions/install-dependencies - name: Run the tests - run: bun run test + run: bun run test --coverage env: E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }} BUNDLER_URL: https://api.pimlico.io/v2/84532/rpc?apikey=pim_im13GpaqtMDSiJFhXMxcVn CHAIN_ID: 84532 + CI: true - name: report coverage uses: davelosert/vitest-coverage-report-action@v2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 078b083ba..97b719b6e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,9 @@ jobs: deploy-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - run: git config --global user.email "gh@runner.com" - run: git config --global user.name "gh-runner" diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml index a4aad9beb..fecc38f23 100644 --- a/.github/workflows/playground.yml +++ b/.github/workflows/playground.yml @@ -12,17 +12,20 @@ jobs: group: ${{ github.workflow }}-${{ github.ref }}-playground cancel-in-progress: true steps: - - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: node-version: 22 + - uses: actions/checkout@v4 + - name: Install dependencies uses: ./.github/actions/install-dependencies - - name: Run the account tests - run: RUN_PLAYGROUND=true bun run test:ci -t=Playground + - name: Run the playground + run: bun run test env: E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }} BUNDLER_URL: https://api.pimlico.io/v2/84532/rpc?apikey=pim_im13GpaqtMDSiJFhXMxcVn CHAIN_ID: 84532 + RUN_PLAYGROUND: true + CI: true diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index 3e77f7837..0f591a7c5 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -8,7 +8,7 @@ jobs: name: pr lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies uses: ./.github/actions/install-dependencies diff --git a/.github/workflows/size-report.yml b/.github/workflows/size-report.yml index cb8d4eafc..053e2d8b8 100644 --- a/.github/workflows/size-report.yml +++ b/.github/workflows/size-report.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index afcacfad9..4451c940c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,17 +12,20 @@ jobs: group: ${{ github.workflow }}-${{ github.ref }}-unit-tests cancel-in-progress: true steps: - - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: node-version: 22 + - uses: actions/checkout@v4 + + - name: Install dependencies uses: ./.github/actions/install-dependencies - - name: Run the account tests - run: bun run test:ci + - name: Run the tests + run: bun run test env: E2E_PRIVATE_KEY_ONE: ${{ secrets.E2E_PRIVATE_KEY_ONE }} BUNDLER_URL: https://api.pimlico.io/v2/84532/rpc?apikey=pim_im13GpaqtMDSiJFhXMxcVn CHAIN_ID: 84532 + CI: true diff --git a/package.json b/package.json index 19dfdf4cc..f355382be 100644 --- a/package.json +++ b/package.json @@ -58,12 +58,10 @@ "dev": "bun link && concurrently \"bun run esm:watch\" \"bun run cjs:watch\" \"bun run esm:watch:aliases\" \"bun run cjs:watch:aliases\"", "build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types", "clean": "rimraf ./dist/_esm ./dist/_cjs ./dist/_types ./dist/tsconfig", - "test": "vitest dev -c ./tests/vitest.config.ts", + "test": "vitest -c ./tests/vitest.config.ts", + "test:watch": "bun run test dev", "playground": "RUN_PLAYGROUND=true bun run test -t=Playground", "playground:watch": "RUN_PLAYGROUND=true bun run test -t=Playground --watch", - "test:watch": "bun run test --watch", - "test:coverage": "CI=true vitest -c ./tests/vitest.config.ts --coverage", - "test:ci": "CI=true vitest -c ./tests/vitest.config.ts", "size": "size-limit", "docs": "typedoc --tsconfig ./tsconfig/tsconfig.esm.json", "docs:deploy": "bun run docs && gh-pages -d docs", diff --git a/tests/instances/account.test.ts b/tests/instances/account.test.ts index 3576eef68..3bd060580 100644 --- a/tests/instances/account.test.ts +++ b/tests/instances/account.test.ts @@ -18,12 +18,8 @@ import { killNetwork, toTestClient } from "../test.utils" -import type { - MasterClient, - NetworkConfig, - NetworkConfigWithBundler -} from "../test.utils" -import { type TestFileNetworkType, aaTest, toNetwork } from "../testSetup" +import type { MasterClient, NetworkConfig } from "../test.utils" +import { type TestFileNetworkType, toNetwork } from "../testSetup" const NETWORK_TYPE: TestFileNetworkType = "LOCAL" @@ -106,10 +102,4 @@ describe("account", () => { "0x89028E0fD7Af7F864878e0209118DF6A9229A9Ce" // Recipient smart account ]) }) - - test("should", async () => { - const counterAddress = network.deployment.counterAddress - const byteCode = await testClient.getBytecode({ address: counterAddress }) - expect(byteCode).toBeTruthy() - }) }) diff --git a/tests/testSetup.ts b/tests/testSetup.ts index 2227f0bd0..ce9507bec 100644 --- a/tests/testSetup.ts +++ b/tests/testSetup.ts @@ -10,7 +10,7 @@ export type NetworkConfigWithTestClients = NetworkConfigWithBundler & { fundedTestClients: FundedTestClients } -export const aaTest = test.extend<{ +export const scopedTest = test.extend<{ config: NetworkConfigWithTestClients }>({ // biome-ignore lint/correctness/noEmptyPattern: Needed in vitest :/ diff --git a/tests/vitest.config.ts b/tests/vitest.config.ts index 21b7354d0..20caa78f9 100644 --- a/tests/vitest.config.ts +++ b/tests/vitest.config.ts @@ -4,7 +4,7 @@ import { defineConfig } from "vitest/config" export default defineConfig({ test: { coverage: { - all: true, + all: false, provider: "v8", reporter: process.env.CI ? ["json-summary", "json"] @@ -25,8 +25,8 @@ export default defineConfig({ statements: 80 } }, - include: ["tests/**/*.test.ts"], - globalSetup: [join(__dirname, "./globalSetup.ts")], + include: [join(__dirname, "./tests/**/*.test.ts")], + globalSetup: [join(__dirname, "./tests/globalSetup.ts")], sequence: { concurrent: false },