|
89 | 89 | if: ${{ !cancelled() }} |
90 | 90 | shell: micromamba-shell {0} |
91 | 91 | run: source ./.github/workflows/print_versions.sh |
| 92 | + - name: Place a usercustomize.py file enabling subprocess code coverage |
| 93 | + shell: bash -el {0} |
| 94 | + run: | |
| 95 | + mkdir -p $(python -m site --user-site) |
| 96 | + printf "import coverage\ncoverage.process_startup()" \ |
| 97 | + > "$(python -m site --user-site)/usercustomize.py" |
| 98 | + - name: Set COVERAGE_PROCESS_START env variable |
| 99 | + shell: bash -el {0} |
| 100 | + run: | |
| 101 | + echo "COVERAGE_PROCESS_START=${PWD}/.coveragerc" >> $GITHUB_ENV |
| 102 | + echo "COVERAGE_RCFILE=${PWD}/.coveragerc" >> $GITHUB_ENV |
92 | 103 |
|
93 | 104 | - name: Run pytest with multiple workers in parallel |
94 | 105 | shell: micromamba-shell {0} |
@@ -135,15 +146,65 @@ jobs: |
135 | 146 |
|
136 | 147 | - name: Run gunittest tests |
137 | 148 | shell: micromamba-shell {0} |
138 | | - run: .github/workflows/test_thorough.sh --config .github/workflows/macos_gunittest.cfg |
| 149 | + run: | |
| 150 | + export INITIAL_GISBASE="$(grass --config path)" |
| 151 | + export INITIAL_PWD="${PWD}" |
| 152 | + grass --tmp-project XY --exec \ |
| 153 | + g.download.location url=${{ env.SAMPLE_DATA_URL }} path=$HOME |
| 154 | + grass --tmp-project XY --exec \ |
| 155 | + ${PYTHON} -m grass.gunittest.main \ |
| 156 | + --grassdata $HOME --location nc_spm_full_v2alpha2 --location-type nc \ |
| 157 | + --min-success 100 --config .github/workflows/macos_gunittest.cfg |
139 | 158 | env: |
140 | 159 | SAMPLE_DATA_URL: "file://${{ github.workspace }}/sample-data/\ |
141 | 160 | nc_spm_full_v2alpha2.tar.gz" |
142 | | - |
| 161 | + PYTHON: coverage run |
| 162 | + - name: Fix non-standard installed script paths in coverage data |
| 163 | + shell: bash -el {0} |
| 164 | + run: | |
| 165 | + export PYTHONPATH=`grass --config python_path`:$PYTHONPATH |
| 166 | + # export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH |
| 167 | + export INITIAL_GISBASE="$(grass --config path)" |
| 168 | + export INITIAL_PWD="${PWD}" |
| 169 | + coverage combine |
| 170 | + python utils/coverage_mapper.py |
| 171 | + coverage combine |
| 172 | + - name: Show python coverage report summary |
| 173 | + shell: bash -el {0} |
| 174 | + run: | |
| 175 | + export PYTHONPATH=`grass --config python_path`:$PYTHONPATH |
| 176 | + # export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH |
| 177 | + export INITIAL_GISBASE="$(grass --config path)" |
| 178 | + export INITIAL_PWD="${PWD}" |
| 179 | + coverage report |
| 180 | + - name: Generate HTML coverage report |
| 181 | + shell: bash -el {0} |
| 182 | + run: | |
| 183 | + export PYTHONPATH=`grass --config python_path`:$PYTHONPATH |
| 184 | + # export LD_LIBRARY_PATH=$(grass --config path)/lib:$LD_LIBRARY_PATH |
| 185 | + export INITIAL_GISBASE="$(grass --config path)" |
| 186 | + export INITIAL_PWD="${PWD}" |
| 187 | + coverage html |
143 | 188 | - name: Make HTML test report available |
144 | 189 | if: ${{ !cancelled() }} |
145 | 190 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
146 | 191 | with: |
147 | | - name: testreport-macOS |
| 192 | + name: testreport-${{ runner.os }} |
148 | 193 | path: testreport |
149 | 194 | retention-days: 3 |
| 195 | + - name: Make python-only code coverage test report available |
| 196 | + if: ${{ !cancelled() }} |
| 197 | + uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 |
| 198 | + with: |
| 199 | + name: >- |
| 200 | + python-codecoverage-report-${{ 'macos-14' }} |
| 201 | + path: coverage_html_report |
| 202 | + retention-days: 1 |
| 203 | + - name: Upload coverage reports to Codecov |
| 204 | + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 |
| 205 | + with: |
| 206 | + verbose: true |
| 207 | + flags: >- |
| 208 | + gunittest,gunittest-${{ 'macos-14' }} |
| 209 | + name: gunittest-${{ 'macos-14' }} |
| 210 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments