Skip to content

Commit fa72e44

Browse files
authored
Upload test results to codecov.io (#1857)
* Extract TEST_PHP_ARGS to env * Upload GHA test reports to codecov.io * Add server version and topology to expansion * Upload Evergreen test results to codecov.io * Upload test results for Windows tests
1 parent 10e4566 commit fa72e44

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

.evergreen/config/functions.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,26 @@ functions:
159159
- command: attach.results
160160
params:
161161
file_location: "${DRIVERS_TOOLS}/results.json"
162+
- command: shell.exec
163+
params:
164+
working_dir: src
165+
script: |
166+
${PREPARE_SHELL}
167+
if [ -f test-results.xml ]; then
168+
curl -Os https://cli.codecov.io/latest/linux/codecov
169+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
170+
shasum -a 256 -c codecov.SHA256SUM
171+
sudo chmod +x codecov
172+
./codecov upload-process \
173+
--report-type test_results \
174+
--disable-search \
175+
--fail-on-error \
176+
--token ${CODECOV_TOKEN} \
177+
--flag "${MONGODB_VERSION}-${TOPOLOGY}" \
178+
--file test-results.xml
179+
else
180+
echo "Skipping codecov test result upload"
181+
fi
162182
163183
"bootstrap mongo-orchestration":
164184
- command: shell.exec
@@ -176,6 +196,15 @@ functions:
176196
${PREPARE_SHELL}
177197
SKIP_LEGACY_SHELL=true \
178198
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
199+
- command: shell.exec
200+
params:
201+
include_expansions_in_env:
202+
- MONGODB_VERSION
203+
- TOPOLOGY
204+
script: |
205+
printf "\n" >> mo-expansion.yml
206+
printf "MONGODB_VERSION: '%s'\n" "${MONGODB_VERSION}" >> mo-expansion.yml
207+
printf "TOPOLOGY: '%s'\n" "${TOPOLOGY}" >> mo-expansion.yml
179208
# run-orchestration generates expansion file with MONGODB_URI and CRYPT_SHARED_LIB_PATH
180209
- command: expansions.update
181210
params:

.github/workflows/tests.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,20 @@ jobs:
7272
version: ${{ matrix.php-version }}
7373

7474
- name: "Run Tests"
75-
run: TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test
75+
run: make test
7676
env:
77+
TEST_PHP_ARGS: "-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP"
78+
TEST_PHP_JUNIT: "test-results.xml"
7779
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}
7880

81+
- name: Upload test results to Codecov
82+
uses: codecov/test-results-action@v1
83+
with:
84+
disable_search: true
85+
files: test-results.xml
86+
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
87+
token: ${{ secrets.CODECOV_TOKEN }}
88+
7989
pecl-test:
8090
name: "Test PECL package"
8191
runs-on: "ubuntu-latest"
@@ -177,6 +187,16 @@ jobs:
177187
topology: "server"
178188

179189
- name: "Run Tests"
180-
run: TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test
190+
run: make test
181191
env:
192+
TEST_PHP_ARGS: "-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP"
193+
TEST_PHP_JUNIT: "test-results.xml"
182194
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}
195+
196+
- name: Upload test results to Codecov
197+
uses: codecov/test-results-action@v1
198+
with:
199+
disable_search: true
200+
files: test-results.xml
201+
flags: "${{ ENV.SERVER_VERSION }}-server"
202+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/windows-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,14 @@ jobs:
9595
NO_INTERACTION: 1
9696
REPORT_EXIT_STATUS: 1
9797
TESTS: --show-diff
98+
TEST_PHP_JUNIT: "test-results.xml"
9899
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}
99100
CRYPT_SHARED_LIB_PATH: ${{ steps.setup-mongodb.outputs.crypt-shared-lib-path }}
101+
102+
- name: Upload test results to Codecov
103+
uses: codecov/test-results-action@v1
104+
with:
105+
disable_search: true
106+
files: test-results.xml
107+
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
108+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)