Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce testing #6

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading