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

GH step to print out coverage on PR (not required to pass until we get there) #3187

Merged
merged 3 commits into from
Mar 12, 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
File renamed without changes.
68 changes: 68 additions & 0 deletions .github/workflows/app_test_state_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "Web app state test coverage"
on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
branch:
- ${{ github.head_ref }}
- "dev"

permissions:
# Required to checkout the code
contents: read

steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: "Install Node"
uses: actions/setup-node@v4
with:
node-version: "20.11.0"
- name: Install
run: |
cd sharedAPI
npm install --legacy-peer-deps
cd ../appv2
npm install
- name: "Test"
env:
MOBILE: false
JEEPSQLITE: 'FALSE'
REDIRECT_URI: ''
IAPP_GEOJSON_URL: ''
REACT_APP_API_HOST: 'http://localhost:3002'
SSO_CLIENT_ID: ''
SSO_REALM: ''
PUBLIC_MAP_URL: ''
CONFIGURATION_SOURCE: 'Provided'
OPENSHIFT_BUILD_COMMIT: ''
SOURCE_GIT_COMMIT: $GITHUB_SHA
run: cd appv2 && npm run state_test_coverage_gh
- name: "Upload Coverage"
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.branch }}
path: coverage

report-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: "Download Coverage Artifacts"
uses: actions/download-artifact@v4
with:
name: coverage-${{ github.head_ref }}
path: coverage
- uses: actions/download-artifact@v4
with:
name: coverage-main
path: coverage-main
- name: "Report Coverage"
uses: davelosert/vitest-coverage-report-action@v2
with:
json-summary-compare-path: coverage-main/coverage-summary.json
71 changes: 71 additions & 0 deletions appv2/package-lock.json

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

5 changes: 4 additions & 1 deletion appv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"mui-file-dropzone": "^4.0.2",
"node-ts-uuid": "^2.0.5",
"npm": "^10.4.0",
"openapi-sampler": "^1.4.0",
"p-queue": "^7.1.0",
"pmtiles": "^2.7.2",
"proj4": "^2.8.0",
Expand Down Expand Up @@ -137,7 +138,6 @@
"urlencode": "^2.0.0",
"uuid": "^9.0.1",
"vitest": "^1.3.1",
"openapi-sampler": "^1.4.0",
"wkt": "^0.1.1"
},
"devDependencies": {
Expand All @@ -159,6 +159,7 @@
"@types/redux-logger": "^3.0.13",
"@types/uuid": "^8.3.0",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^1.3.1",
"@welldone-software/why-did-you-render": "^7.0.1",
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
Expand Down Expand Up @@ -188,6 +189,8 @@
"build:android": "CONFIGURATION_SOURCE=Provided MOBILE=TRUE vite build",
"build:ios": "CONFIGURATION_SOURCE=Provided MOBILE=TRUE vite build",
"test": "CONFIGURATION_SOURCE=Provided vitest --config vitest.config.ts",
"state_test_coverage": "CONFIGURATION_SOURCE=Provided vitest run --coverage --coverage.include=state/**/*.ts --config vitest.config.ts",
"state_test_coverage_gh": "CONFIGURATION_SOURCE=Provided vitest run --coverage --coverage.include=state/**/*.ts --coverage.reporter=json-summary --coverage.reporter=json --config vitest.config.ts",
"lint:fix": "npm run lint -- --fix",
"start": "CONFIGURATION_SOURCE=Provided vite serve --port 3000 --strictPort",
"start:jeep": "CONFIGURATION_SOURCE=Provided JEEPSQLITE=TRUE vite serve --port 3000 --strictPort",
Expand Down
7 changes: 6 additions & 1 deletion appv2/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export default defineConfig((configEnv) =>
viteConfig,
defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'json-summary', 'json'],
reportOnFailure: true,
},
exclude: ['packages/template/*'],
setupFiles: ['./src/setupTests.ts'],
deps: {
Expand All @@ -16,7 +21,7 @@ export default defineConfig((configEnv) =>
include: ['openapi-sampler']
}
}
}
},
},
define: { CONFIGURATION_TEST: true }
})
Expand Down
Loading