From 2cbe4cfcb908d5cfff8d6fdb1285d358822e1736 Mon Sep 17 00:00:00 2001 From: Luiz Motta Date: Thu, 30 Nov 2023 10:44:27 -0300 Subject: [PATCH] Upload junit tests --- .github/workflows/ci_build.yml | 26 +++++++++++++++++++++++++- packages/cors-proxy/jest.config.js | 6 +++++- packages/online-editor/jest.config.js | 6 +++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 55f507b28fc..cbac1a5db61 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -102,7 +102,7 @@ jobs: NODE_OPTIONS: "--max_old_space_size=4096" BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} run: >- - pnpm -r -F boxed-expression-component... --workspace-concurrency=1 build:prod + pnpm -r -F online-editor... --workspace-concurrency=1 build:prod - name: "PARTIAL → Bootstrap" if: steps.setup_build_mode.outputs.mode == 'partial' @@ -140,6 +140,30 @@ jobs: run: | pnpm -F "...[${{ steps.checkout_pr.outputs.base_sha }}]" --workspace-concurrency=1 build:prod + - name: "Upload JUNIT end-to-end tests results to Buildkite (`main` only)" + if: always() && !cancelled() + shell: bash + env: + BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_TOKEN }} + BUILDKITE_BRANCH: ${{ github.ref_name }} + BUILDKITE_MESSAGE: ${{ github.event.commits[0].message }} + run: | + echo $BUILDKITE_BRANCH + eval "find -P * -type f ${{ steps.ci_patterns.outputs.end_to_end_tests_reports_patterns_for_find }}" + echo "---------------------------- starting upload -----------------------" + eval "find -P * -type f ${{ steps.ci_patterns.outputs.end_to_end_tests_reports_patterns_for_find }}" | xargs -I{} curl -X POST \ + -H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \ + -F "format=junit" \ + -F "data=@{}" \ + -F "run_env[CI]=github_actions" \ + -F "run_env[key]=$GITHUB_ACTION-$GITHUB_RUN_NUMBER-$GITHUB_RUN_ATTEMPT" \ + -F "run_env[number]=$GITHUB_RUN_NUMBER" \ + -F "run_env[branch]=$BUILDKITE_BRANCH" \ + -F "run_env[commit_sha]=$GITHUB_SHA" \ + -F "run_env[message]=$BUILDKITE_MESSAGE" \ + -F "run_env[url]=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ + https://analytics-api.buildkite.com/v1/uploads + - name: "Upload JSON end-to-end tests results to Buildkite (`main` only)" if: always() && !cancelled() shell: bash diff --git a/packages/cors-proxy/jest.config.js b/packages/cors-proxy/jest.config.js index 6ada62559f3..376aef75120 100644 --- a/packages/cors-proxy/jest.config.js +++ b/packages/cors-proxy/jest.config.js @@ -23,7 +23,11 @@ module.exports = { tsconfig: "/tsconfig.json", }, }, - reporters: ["default", ["jest-junit", { outputFile: "./dist-tests/junit-report.xml" }]], + reporters: [ + "default", + "buildkite-test-collector/jest/reporter", + ["jest-junit", { outputFile: "./dist-tests/junit-report.xml" }], + ], moduleDirectories: ["node_modules"], moduleFileExtensions: ["js", "jsx", "ts", "tsx"], testRegex: "/tests/.*\\.test\\.(jsx?|tsx?)$", diff --git a/packages/online-editor/jest.config.js b/packages/online-editor/jest.config.js index 688b949c932..57881992f38 100644 --- a/packages/online-editor/jest.config.js +++ b/packages/online-editor/jest.config.js @@ -23,7 +23,11 @@ module.exports = { tsconfig: "/tsconfig.json", }, }, - reporters: ["default", ["jest-junit", { outputFile: "./dist-tests/junit-report.xml" }]], + reporters: [ + "default", + "buildkite-test-collector/jest/reporter", + ["jest-junit", { outputFile: "./dist-tests/junit-report.xml" }], + ], moduleDirectories: ["node_modules", "src"], moduleFileExtensions: ["js", "jsx", "ts", "tsx"], setupFilesAfterEnv: ["./tests/unit/jest.setup.ts"],