Skip to content

Commit

Permalink
ci: upload coverage for ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Jun 1, 2024
1 parent 0d6b183 commit 9839089
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 20 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,68 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

tests_ui:
name: Tests on UI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21'

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
standalone: true
package_json_file: 'ui/package.json'
version: latest

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
working-directory: ./ui
run: pnpm install

- name: Run tests
working-directory: ./ui
run: pnpm test:ui

- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ui
name: Web UI tests
directory: ./ui
verbose: true

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: Web UI tests
flags: ui
file: ./ui/test-results.xml
verbose: true

tests:
name: Tests
needs: build-ui
Expand Down
3 changes: 2 additions & 1 deletion ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ dist-ssr
data.json
gsa.wasm

coverage/
coverage/
test-results.xml
8 changes: 6 additions & 2 deletions ui/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function build(dir: string): BuildOptions {
export function testConfig(): InlineConfig {
return {
coverage: {
provider: "v8",
provider: "istanbul",
enabled: true,
exclude: [
"node_modules",
Expand All @@ -88,7 +88,11 @@ export function testConfig(): InlineConfig {
"common.ts",
"src/tool/wasm_exec.js",
"src/schema/schema.ts",
]
],
},
reporters: ["junit", "default", "github-actions"],
outputFile: {
"junit": "test-results.xml",
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"dev:explorer": "vite -c vite.config-explorer.ts",
"generate": "typia generate --input src/schema --output src/generated --project tsconfig.json",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"test:ui": "vitest -c vite.config.ts",
"test:explorer": "vitest -c vite.config-explorer.ts"
"test:ui": "vitest run -c vite.config.ts",
"test:explorer": "vitest run -c vite.config-explorer.ts"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand Down Expand Up @@ -41,12 +41,13 @@
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/coverage-istanbul": "^1.6.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"jsdom": "^24.1.0",
"junit": "^1.4.9",
"sass": "^1.77.2",
"terser": "^5.31.0",
"typescript": "^5.4.5",
Expand Down
Loading

0 comments on commit 9839089

Please sign in to comment.