From ca50f58ea2fc9c7be953dc2a21fe11c35bfa4e4d Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 10:43:37 -0400 Subject: [PATCH 1/9] build(ci): Use codecov GH action instead of bash script This uses a GH Action instead of bash script. The bash script has been deprecated. See https://github.com/codecov/codecov-action --- .github/actions/artifacts/action.yml | 20 ++++++++++++++------ .github/workflows/acceptance.yml | 21 ++++++++++++++++++++- Makefile | 12 ++++++------ 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index d79a9228750744..e6c6003a89e136 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -1,13 +1,21 @@ name: 'Sentry Artifacts' description: 'Handles uploading coverage/test artifacts to codecov' +inputs: + type: + description: "The type of change (frontend, python)" + default: "python" + required: false + runs: using: "composite" steps: + - shell: bash + run: ls .artifacts/coverage + - 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 + with: + flags: ${{ inputs.type }} + directory: .artifacts/coverage + verbose: true diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index b1738434281df4..75836fd89f6dc0 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -88,6 +88,8 @@ jobs: - name: Handle artifacts uses: ./.github/actions/artifacts + with: + type: frontend webpack: name: create frontend bundle @@ -209,8 +211,25 @@ jobs: save-only: true snapshot-path: .artifacts/visual-snapshots - - name: Handle artifacts + # 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 (frontend) uses: ./.github/actions/artifacts + if: ${{ steps.changes.outputs.frontend == 'true' }} + with: + type: frontend + + - name: Handle artifacts (backend) + uses: ./.github/actions/artifacts + if: ${{ steps.changes.outputs.backend == 'true' }} + with: + type: backend chartcuterie: name: chartcuterie integration diff --git a/Makefile b/Makefile index 32371ed820ae37..1cfb996f8dd2ba 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ fetch-release-registry: run-acceptance: @echo "--> Running acceptance tests" - pytest tests/acceptance --cov . --cov-report="xml:.artifacts/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml" + pytest tests/acceptance --cov . --cov-report="xml:.artifacts/coverage/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml" @echo "" test-cli: @@ -126,12 +126,12 @@ test-python: test-python-ci: make build-platform-assets @echo "--> Running CI Python tests" - pytest tests/integration tests/sentry --cov . --cov-report="xml:.artifacts/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1 + pytest tests/integration tests/sentry --cov . --cov-report="xml:.artifacts/coverage/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1 @echo "" test-snuba: @echo "--> Running snuba tests" - pytest tests/snuba tests/sentry/eventstream/kafka tests/sentry/snuba/test_discover.py tests/sentry/search/events -vv --cov . --cov-report="xml:.artifacts/snuba.coverage.xml" --junit-xml=".artifacts/snuba.junit.xml" + pytest tests/snuba tests/sentry/eventstream/kafka tests/sentry/snuba/test_discover.py tests/sentry/search/events -vv --cov . --cov-report="xml:.artifacts/coverage/snuba.coverage.xml" --junit-xml=".artifacts/snuba.junit.xml" @echo "" backend-typing: @@ -141,12 +141,12 @@ backend-typing: test-symbolicator: @echo "--> Running symbolicator tests" - pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml" + pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/coverage/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml" @echo "" test-chartcuterie: @echo "--> Running chartcuterie tests" - pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml" + pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/coverage/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml" @echo "" test-acceptance: node-version-check @@ -156,7 +156,7 @@ test-acceptance: node-version-check test-plugins: @echo "--> Running plugin tests" - pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1 + pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/coverage/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1 @echo "" test-relay-integration: From e608943f3d96930a8402249521c9fe3a64f7d2b5 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 11:17:34 -0400 Subject: [PATCH 2/9] add coverage for relay tests --- .github/actions/artifacts/action.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index e6c6003a89e136..98be8752b8e051 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -11,7 +11,7 @@ runs: using: "composite" steps: - shell: bash - run: ls .artifacts/coverage + run: mkdir -p .artifacts/coverage - name: Upload to codecov uses: codecov/codecov-action@v2 diff --git a/Makefile b/Makefile index 1cfb996f8dd2ba..cfb6bdb6701087 100644 --- a/Makefile +++ b/Makefile @@ -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/coverage/relay.coverage.xml" --junit-xml=".artifacts/relay.junit.xml" @echo "" test-api-docs: build-api-docs From 87dc7deb54f6fcd3cb425b6778da9d8efb7da725 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 12:37:39 -0400 Subject: [PATCH 3/9] debug --- .github/actions/artifacts/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index 98be8752b8e051..c1ea6e2472d1b0 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -11,7 +11,9 @@ runs: using: "composite" steps: - shell: bash - run: mkdir -p .artifacts/coverage + run: | + mkdir -p .artifacts/coverage + ls .artifacts/coverage - name: Upload to codecov uses: codecov/codecov-action@v2 From ffb4f9d46e71f784052f7a056cacd167085c9008 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 13:46:54 -0400 Subject: [PATCH 4/9] use file glob --- .github/actions/artifacts/action.yml | 11 +++++------ .github/workflows/acceptance.yml | 1 + Makefile | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index c1ea6e2472d1b0..adb54fe448da8d 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -2,6 +2,10 @@ 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, python)" default: "python" @@ -10,14 +14,9 @@ inputs: runs: using: "composite" steps: - - shell: bash - run: | - mkdir -p .artifacts/coverage - ls .artifacts/coverage - - name: Upload to codecov uses: codecov/codecov-action@v2 with: flags: ${{ inputs.type }} - directory: .artifacts/coverage + files: ${{ inputs.files }} verbose: true diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 75836fd89f6dc0..6ea062c6a8ab80 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -223,6 +223,7 @@ jobs: uses: ./.github/actions/artifacts if: ${{ steps.changes.outputs.frontend == 'true' }} with: + files: ./artifacts/coverage/* type: frontend - name: Handle artifacts (backend) diff --git a/Makefile b/Makefile index cfb6bdb6701087..65ebbcd11deb83 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ fetch-release-registry: run-acceptance: @echo "--> Running acceptance tests" - pytest tests/acceptance --cov . --cov-report="xml:.artifacts/coverage/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml" + pytest tests/acceptance --cov . --cov-report="xml:.artifacts/acceptance.coverage.xml" --junit-xml=".artifacts/acceptance.junit.xml" @echo "" test-cli: @@ -126,12 +126,12 @@ test-python: test-python-ci: make build-platform-assets @echo "--> Running CI Python tests" - pytest tests/integration tests/sentry --cov . --cov-report="xml:.artifacts/coverage/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1 + pytest tests/integration tests/sentry --cov . --cov-report="xml:.artifacts/python.coverage.xml" --junit-xml=".artifacts/python.junit.xml" || exit 1 @echo "" test-snuba: @echo "--> Running snuba tests" - pytest tests/snuba tests/sentry/eventstream/kafka tests/sentry/snuba/test_discover.py tests/sentry/search/events -vv --cov . --cov-report="xml:.artifacts/coverage/snuba.coverage.xml" --junit-xml=".artifacts/snuba.junit.xml" + pytest tests/snuba tests/sentry/eventstream/kafka tests/sentry/snuba/test_discover.py tests/sentry/search/events -vv --cov . --cov-report="xml:.artifacts/snuba.coverage.xml" --junit-xml=".artifacts/snuba.junit.xml" @echo "" backend-typing: @@ -141,12 +141,12 @@ backend-typing: test-symbolicator: @echo "--> Running symbolicator tests" - pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/coverage/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml" + pytest tests/symbolicator -vv --cov . --cov-report="xml:.artifacts/symbolicator.coverage.xml" --junit-xml=".artifacts/symbolicator.junit.xml" @echo "" test-chartcuterie: @echo "--> Running chartcuterie tests" - pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/coverage/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml" + pytest tests/chartcuterie -vv --cov . --cov-report="xml:.artifacts/chartcuterie.coverage.xml" --junit-xml=".artifacts/chartcuterie.junit.xml" @echo "" test-acceptance: node-version-check @@ -156,12 +156,12 @@ test-acceptance: node-version-check test-plugins: @echo "--> Running plugin tests" - pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/coverage/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1 + pytest tests/sentry_plugins -vv --cov . --cov-report="xml:.artifacts/plugins.coverage.xml" --junit-xml=".artifacts/plugins.junit.xml" || exit 1 @echo "" test-relay-integration: @echo "--> Running Relay integration tests" - pytest tests/relay_integration -vv --cov . --cov-report="xml:.artifacts/coverage/relay.coverage.xml" --junit-xml=".artifacts/relay.junit.xml" + 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 From 2c86ce98f73971d42a08d3ad6f58acb8633a76f7 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 14:23:01 -0400 Subject: [PATCH 5/9] unset NODE_OPTIONS? --- .github/actions/artifacts/action.yml | 3 +++ .github/workflows/acceptance.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index adb54fe448da8d..97426a2243a20a 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -14,6 +14,9 @@ inputs: runs: using: "composite" steps: + - shell: bash + run: unset NODE_OPTIONS + - name: Upload to codecov uses: codecov/codecov-action@v2 with: diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 6ea062c6a8ab80..a5a692f51e106b 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -86,9 +86,13 @@ jobs: save-only: true snapshot-path: .artifacts/visual-snapshots + # TEMP + - run: mkdir -p .artifacts/coverage && ls .artifacts/coverage + - name: Handle artifacts uses: ./.github/actions/artifacts with: + files: ./artifacts/coverage/* type: frontend webpack: From 3b5dc0c99baa231e096d759c9790f06c60e5cf31 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 14:43:59 -0400 Subject: [PATCH 6/9] ... --- .github/actions/artifacts/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index 97426a2243a20a..564a958b61fafc 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -14,11 +14,10 @@ inputs: runs: using: "composite" steps: - - shell: bash - run: unset NODE_OPTIONS - - name: Upload to codecov uses: codecov/codecov-action@v2 + env: + NODE_OPTIONS: "" with: flags: ${{ inputs.type }} files: ${{ inputs.files }} From 0581ec24c5ade4766eca9655898d9d4f7eee81ba Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 15:06:16 -0400 Subject: [PATCH 7/9] typo --- .github/workflows/acceptance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index a5a692f51e106b..f923221d2205c8 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -92,7 +92,7 @@ jobs: - name: Handle artifacts uses: ./.github/actions/artifacts with: - files: ./artifacts/coverage/* + files: .artifacts/coverage/* type: frontend webpack: From b1b76b3fce7a8542b404a37efbb8d40b333b5d35 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 25 Mar 2022 15:32:24 -0400 Subject: [PATCH 8/9] no coverage for frontend flag for acceptance tests --- .github/actions/artifacts/action.yml | 4 ++-- .github/workflows/acceptance.yml | 14 +------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index 564a958b61fafc..f8bdaf56de9e4a 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -7,8 +7,8 @@ inputs: default: ".artifacts/*.coverage.xml" required: true type: - description: "The type of change (frontend, python)" - default: "python" + description: "The type of change (frontend, backend)" + default: "backend" required: false runs: diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index f923221d2205c8..98c6d276d41daf 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -86,9 +86,6 @@ jobs: save-only: true snapshot-path: .artifacts/visual-snapshots - # TEMP - - run: mkdir -p .artifacts/coverage && ls .artifacts/coverage - - name: Handle artifacts uses: ./.github/actions/artifacts with: @@ -223,18 +220,9 @@ jobs: token: ${{ github.token }} filters: .github/file-filters.yml - - name: Handle artifacts (frontend) - uses: ./.github/actions/artifacts - if: ${{ steps.changes.outputs.frontend == 'true' }} - with: - files: ./artifacts/coverage/* - type: frontend - - - name: Handle artifacts (backend) + - name: Handle artifacts uses: ./.github/actions/artifacts if: ${{ steps.changes.outputs.backend == 'true' }} - with: - type: backend chartcuterie: name: chartcuterie integration From 5299e5b8d69a86371ec8e9eb846199dcc41bbe0f Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 28 Mar 2022 13:56:18 -0400 Subject: [PATCH 9/9] add comment --- .github/actions/artifacts/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/artifacts/action.yml b/.github/actions/artifacts/action.yml index f8bdaf56de9e4a..7fb0a7f2958108 100644 --- a/.github/actions/artifacts/action.yml +++ b/.github/actions/artifacts/action.yml @@ -17,7 +17,9 @@ runs: - name: Upload to codecov uses: codecov/codecov-action@v2 env: - NODE_OPTIONS: "" + # 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 }}