Skip to content

Commit 3b68673

Browse files
committed
chore: setup unittest github action
1 parent 14990fc commit 3b68673

File tree

5 files changed

+69
-37
lines changed

5 files changed

+69
-37
lines changed

.github/codecov.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
codecov:
2+
branch: main
3+
coverage:
4+
round: down
5+
precision: 2
6+
flag_management:
7+
default_rules:
8+
carryforward: true
9+
statuses:
10+
- type: project
11+
target: 90%
12+
- type: patch
13+
target: 100%

.github/workflows/tests.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'src/**'
8+
- 'tests/**'
9+
- '.github/workflows/tests.yaml'
10+
pull_request:
11+
workflow_dispatch:
12+
13+
env:
14+
CI: true
15+
jobs:
16+
Test:
17+
if: github.repository == 'vnphanquang/phosphor-icons-tailwindcss' # prevents this action from running on forks
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
timeout-minutes: 5
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup pnpm
30+
uses: pnpm/action-setup@v4
31+
32+
- name: Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: pnpm
37+
38+
- name: Lint
39+
run: 'pnpm lint'
40+
41+
- name: Run Tests
42+
run: 'pnpm ci:test'
43+
44+
- name: Upload to Codecov
45+
uses: codecov/codecov-action@v4
46+
with:
47+
os: ${{ matrix.os }}
48+
files: ./coverage/lcov.info
49+
fail_ci_if_error: true
50+
flags: unittests, ${{ matrix.os }}
51+
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
A [TailwindCSS] plugin for the [Phosphor icon set][phosphor].
66

7-
[![MIT][license.badge]][license] [![npm.badge]][npm]
7+
[![MIT][license.badge]][license] [![npm.badge]][npm] [![codecov][codecov.badge]][codecov]
88

99
## Installation
1010

@@ -188,3 +188,6 @@ are already using the [iconify](https://iconify.design/) ecosystem in your codeb
188188
[license]: ./LICENSE
189189
[npm.badge]: https://img.shields.io/npm/v/phosphor-icons-tailwindcss
190190
[npm]: https://www.npmjs.com/package/phosphor-icons-tailwindcss
191+
[codecov]: https://codecov.io/github/vnphanquang/phosphor-icons-tailwindcss
192+
[codecov.badge]: https://codecov.io/github/vnphanquang/phosphor-icons-tailwindcss/graph/badge.svg?token=dKkYUy4evr
193+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"scripts": {
4444
"prepublishOnly": "publint",
45+
"lint": "eslint src/**/*",
4546
"test": "vitest --coverage",
4647
"ci:test": "vitest run --coverage",
4748
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
@@ -60,7 +61,6 @@
6061
"@tailwindcss/node": "4.0.0-alpha.36",
6162
"@types/node": "^22.9.0",
6263
"@vitest/coverage-istanbul": "2.1.5",
63-
"@vitest/coverage-v8": "^2.1.5",
6464
"@vitest/ui": "^2.1.5",
6565
"@vnphanquang/eslint-config": "^3.0.0",
6666
"eslint": "^9.14.0",

pnpm-lock.yaml

Lines changed: 0 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)