Skip to content

Commit

Permalink
Introduce testing (#6)
Browse files Browse the repository at this point in the history
* Introduce testing

* Disable mock tests until further time

* Introduce CI/CD for testing

* Only run CI/CD once per commit

* Only run CI/CD on push
  • Loading branch information
svemat01 authored May 2, 2024
1 parent 1b62b0c commit f62d9b2
Show file tree
Hide file tree
Showing 17 changed files with 2,210 additions and 33 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Verify
on: push

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

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
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "vitest",
"build": "tsup",
"lint": "eslint -c .eslintrc.json --ext .ts ./src",
"pub": "yarn build && yarn publish --access public"
Expand All @@ -50,15 +50,26 @@
"author": "",
"license": "LGPL-3.0",
"peerDependencies": {
"react": "^18.2.0",
"swr": "^2"
},
"devDependencies": {
"@swc/core": "^1.3.67",
"@testing-library/react": "^15.0.2",
"@types/eventsource": "^1.1.15",
"@types/react": "^18.2.79",
"@typescript-eslint/parser": "^5.61.0",
"@vitest/ui": "^1.5.0",
"eslint": "^8.44.0",
"eslint-plugin-v3xlabs": "^1.6.1",
"eventsource": "^2.0.2",
"happy-dom": "^14.7.1",
"jsdom": "^24.0.0",
"msw": "^2.2.14",
"react": "^18.2.0",
"swr": "^2",
"tsup": "^7.1.0",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"vitest": "^1.5.0"
}
}
Loading

0 comments on commit f62d9b2

Please sign in to comment.