Skip to content

Commit

Permalink
update github action builds (#3)
Browse files Browse the repository at this point in the history
* update github action builds

* .

* .

* .

* .
  • Loading branch information
ldeveber authored May 26, 2024
1 parent 004ca69 commit 73a3017
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ jobs:
cache: "npm"
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
path: dist/*
# TODO FIXME
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Build
on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Node.js
Expand All @@ -16,5 +16,6 @@ jobs:
node-version-file: ".nvmrc"
cache: "npm"
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
23 changes: 23 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Report Coverage

on:
workflow_run:
workflows: ["Test"]
types:
- completed

jobs:
report:
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: "Report Coverage"
uses: davelosert/vitest-coverage-report-action@v2
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
- name: "Upload Coverage"
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
139 changes: 139 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"wss": "node utils/reload/initReloadServer.js",
"dev": "concurrently -p \"[{name}]\" --names \"build,test\" -c \"blue.bold,yellow.bold\" \"npm run dev:watch\" \"npm run test:watch\"",
"dev:watch": "npm run build:hmr && (run-p wss build:watch)",
"dev:watch:firefox": "npm run build:hmr && (run-p wss build:firefox:watch)",
"test": "vitest run",
"test:watch": "vitest watch",
"lint": "tsc --noEmit && ESLINT_USE_FLAT_CONFIG=true eslint . --format stylish && prettier . --check",
Expand Down Expand Up @@ -45,6 +44,7 @@
"@types/react-dom": "^18.3.0",
"@types/ws": "^8.5.10",
"@vitejs/plugin-react": "^4.3.0",
"@vitest/coverage-v8": "^1.6.0",
"chokidar": "^3.6.0",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
Expand Down
13 changes: 13 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ export default defineConfig({
alias: {
"test-utils": testUtilsDir,
},
coverage: {
enabled: true,
provider: "v8",
reporter: ["text", "json", "json-summary", "html"],
reportOnFailure: true,
include: ["src/**/*.ts", "src/**/*.tsx"],
thresholds: {
lines: 25,
functions: 25,
branches: 65,
statements: 25,
},
},
globals: true,
environment: "jsdom",
include: ["**/*.test.ts", "**/*.test.tsx"],
Expand Down

0 comments on commit 73a3017

Please sign in to comment.