Skip to content

Commit c11f0fe

Browse files
authored
Add junit test results to CI (#5412)
* Add junit test results to CI
1 parent b9739f7 commit c11f0fe

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ jobs:
5757
uses: actions/cache@v2
5858
with:
5959
path: ~/conda_pkgs_dir
60-
key:
61-
${{ runner.os }}-conda-py${{ matrix.python-version }}-${{
60+
key: ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{
6261
hashFiles('ci/requirements/**.yml') }}
6362
- uses: conda-incubator/setup-miniconda@v2
6463
with:
@@ -87,10 +86,17 @@ jobs:
8786
run: |
8887
python -c "import xarray"
8988
- name: Run tests
90-
run: |
91-
python -m pytest -n 4 \
92-
--cov=xarray \
93-
--cov-report=xml
89+
run: python -m pytest -n 4
90+
--cov=xarray
91+
--cov-report=xml
92+
--junitxml=test-results/${{ runner.os }}-${{ matrix.python-version }}.xml
93+
94+
- name: Upload test results
95+
if: always()
96+
uses: actions/upload-artifact@v2
97+
with:
98+
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
99+
path: test-results/${{ runner.os }}-${{ matrix.python-version }}.xml
94100

95101
- name: Upload code coverage to Codecov
96102
uses: codecov/codecov-action@v1
@@ -100,3 +106,20 @@ jobs:
100106
env_vars: RUNNER_OS,PYTHON_VERSION
101107
name: codecov-umbrella
102108
fail_ci_if_error: false
109+
110+
publish-test-results:
111+
needs: test
112+
runs-on: ubuntu-latest
113+
# the build-and-test job might be skipped, we don't need to run this job then
114+
if: success() || failure()
115+
116+
steps:
117+
- name: Download Artifacts
118+
uses: actions/download-artifact@v2
119+
with:
120+
path: test-results
121+
122+
- name: Publish Unit Test Results
123+
uses: EnricoMi/publish-unit-test-result-action@v1
124+
with:
125+
files: test-results/*.xml

0 commit comments

Comments
 (0)