Skip to content

Commit d728579

Browse files
authored
ci: use codecov (#1144)
1 parent 4c8e724 commit d728579

File tree

4 files changed

+79
-30
lines changed

4 files changed

+79
-30
lines changed

.github/actions/node-setup/action.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Workflow / Setup NodeJS
2+
description: It setting up the NodeJS
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Enable Corepack
8+
run: corepack enable
9+
shell: bash
10+
11+
- name: Setup NodeJS
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version-file: '.nvmrc'
15+
cache: 'yarn'
16+
17+
- name: Install dependencies
18+
run: YARN_ENABLE_SCRIPTS=false YARN_ENABLE_HARDENED_MODE=0 yarn install --immutable
19+
shell: bash

.github/workflows/coverage.yml

-22
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Reusable workflow / Unit tests'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: 'The branch, tag or SHA to checkout'
8+
default: ${{ github.ref }}
9+
required: false
10+
type: string
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
name: Run unit tests
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
ref: ${{ inputs.ref }}
20+
21+
- name: Node setup
22+
uses: ./.github/actions/node-setup
23+
24+
- name: Run tests
25+
run: yarn run test:ci
26+
27+
- name: Upload test artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: test-output
31+
path: |
32+
junit.xml
33+
34+
deploy_test_coverage:
35+
needs: test
36+
runs-on: ubuntu-latest
37+
permissions:
38+
id-token: write
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Download test artifact
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: test-output
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v5
50+
with:
51+
use_oidc: true
52+
files: junit.xml
53+
fail_ci_if_error: true

.github/workflows/test.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- master
77
pull_request:
88

9+
concurrency:
10+
group: test-${{ github.ref_name }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
lint:
1115
runs-on: ubuntu-latest
@@ -16,15 +20,10 @@ jobs:
1620
node-version: '18'
1721
- run: yarn install --frozen-lockfile --ignore-scripts
1822
- run: npm run lint
23+
1924
test:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-node@v4
24-
with:
25-
node-version: '18'
26-
- run: yarn install --frozen-lockfile --ignore-scripts
27-
- run: npm run test:ci
25+
uses: ./.github/workflows/reusable_workflow_test.yml
26+
2827
build:
2928
runs-on: ubuntu-latest
3029
steps:

0 commit comments

Comments
 (0)