Skip to content

Commit 487251e

Browse files
Shinigami92demipel8
authored andcommitted
ci: configure codecov (faker-js#426)
1 parent aaccfc3 commit 487251e

File tree

6 files changed

+64
-1
lines changed

6 files changed

+64
-1
lines changed

.github/.codecov.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
comment:
2+
layout: 'diff, flags, files'
3+
behavior: default
4+
require_changes: false
5+
require_base: false
6+
require_head: true

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,40 @@ jobs:
9595

9696
- name: Check formatting
9797
run: pnpm prettier --check .
98+
99+
codecov:
100+
runs-on: ubuntu-latest
101+
name: 'Codecov: node-16, ubuntu-latest'
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v2
105+
with:
106+
fetch-depth: 0
107+
108+
- name: Install pnpm
109+
uses: pnpm/action-setup@v2
110+
with:
111+
version: 6
112+
113+
- name: Set node version to 16
114+
uses: actions/setup-node@v2
115+
with:
116+
node-version: 16
117+
cache: 'pnpm'
118+
119+
- name: Install deps
120+
run: pnpm install
121+
env:
122+
CYPRESS_INSTALL_BINARY: 0
123+
124+
- name: Build
125+
run: pnpm run build
126+
127+
- name: Generate coverage report
128+
run: pnpm vitest run --coverage
129+
130+
- name: Upload coverage to Codecov
131+
uses: codecov/[email protected]
132+
with:
133+
directory: ./coverage
134+
fail_ci_if_error: true

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
44
"editorconfig.editorconfig",
5-
"esbenp.prettier-vscode"
5+
"esbenp.prettier-vscode",
6+
"redhat.vscode-yaml"
67
]
78
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77

88
"files.associations": {
99
"*.json5": "jsonc"
10+
},
11+
12+
"yaml.schemas": {
13+
"https://json.schemastore.org/codecov.json": ".github/.codecov.yml"
1014
}
1115
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
[![Chat on Discord](https://img.shields.io/discord/929487054990110771)](https://chat.fakerjs.dev)
77
[![Continuous Integration](https://github.com/faker-js/faker/actions/workflows/ci.yml/badge.svg)](https://github.com/faker-js/faker/actions/workflows/ci.yml)
8+
[![codecov](https://codecov.io/gh/faker-js/faker/branch/main/graph/badge.svg?token=N61U168G08)](https://codecov.io/gh/faker-js/faker)
89
[![npm version](https://badgen.net/npm/v/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker)
910
[![npm downloads](https://badgen.net/npm/dm/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker)
1011
[![Open Collective](https://img.shields.io/opencollective/backers/fakerjs)](https://opencollective.com/fakerjs#section-contributors)

vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference types="vitest" />
2+
import { defineConfig } from 'vite';
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
test: {
7+
coverage: {
8+
all: true,
9+
reporter: ['clover', 'cobertura', 'lcov', 'text'],
10+
// TODO christopher 2022-02-04: Later we want to test `src` instead of `dist/cjs`
11+
include: ['dist/cjs'],
12+
},
13+
},
14+
});

0 commit comments

Comments
 (0)