44
44
timeout-minutes : 30
45
45
# "run-gpu-tests" job is run if the "gpuci" label is added to the PR
46
46
if : ${{ github.event.label.name == 'gpuci' || github.ref == 'refs/heads/main' }}
47
-
47
+ env :
48
+ DIR : ${{ github.run_id }}
48
49
steps :
49
50
# If something went wrong during the last cleanup, this step ensures any existing container is removed
50
51
- name : Remove existing container if it exists
79
80
# We specify the `rootdir` to help locate the "pyproject.toml" file (which is in the root directory of the repository),
80
81
# and then the directory where the PyTests are located
81
82
- name : Run PyTests with GPU mark
83
+ id : coverage
82
84
run : |
83
- docker exec nemo-curator-container pytest -m gpu --rootdir /opt/NeMo-Curator /opt/NeMo-Curator/tests
85
+ docker exec nemo-curator-container bash -c '
86
+ cd /opt/NeMo-Curator && \
87
+ coverage run \
88
+ --branch \
89
+ --source=nemo_curator \
90
+ --omit=nemo_curator/scripts/* \
91
+ -m pytest -m gpu --rootdir /opt/NeMo-Curator tests && \
92
+ cp .coverage ../
93
+ '
94
+
95
+ docker exec nemo-curator-container coverage xml
96
+
97
+ docker cp nemo-curator-container:/opt/.coverage $DIR/.coverage
98
+ docker cp nemo-curator-container:/opt/coverage.xml $DIR/coverage.xml
99
+ coverage_report="codecov"
100
+ echo "report=$coverage_report" | tee -a "$GITHUB_OUTPUT"
84
101
85
102
# After running `docker stop`, the container remains in an exited state
86
103
# It is still present on our system and could be restarted with `docker start`
@@ -89,3 +106,32 @@ jobs:
89
106
if : always()
90
107
run : |
91
108
docker stop nemo-curator-container && docker rm nemo-curator-container
109
+
110
+ - name : Upload artifacts
111
+ uses : actions/upload-artifact@v4
112
+ if : ${{ steps.coverage.outputs.report == 'codecov' }}
113
+ with :
114
+ name : ${{ github.run_id }}
115
+ path : |
116
+ ${{ github.run_id }}/coverage.xml
117
+ ${{ github.run_id }}/.coverage
118
+ include-hidden-files : true
119
+
120
+ upload-coverage :
121
+ runs-on : ubuntu-latest
122
+ needs : [run-gpu-tests]
123
+ steps :
124
+ - name : Checkout
125
+ uses : actions/checkout@v4
126
+
127
+ - name : Download coverage reports of current branch
128
+ uses : actions/download-artifact@v4
129
+ with :
130
+ name : ${{ github.run_id }}
131
+
132
+ - name : Upload coverage reports to Codecov
133
+ uses : codecov/codecov-action@v5
134
+ with :
135
+ token : ${{ secrets.CODECOV_TOKEN }}
136
+ verbose : true
137
+ flags : gpu
0 commit comments