Skip to content

Fix code coverage upload #14821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ comment:
layout: 'diff, files'
behavior: default
require_changes: no

fixes:
- "path with spaces/::"
32 changes: 23 additions & 9 deletions .github/workflows/insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ env:
VSIX_NAME: ms-python-insiders.vsix
COVERAGE_REPORTS: tests-coverage-reports
TEST_RESULTS_DIRECTORY: .
# Force a path with spaces and to test extension works in these scenarios
# Unicode characters are causing 2.7 failures so skip that for now.
special-working-directory: './path with spaces'
special-working-directory-relative: 'path with spaces'

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

- name: Use Node ${{env.NODE_VERSION}}
uses: actions/[email protected]
Expand All @@ -472,24 +479,31 @@ jobs:
- name: Download Ubuntu test coverage artifacts
uses: actions/download-artifact@v2
with:
name: Linux-${{env.COVERAGE_REPORTS}}
path: Linux-${{env.COVERAGE_REPORTS}}
name: Linux-${{ env.COVERAGE_REPORTS }}
path: ${{env.special-working-directory}}/Linux-${{ env.COVERAGE_REPORTS }}

- name: Extract Ubuntu coverage artifacts to ./nyc_output
run: |
mkdir .nyc_output
mv Linux-${{env.COVERAGE_REPORTS}}/* .nyc_output
rm -r Linux-${{env.COVERAGE_REPORTS}}
mv Linux-${{ env.COVERAGE_REPORTS }}/* .nyc_output
rm -r Linux-${{ env.COVERAGE_REPORTS }}

- name: Generate coverage reports
run: npm run test:cover:report
continue-on-error: true

# The only location supported by the codecov action is the workspace root.
# See https://github.com/codecov/codecov-action#arguments
- name: Move codecov.yml to root
run: |
mkdir $GITHUB_WORKSPACE/.github
mv .github/codecov.yml $GITHUB_WORKSPACE

- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/cobertura-coverage.xml
file: ${{env.special-working-directory}}/coverage/cobertura-coverage.xml

upload:
name: Upload VSIX to Azure Blob Storage
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ env:
VSIX_NAME: ms-python-insiders.vsix
COVERAGE_REPORTS: tests-coverage-reports
TEST_RESULTS_DIRECTORY: .
# Force a path with spaces and to test extension works in these scenarios
# Unicode characters are causing 2.7 failures so skip that for now.
special-working-directory: './path with spaces'
special-working-directory-relative: 'path with spaces'

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

coverage:
name: Coverage reports upload
# Don't' assume external contributors want to upload the coverage report.
if: github.repository == 'microsoft/vscode-python'
runs-on: ubuntu-latest
needs: [tests, smoke-tests]
defaults:
run:
working-directory: ${{env.special-working-directory}}
steps:
# Checkout the repo in the same way as how the tests are run,
# or nyc won't know how to reconcile the reports generated by the tests.
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{env.special-working-directory-relative}}

- name: Use Node ${{env.NODE_VERSION}}
uses: actions/[email protected]
Expand All @@ -475,7 +480,7 @@ jobs:
uses: actions/download-artifact@v2
with:
name: Linux-${{ env.COVERAGE_REPORTS }}
path: Linux-${{ env.COVERAGE_REPORTS }}
path: ${{env.special-working-directory}}/Linux-${{ env.COVERAGE_REPORTS }}

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

# The only location supported by the codecov action is the workspace root.
# See https://github.com/codecov/codecov-action#arguments
- name: Move codecov.yml to root
run: |
mkdir $GITHUB_WORKSPACE/.github
mv .github/codecov.yml $GITHUB_WORKSPACE

- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
# Can't use the token to disambiguate since secrets aren't available from PR-triggered runs.
#token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/cobertura-coverage.xml
file: ${{env.special-working-directory}}/coverage/cobertura-coverage.xml