Skip to content

Commit 29bffcf

Browse files
author
Kerkesni
committed
add coverage to functional tests
Issue: CLDSRV-618
1 parent 1915beb commit 29bffcf

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.github/actions/setup-ci/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ runs:
1616
run: |-
1717
set -exu;
1818
mkdir -p /tmp/artifacts/${JOB_NAME}/;
19+
- name: Setup coverage directory
20+
shell: bash
21+
run: |-
22+
set -exu;
23+
mkdir -p /tmp/coverage/${JOB_NAME}/;
1924
- uses: actions/setup-node@v4
2025
with:
2126
node-version: '22'

.github/docker/docker-compose.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
services:
22
cloudserver:
33
image: ${CLOUDSERVER_IMAGE}
4-
command: sh -c "yarn start > /artifacts/s3.log"
4+
command: |
5+
bash -c "
6+
cover() {
7+
echo 'Container stopped, generating coverage reports...'
8+
npx nyc report --report-dir /coverage/test --reporter=lcov
9+
}
10+
trap cover SIGTERM
11+
npx nyc --clean --silent yarn start &
12+
wait $!
13+
"
514
network_mode: "host"
615
volumes:
716
- /tmp/ssl:/ssl
817
- /tmp/ssl-kmip:/ssl-kmip
918
- ${HOME}/.aws/credentials:/root/.aws/credentials
1019
- /tmp/artifacts/${JOB_NAME}:/artifacts
20+
- /tmp/coverage/${JOB_NAME}:/coverage/test
1121
environment:
1222
- CI=true
1323
- ENABLE_LOCAL_CACHE=true

.github/workflows/tests.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ jobs:
253253
yarn run multiple_backend_test | tee /tmp/artifacts/${{ github.job }}/tests.log
254254
env:
255255
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
256+
- name: Upload coverage reports to Codecov
257+
uses: codecov/codecov-action@v5
258+
with:
259+
token: ${{ secrets.CODECOV_TOKEN }}
260+
directory: /tmp/coverage/${{ github.job }}
261+
flags: ${{ github.job }}
262+
if: ${{ !cancelled() }}
256263
- name: Upload logs to artifacts
257264
uses: scality/action-artifacts@v4
258265
with:
@@ -291,6 +298,13 @@ jobs:
291298
yarn run ft_test | tee /tmp/artifacts/${{ github.job }}/tests.log
292299
env:
293300
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
301+
- name: Upload coverage reports to Codecov
302+
uses: codecov/codecov-action@v5
303+
with:
304+
token: ${{ secrets.CODECOV_TOKEN }}
305+
directory: /tmp/coverage/${{ github.job }}
306+
flags: ${{ github.job }}
307+
if: ${{ !cancelled() }}
294308
- name: Upload logs to artifacts
295309
uses: scality/action-artifacts@v4
296310
with:
@@ -331,6 +345,13 @@ jobs:
331345
yarn run ft_mixed_bucket_format_version | tee /tmp/artifacts/${{ github.job }}/mixed-tests.log
332346
env:
333347
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
348+
- name: Upload coverage reports to Codecov
349+
uses: codecov/codecov-action@v5
350+
with:
351+
token: ${{ secrets.CODECOV_TOKEN }}
352+
directory: /tmp/coverage/${{ github.job }}
353+
flags: ${{ github.job }}
354+
if: ${{ !cancelled() }}
334355
- name: Upload logs to artifacts
335356
uses: scality/action-artifacts@v4
336357
with:
@@ -374,6 +395,13 @@ jobs:
374395
set -o pipefail;
375396
bash wait_for_local_port.bash 8000 40
376397
yarn run ft_test | tee /tmp/artifacts/${{ matrix.job-name }}/tests.log
398+
- name: Upload coverage reports to Codecov
399+
uses: codecov/codecov-action@v5
400+
with:
401+
token: ${{ secrets.CODECOV_TOKEN }}
402+
directory: /tmp/coverage/${{ github.job }}
403+
flags: ${{ matrix.job-name }}
404+
if: ${{ !cancelled() }}
377405
- name: Upload logs to artifacts
378406
uses: scality/action-artifacts@v4
379407
with:
@@ -408,6 +436,13 @@ jobs:
408436
set -ex -o pipefail;
409437
bash wait_for_local_port.bash 8000 40
410438
yarn run test_utapi_v2 | tee /tmp/artifacts/${{ github.job }}/tests.log
439+
- name: Upload coverage reports to Codecov
440+
uses: codecov/codecov-action@v5
441+
with:
442+
token: ${{ secrets.CODECOV_TOKEN }}
443+
directory: /tmp/coverage/${{ github.job }}
444+
flags: ${{ github.job }}
445+
if: ${{ !cancelled() }}
411446
- name: Upload logs to artifacts
412447
uses: scality/action-artifacts@v4
413448
with:
@@ -452,6 +487,13 @@ jobs:
452487
set -ex -o pipefail;
453488
bash wait_for_local_port.bash 8000 40
454489
yarn run test_quota | tee /tmp/artifacts/${{ github.job }}/tests.log
490+
- name: Upload coverage reports to Codecov
491+
uses: codecov/codecov-action@v5
492+
with:
493+
token: ${{ secrets.CODECOV_TOKEN }}
494+
directory: /tmp/coverage/${{ github.job }}
495+
flags: ${{ github.job }}${{ matrix.inflights.value == 'true' && '-inflights' || '' }}
496+
if: ${{ !cancelled() }}
455497
- name: Upload logs to artifacts
456498
uses: scality/action-artifacts@v4
457499
with:
@@ -490,6 +532,13 @@ jobs:
490532
bash wait_for_local_port.bash 8000 40
491533
bash wait_for_local_port.bash 5696 40
492534
yarn run ft_kmip | tee /tmp/artifacts/${{ github.job }}/tests.log
535+
- name: Upload coverage reports to Codecov
536+
uses: codecov/codecov-action@v5
537+
with:
538+
token: ${{ secrets.CODECOV_TOKEN }}
539+
directory: /tmp/coverage/${{ github.job }}
540+
flags: ${{ github.job }}
541+
if: ${{ !cancelled() }}
493542
- name: Upload logs to artifacts
494543
uses: scality/action-artifacts@v4
495544
with:
@@ -568,6 +617,13 @@ jobs:
568617
S3BACKEND: file
569618
S3VAULT: mem
570619
S3METADATA: mongodb
620+
- name: Upload coverage reports to Codecov
621+
uses: codecov/codecov-action@v5
622+
with:
623+
token: ${{ secrets.CODECOV_TOKEN }}
624+
directory: /tmp/coverage/${{ github.job }}
625+
flags: ${{ github.job }}
626+
if: ${{ !cancelled() }}
571627
- name: Upload logs to artifacts
572628
uses: scality/action-artifacts@v4
573629
with:

0 commit comments

Comments
 (0)