diff --git a/.github/actions/allure-report-generate/action.yml b/.github/actions/allure-report-generate/action.yml index daa369a1a0..f959833119 100644 --- a/.github/actions/allure-report-generate/action.yml +++ b/.github/actions/allure-report-generate/action.yml @@ -1,6 +1,13 @@ name: 'Create Allure report' description: 'Generate Allure report from uploaded by actions/allure-report-store tests results' +inputs: + store-test-results-into-db: + description: 'Whether to store test results into the database. TEST_RESULT_CONNSTR/TEST_RESULT_CONNSTR_NEW should be set' + type: boolean + required: false + default: false + outputs: base-url: description: 'Base URL for Allure report' @@ -139,9 +146,11 @@ runs: sed -i 's| ${WORKDIR}/index.html @@ -170,6 +179,41 @@ runs: aws s3 rm "s3://${BUCKET}/${LOCK_FILE}" fi + - name: Store Allure test stat in the DB + if: ${{ !cancelled() && inputs.store-test-results-into-db == 'true' }} + shell: bash -euxo pipefail {0} + env: + COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + REPORT_JSON_URL: ${{ steps.generate-report.outputs.report-json-url }} + run: | + export DATABASE_URL=${REGRESS_TEST_RESULT_CONNSTR} + + ./scripts/pysync + + poetry run python3 scripts/ingest_regress_test_result.py \ + --revision ${COMMIT_SHA} \ + --reference ${GITHUB_REF} \ + --build-type unified \ + --ingest ${WORKDIR}/report/data/suites.json + + - name: Store Allure test stat in the DB (new) + if: ${{ !cancelled() && inputs.store-test-results-into-db == 'true' }} + shell: bash -euxo pipefail {0} + env: + COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + BASE_S3_URL: ${{ steps.generate-report.outputs.base-s3-url }} + run: | + export DATABASE_URL=${REGRESS_TEST_RESULT_CONNSTR_NEW} + + ./scripts/pysync + + poetry run python3 scripts/ingest_regress_test_result-new-format.py \ + --reference ${GITHUB_REF} \ + --revision ${COMMIT_SHA} \ + --run-id ${GITHUB_RUN_ID} \ + --run-attempt ${GITHUB_RUN_ATTEMPT} \ + --test-cases-dir ${WORKDIR}/report/data/test-cases + - name: Cleanup if: always() shell: bash -euxo pipefail {0} diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 853f5f2919..a8eab7a86f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -432,6 +432,11 @@ jobs: if: ${{ !cancelled() }} id: create-allure-report uses: ./.github/actions/allure-report-generate + with: + store-test-results-into-db: true + env: + REGRESS_TEST_RESULT_CONNSTR: ${{ secrets.REGRESS_TEST_RESULT_CONNSTR }} + REGRESS_TEST_RESULT_CONNSTR_NEW: ${{ secrets.REGRESS_TEST_RESULT_CONNSTR_NEW }} - uses: actions/github-script@v6 if: ${{ !cancelled() }} @@ -452,45 +457,6 @@ jobs: report, }) - - name: Store Allure test stat in the DB - if: ${{ !cancelled() && steps.create-allure-report.outputs.report-json-url }} - env: - COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} - REPORT_JSON_URL: ${{ steps.create-allure-report.outputs.report-json-url }} - TEST_RESULT_CONNSTR: ${{ secrets.REGRESS_TEST_RESULT_CONNSTR }} - run: | - ./scripts/pysync - - curl --fail --output suites.json "${REPORT_JSON_URL}" - export BUILD_TYPE=unified - export DATABASE_URL="$TEST_RESULT_CONNSTR" - - poetry run python3 scripts/ingest_regress_test_result.py \ - --revision ${COMMIT_SHA} \ - --reference ${GITHUB_REF} \ - --build-type ${BUILD_TYPE} \ - --ingest suites.json - - - name: Store Allure test stat in the DB (new) - if: ${{ !cancelled() && steps.create-allure-report.outputs.report-json-url }} - env: - COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} - REPORT_JSON_URL: ${{ steps.create-allure-report.outputs.report-json-url }} - TEST_RESULT_CONNSTR: ${{ secrets.REGRESS_TEST_RESULT_CONNSTR_NEW }} - BASE_S3_URL: ${{ steps.create-allure-report.outputs.base-s3-url }} - run: | - aws s3 cp --only-show-errors --recursive ${BASE_S3_URL}/data/test-cases ./test-cases - - ./scripts/pysync - - export DATABASE_URL="$TEST_RESULT_CONNSTR" - poetry run python3 scripts/ingest_regress_test_result-new-format.py \ - --reference ${GITHUB_REF} \ - --revision ${COMMIT_SHA} \ - --run-id ${GITHUB_RUN_ID} \ - --run-attempt ${GITHUB_RUN_ATTEMPT} \ - --test-cases-dir ./test-cases - coverage-report: runs-on: [ self-hosted, gen3, small ] container: