Skip to content

Commit f9838bf

Browse files
Fix code coverage upload (#14821)
* Run subset of tests (enough for code coverage) * Checking Linux-${{env.COVERAGE_REPORTS}} * Force coverage step checkout path same as tests * codecov fix paths * Download reports to special-working-directory * Move codecov to root * wrong env var syntax * Ok move the file to the actual root * no path fixing, yolo * Re-add path fixing * Undo testing changes * Fix copy-paste errors * Upload code coverage in the insiders build * Try uploading as part of insiders * Delete env vars (moved up) * Add checkout comment in the coverage step * Revert "Try uploading as part of insiders" This reverts commit f3ffbe6. * Forgot a copy-paste * Upload coverage report for forks as wel Co-authored-by: Brett Cannon <[email protected]> Co-authored-by: Brett Cannon <[email protected]>
1 parent 5e938c6 commit f9838bf

File tree

3 files changed

+46
-17
lines changed

3 files changed

+46
-17
lines changed

.github/codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ comment:
2929
layout: 'diff, files'
3030
behavior: default
3131
require_changes: no
32+
33+
fixes:
34+
- "path with spaces/::"

.github/workflows/insiders.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ env:
1515
VSIX_NAME: ms-python-insiders.vsix
1616
COVERAGE_REPORTS: tests-coverage-reports
1717
TEST_RESULTS_DIRECTORY: .
18+
# Force a path with spaces and to test extension works in these scenarios
19+
# Unicode characters are causing 2.7 failures so skip that for now.
20+
special-working-directory: './path with spaces'
21+
special-working-directory-relative: 'path with spaces'
1822

1923
jobs:
2024
build-vsix:
@@ -105,10 +109,6 @@ jobs:
105109
# See https://github.com/microsoft/ptvsd/issues/2068
106110
# At this point pinning is only needed for consistency. We no longer have TS debug adapter.
107111
NODE_VERSION: 12.15.0
108-
# Force a path with spaces and to test extension works in these scenarios
109-
# Unicode characters are causing 2.7 failures so skip that for now.
110-
special-working-directory: './path with spaces'
111-
special-working-directory-relative: 'path with spaces'
112112
defaults:
113113
run:
114114
working-directory: ${{env.special-working-directory}}
@@ -454,9 +454,16 @@ jobs:
454454
runs-on: ubuntu-latest
455455
if: github.repository == 'microsoft/vscode-python'
456456
needs: [tests, smoke-tests]
457+
defaults:
458+
run:
459+
working-directory: ${{env.special-working-directory}}
457460
steps:
461+
# Checkout the repo in the same way as how the tests are run,
462+
# or nyc won't know how to reconcile the reports generated by the tests.
458463
- name: Checkout
459464
uses: actions/checkout@v2
465+
with:
466+
path: ${{env.special-working-directory-relative}}
460467

461468
- name: Use Node ${{env.NODE_VERSION}}
462469
uses: actions/[email protected]
@@ -472,24 +479,31 @@ jobs:
472479
- name: Download Ubuntu test coverage artifacts
473480
uses: actions/download-artifact@v2
474481
with:
475-
name: Linux-${{env.COVERAGE_REPORTS}}
476-
path: Linux-${{env.COVERAGE_REPORTS}}
482+
name: Linux-${{ env.COVERAGE_REPORTS }}
483+
path: ${{env.special-working-directory}}/Linux-${{ env.COVERAGE_REPORTS }}
477484

478485
- name: Extract Ubuntu coverage artifacts to ./nyc_output
479486
run: |
480487
mkdir .nyc_output
481-
mv Linux-${{env.COVERAGE_REPORTS}}/* .nyc_output
482-
rm -r Linux-${{env.COVERAGE_REPORTS}}
488+
mv Linux-${{ env.COVERAGE_REPORTS }}/* .nyc_output
489+
rm -r Linux-${{ env.COVERAGE_REPORTS }}
483490
484491
- name: Generate coverage reports
485492
run: npm run test:cover:report
486493
continue-on-error: true
487494

495+
# The only location supported by the codecov action is the workspace root.
496+
# See https://github.com/codecov/codecov-action#arguments
497+
- name: Move codecov.yml to root
498+
run: |
499+
mkdir $GITHUB_WORKSPACE/.github
500+
mv .github/codecov.yml $GITHUB_WORKSPACE
501+
488502
- name: Upload coverage to codecov
489503
uses: codecov/codecov-action@v1
490504
with:
491505
token: ${{ secrets.CODECOV_TOKEN }}
492-
file: ./coverage/cobertura-coverage.xml
506+
file: ${{env.special-working-directory}}/coverage/cobertura-coverage.xml
493507

494508
upload:
495509
name: Upload VSIX to Azure Blob Storage

.github/workflows/pr-check.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ env:
1717
VSIX_NAME: ms-python-insiders.vsix
1818
COVERAGE_REPORTS: tests-coverage-reports
1919
TEST_RESULTS_DIRECTORY: .
20+
# Force a path with spaces and to test extension works in these scenarios
21+
# Unicode characters are causing 2.7 failures so skip that for now.
22+
special-working-directory: './path with spaces'
23+
special-working-directory-relative: 'path with spaces'
2024

2125
jobs:
2226
build-vsix:
@@ -105,10 +109,6 @@ jobs:
105109
# See https://github.com/microsoft/ptvsd/issues/2068
106110
# At this point pinning is only needed for consistency. We no longer have TS debug adapter.
107111
NODE_VERSION: 12.15.0
108-
# Force a path with spaces and to test extension works in these scenarios
109-
# Unicode characters are causing 2.7 failures so skip that for now.
110-
special-working-directory: './path with spaces'
111-
special-working-directory-relative: 'path with spaces'
112112
defaults:
113113
run:
114114
working-directory: ${{env.special-working-directory}}
@@ -452,13 +452,18 @@ jobs:
452452

453453
coverage:
454454
name: Coverage reports upload
455-
# Don't' assume external contributors want to upload the coverage report.
456-
if: github.repository == 'microsoft/vscode-python'
457455
runs-on: ubuntu-latest
458456
needs: [tests, smoke-tests]
457+
defaults:
458+
run:
459+
working-directory: ${{env.special-working-directory}}
459460
steps:
461+
# Checkout the repo in the same way as how the tests are run,
462+
# or nyc won't know how to reconcile the reports generated by the tests.
460463
- name: Checkout
461464
uses: actions/checkout@v2
465+
with:
466+
path: ${{env.special-working-directory-relative}}
462467

463468
- name: Use Node ${{env.NODE_VERSION}}
464469
uses: actions/[email protected]
@@ -475,7 +480,7 @@ jobs:
475480
uses: actions/download-artifact@v2
476481
with:
477482
name: Linux-${{ env.COVERAGE_REPORTS }}
478-
path: Linux-${{ env.COVERAGE_REPORTS }}
483+
path: ${{env.special-working-directory}}/Linux-${{ env.COVERAGE_REPORTS }}
479484

480485
- name: Extract Ubuntu coverage artifacts to ./nyc_output
481486
run: |
@@ -487,9 +492,16 @@ jobs:
487492
run: npm run test:cover:report
488493
continue-on-error: true
489494

495+
# The only location supported by the codecov action is the workspace root.
496+
# See https://github.com/codecov/codecov-action#arguments
497+
- name: Move codecov.yml to root
498+
run: |
499+
mkdir $GITHUB_WORKSPACE/.github
500+
mv .github/codecov.yml $GITHUB_WORKSPACE
501+
490502
- name: Upload coverage to codecov
491503
uses: codecov/codecov-action@v1
492504
with:
493505
# Can't use the token to disambiguate since secrets aren't available from PR-triggered runs.
494506
#token: ${{ secrets.CODECOV_TOKEN }}
495-
file: ./coverage/cobertura-coverage.xml
507+
file: ${{env.special-working-directory}}/coverage/cobertura-coverage.xml

0 commit comments

Comments
 (0)