From b536d26d378599bb2e2fbcbf707aa8136cd1d543 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:16:48 +0100 Subject: [PATCH] ci: split tests and example tests --- .github/workflows/run-cbtc-unit-tests.yml | 29 +++++++++++++++++++++++ .github/workflows/run-unit-tests.js.yml | 3 +-- package.json | 2 +- vitest.config.js | 6 ++++- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/run-cbtc-unit-tests.yml diff --git a/.github/workflows/run-cbtc-unit-tests.yml b/.github/workflows/run-cbtc-unit-tests.yml new file mode 100644 index 0000000..58cf601 --- /dev/null +++ b/.github/workflows/run-cbtc-unit-tests.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Contracts unit tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - working-directory: ./example/cbtc + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm test diff --git a/.github/workflows/run-unit-tests.js.yml b/.github/workflows/run-unit-tests.js.yml index 3df3522..b085df4 100644 --- a/.github/workflows/run-unit-tests.js.yml +++ b/.github/workflows/run-unit-tests.js.yml @@ -12,11 +12,10 @@ on: jobs: build: runs-on: ubuntu-latest - + strategy: matrix: node-version: [18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v3 diff --git a/package.json b/package.json index bc05fcc..2d16d72 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "test": "vitest run", "test:watch": "chokidar \"tests/**/*.ts\" \"contracts/**/*.clar\" -c \"npm run test:coverage\"", - "test:coverage": "vitest run -- --coverage true", + "test:coverage": "vitest run -- --coverage", "format": "prettier ./unit-tests --write" }, "author": "", diff --git a/vitest.config.js b/vitest.config.js index b8db51a..a5d2ab5 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,8 +1,12 @@ import { defineConfig } from "vite"; -import { vitestSetupFilePath, getClarinetVitestsArgv } from "@hirosystems/clarinet-sdk/vitest"; +import { + vitestSetupFilePath, + getClarinetVitestsArgv, +} from "@hirosystems/clarinet-sdk/vitest"; export default defineConfig({ test: { + include: ["./unit-tests/**/*.test.ts"], environment: "clarinet", singleThread: true, setupFiles: [vitestSetupFilePath],