diff --git a/.evergreen/config/functions.yml b/.evergreen/config/functions.yml index e5a40634a..9130c8e32 100644 --- a/.evergreen/config/functions.yml +++ b/.evergreen/config/functions.yml @@ -159,6 +159,26 @@ functions: - command: attach.results params: file_location: "${DRIVERS_TOOLS}/results.json" + - command: shell.exec + params: + working_dir: src + script: | + ${PREPARE_SHELL} + if [ -f test-results.xml ]; then + curl -Os https://cli.codecov.io/latest/linux/codecov + curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM + shasum -a 256 -c codecov.SHA256SUM + sudo chmod +x codecov + ./codecov upload-process \ + --report-type test_results \ + --disable-search \ + --fail-on-error \ + --token ${CODECOV_TOKEN} \ + --flag "${MONGODB_VERSION}-${TOPOLOGY}" \ + --file test-results.xml + else + echo "Skipping codecov test result upload" + fi "bootstrap mongo-orchestration": - command: shell.exec @@ -176,6 +196,15 @@ functions: ${PREPARE_SHELL} SKIP_LEGACY_SHELL=true \ bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh + - command: shell.exec + params: + include_expansions_in_env: + - MONGODB_VERSION + - TOPOLOGY + script: | + printf "\n" >> mo-expansion.yml + printf "MONGODB_VERSION: '%s'\n" "${MONGODB_VERSION}" >> mo-expansion.yml + printf "TOPOLOGY: '%s'\n" "${TOPOLOGY}" >> mo-expansion.yml # run-orchestration generates expansion file with MONGODB_URI and CRYPT_SHARED_LIB_PATH - command: expansions.update params: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf4a8b3cf..0b612f55e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,10 +71,20 @@ jobs: version: ${{ matrix.php-version }} - name: "Run Tests" - run: TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test + run: make test env: + TEST_PHP_ARGS: "-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" + TEST_PHP_JUNIT: "test-results.xml" MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }} + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + disable_search: true + files: test-results.xml + flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}" + token: ${{ secrets.CODECOV_TOKEN }} + pecl-test: name: "Test PECL package" runs-on: "ubuntu-latest" @@ -176,6 +186,16 @@ jobs: topology: "server" - name: "Run Tests" - run: TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test + run: make test env: + TEST_PHP_ARGS: "-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" + TEST_PHP_JUNIT: "test-results.xml" MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }} + + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + disable_search: true + files: test-results.xml + flags: "${{ ENV.SERVER_VERSION }}-server" + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/windows-tests.yml b/.github/workflows/windows-tests.yml index 337c92042..675eacd91 100644 --- a/.github/workflows/windows-tests.yml +++ b/.github/workflows/windows-tests.yml @@ -95,5 +95,14 @@ jobs: NO_INTERACTION: 1 REPORT_EXIT_STATUS: 1 TESTS: --show-diff + TEST_PHP_JUNIT: "test-results.xml" MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }} CRYPT_SHARED_LIB_PATH: ${{ steps.setup-mongodb.outputs.crypt-shared-lib-path }} + + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + disable_search: true + files: test-results.xml + flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}" + token: ${{ secrets.CODECOV_TOKEN }}