Skip to content

Commit aebf19b

Browse files
committed
github. use cache and don't generate test coverage
1 parent fc56a5d commit aebf19b

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,25 @@ jobs:
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: "20.x"
26+
- name: Restore cache
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
.next/cache
31+
# Generate a new cache whenever packages or source files change.
32+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
33+
# If source files changed but packages didn't, rebuild from a prior cache.
34+
restore-keys: |
35+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
2636
- name: "Install Deps"
2737
run: npm install
2838
- name: "Build Next.js"
2939
run: npm run build
3040
- name: "Test"
31-
run: npx vitest --coverage.enabled true
32-
- name: "Report Coverage"
33-
# Set if: always() to also generate the report if tests are failing
34-
# Only works if you set `reportOnFailure: true` in your vite config as specified above
35-
if: always()
36-
uses: davelosert/vitest-coverage-report-action@v2
41+
run: npm run test
42+
# run: npx vitest --coverage.enabled true
43+
# - name: "Report Coverage"
44+
# # Set if: always() to also generate the report if tests are failing
45+
# # Only works if you set `reportOnFailure: true` in your vite config as specified above
46+
# if: always()
47+
# uses: davelosert/vitest-coverage-report-action@v2

vitest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export default defineConfig({
99
reporters: process.env.GITHUB_ACTIONS
1010
? ["dot", "github-actions"]
1111
: ["default"],
12+
// coverage: {
13+
// provider: "v8",
14+
// // you can include other reporters, but 'json-summary' is required, json is recommended
15+
// reporter: ["text", "json-summary", "json"],
16+
// // If you want a coverage reports even if your tests are failing, include the reportOnFailure option
17+
// reportOnFailure: true,
18+
// },
1219
},
1320
plugins: [tsconfigPaths()],
1421
});

0 commit comments

Comments
 (0)