Skip to content

Commit

Permalink
build(ci): Use codecov GH action instead of bash script (#32959)
Browse files Browse the repository at this point in the history
This uses a GH Action instead of bash script. The bash script has been deprecated. See https://github.com/codecov/codecov-action

* Change our uploads by adding a flag for frontend or backend. 
* Only upload coverage of acceptance tests on backend changes (unsure how this will affect codecov for frontend only changes)


This does *NOT* fix the spiky reporting of coverage (which I believe is due to flakey tests, eg, 3 of 4 test instances fail, but we still report 3 of them to codecov.

Note, due to a [bug in codecov](codecov/uploader#475), we have to unset `NODE_OPTIONS`
  • Loading branch information
billyvg committed Mar 29, 2022
1 parent 10b40dd commit 164d345
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
25 changes: 19 additions & 6 deletions .github/actions/artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
name: 'Sentry Artifacts'
description: 'Handles uploading coverage/test artifacts to codecov'

inputs:
files:
description: "Path to coverage file(s) - comma separated for multiple files"
default: ".artifacts/*.coverage.xml"
required: true
type:
description: "The type of change (frontend, backend)"
default: "backend"
required: false

runs:
using: "composite"
steps:
- name: Upload to codecov
shell: bash
run: |
coverage_files=$(ls .artifacts/*coverage.xml || true)
if [[ -n "$coverage_files" || -f .artifacts/coverage/cobertura-coverage.xml ]]; then
bash <(curl -s https://codecov.io/bash) -v
fi
uses: codecov/codecov-action@v2
env:
# This is because of a bug in codecov's uploader
# See: https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ""
with:
flags: ${{ inputs.type }}
files: ${{ inputs.files }}
verbose: true
12 changes: 12 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:

- name: Handle artifacts
uses: ./.github/actions/artifacts
with:
files: .artifacts/coverage/*
type: frontend

webpack:
name: create frontend bundle
Expand Down Expand Up @@ -209,8 +212,17 @@ jobs:
save-only: true
snapshot-path: .artifacts/visual-snapshots

# We use the below to determine the flag to use in codecov
- name: Check for python file changes
uses: getsentry/paths-filter@v2
id: changes
with:
token: ${{ github.token }}
filters: .github/file-filters.yml

- name: Handle artifacts
uses: ./.github/actions/artifacts
if: ${{ steps.changes.outputs.backend == 'true' }}

chartcuterie:
name: chartcuterie integration
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ test-plugins:

test-relay-integration:
@echo "--> Running Relay integration tests"
pytest tests/relay_integration -vv
pytest tests/relay_integration -vv --cov . --cov-report="xml:.artifacts/relay.coverage.xml" --junit-xml=".artifacts/relay.junit.xml"
@echo ""

test-api-docs: build-api-docs
Expand Down

0 comments on commit 164d345

Please sign in to comment.