Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 57bc537

Browse files
authored
ci: configure Codecov (#1272)
Closes #1263. ### Summary of Changes Upload test coverage reports to Codecov.
1 parent 23389d2 commit 57bc537

File tree

4 files changed

+106
-18
lines changed

4 files changed

+106
-18
lines changed

.github/workflows/main.yml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,25 @@ jobs:
4040
uses: gradle/wrapper-validation-action@v1
4141

4242
- name: Build with Gradle
43-
run: ./gradlew build
43+
run: ./gradlew build koverMergedXmlReport
4444
working-directory: ./api-editor
4545

46+
- name: Upload test report
47+
if: ${{ failure() }}
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: backend test report
51+
path: api-editor/backend/build/reports
52+
if-no-files-found: ignore
53+
54+
- name: Upload coverage to Codecov
55+
if: ${{ github.actor != 'dependabot[bot]' }}
56+
uses: codecov/codecov-action@v3
57+
with:
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
directory: api-editor/build/reports/kover/merged/xml
60+
files: report.xml
61+
4662
- name: Install dependencies
4763
run: npm ci
4864

@@ -51,6 +67,40 @@ jobs:
5167
env:
5268
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5369

70+
gui-test-coverage:
71+
runs-on: ubuntu-latest
72+
defaults:
73+
run:
74+
working-directory: ./api-editor/gui
75+
76+
strategy:
77+
matrix:
78+
node-version: [ 18.x ]
79+
80+
steps:
81+
- name: Checkout source
82+
uses: actions/checkout@v3
83+
84+
- name: Use Node.js ${{ matrix.node-version }}
85+
uses: actions/setup-node@v3
86+
with:
87+
node-version: ${{ matrix.node-version }}
88+
cache: npm
89+
cache-dependency-path: api-editor/gui/package-lock.json
90+
91+
- name: Install dependencies
92+
run: npm ci
93+
94+
- name: Test with Jest
95+
run: npm run test-with-coverage
96+
97+
- name: Upload coverage to Codecov
98+
if: ${{ github.actor != 'dependabot[bot]' }}
99+
uses: codecov/codecov-action@v3
100+
with:
101+
token: ${{ secrets.CODECOV_TOKEN }}
102+
directory: api-editor/gui/coverage
103+
files: clover.xml
54104

55105
build-package-parser:
56106
runs-on: ubuntu-latest
@@ -104,5 +154,14 @@ jobs:
104154
- name: Smoke test (migration)
105155
run: poetry run parse-package migrate -a1 tests/data/migration/apiv1_data.json -a2 tests/data/migration/apiv2_data.json -a tests/data/migration/annotationv1.json -o out
106156

157+
# Requires installation of pytest and pytest-cov
107158
- name: Test with pytest
108-
run: poetry run pytest --doctest-modules
159+
run: poetry run pytest --doctest-modules --cov=package_parser --cov-report=xml
160+
161+
- name: Upload coverage to Codecov
162+
if: ${{ github.actor != 'dependabot[bot]' }}
163+
uses: codecov/codecov-action@v3
164+
with:
165+
token: ${{ secrets.CODECOV_TOKEN }}
166+
directory: package-parser
167+
files: coverage.xml

.github/workflows/pr.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: gradle/wrapper-validation-action@v1
4444

4545
- name: Build with Gradle
46-
run: ./gradlew build backend:koverHtmlReport
46+
run: ./gradlew build koverMergedXmlReport
4747

4848
- name: Upload test report
4949
if: ${{ failure() }}
@@ -53,12 +53,13 @@ jobs:
5353
path: api-editor/backend/build/reports
5454
if-no-files-found: ignore
5555

56-
- name: Upload test coverage
56+
- name: Upload coverage to Codecov
5757
if: ${{ github.actor != 'dependabot[bot]' }}
58-
uses: actions/upload-artifact@v3
58+
uses: codecov/codecov-action@v3
5959
with:
60-
name: backend test coverage
61-
path: api-editor/backend/build/reports/kover/html/
60+
token: ${{ secrets.CODECOV_TOKEN }}
61+
directory: api-editor/build/reports/kover/merged/xml
62+
files: report.xml
6263

6364
gui-test-coverage:
6465
runs-on: ubuntu-latest
@@ -87,12 +88,13 @@ jobs:
8788
- name: Test with Jest
8889
run: npm run test-with-coverage
8990

90-
- name: Upload test report
91+
- name: Upload coverage to Codecov
9192
if: ${{ github.actor != 'dependabot[bot]' }}
92-
uses: actions/upload-artifact@v3
93+
uses: codecov/codecov-action@v3
9394
with:
94-
name: gui test coverage
95-
path: api-editor/gui/coverage/lcov-report
95+
token: ${{ secrets.CODECOV_TOKEN }}
96+
directory: api-editor/gui/coverage
97+
files: clover.xml
9698

9799
build-package-parser:
98100
runs-on: ubuntu-latest
@@ -145,11 +147,12 @@ jobs:
145147

146148
# Requires installation of pytest and pytest-cov
147149
- name: Test with pytest
148-
run: poetry run pytest --doctest-modules --cov=package_parser --cov-report=html
150+
run: poetry run pytest --doctest-modules --cov=package_parser --cov-report=xml
149151

150-
- name: Upload test coverage
152+
- name: Upload coverage to Codecov
151153
if: ${{ github.actor != 'dependabot[bot]' }}
152-
uses: actions/upload-artifact@v3
154+
uses: codecov/codecov-action@v3
153155
with:
154-
name: package-parser test coverage
155-
path: package-parser/htmlcov
156+
token: ${{ secrets.CODECOV_TOKEN }}
157+
directory: package-parser
158+
files: coverage.xml

api-editor/gui/src/features/externalLinks/urlBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const baseURL = 'https://github.com/lars-reimann/api-editor';
55

66
// Documentation
77

8-
const documentationBaseURL = `${baseURL}/blob/main/docs`;
8+
const documentationBaseURL = `https://api-editor.readthedocs.io/en/latest`;
99

10-
export const userGuideURL = `${documentationBaseURL}/api-editor.md`;
10+
export const userGuideURL = `${documentationBaseURL}/gui`;
1111

1212
// Issues
1313

codecov.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
codecov:
2+
notify:
3+
after_n_builds: 3
4+
5+
comment:
6+
after_n_builds: 3
7+
layout: 'header, diff, flags, components, files'
8+
9+
component_management:
10+
individual_components:
11+
- component_id: module_backend
12+
name: backend
13+
paths:
14+
- api-editor/backend/**
15+
- component_id: module_desktop
16+
name: desktop
17+
paths:
18+
- api-editor/desktop/**
19+
- component_id: module_gui
20+
name: gui
21+
paths:
22+
- api-editor/gui/**
23+
- component_id: module_package-parser
24+
name: package-parser
25+
paths:
26+
- package-parser/**

0 commit comments

Comments
 (0)