Skip to content
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

build(ci): Use codecov GH action instead of bash script #32959

Merged
merged 12 commits into from
Mar 29, 2022
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I assume this is intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I initially refactored these paths and noticed relay wasn't outputting coverage stats.

@echo ""

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