generated from wayfair-incubator/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (47 loc) · 1.68 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: "Unit Tests"
on:
pull_request: {}
push:
branches: ["main"]
env:
PYTHON_VERSION: "3.10.1"
jobs:
test:
name: Pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
uses: ./.github/actions/install-dependencies
with:
requirements: "true"
test-requirements: "true"
- name: Run pytest
run: pytest --cov plugin_scripts/ tests --cov-report xml:coverage-${{ env.PYTHON_VERSION }}.xml --junitxml=test-results-${{ env.PYTHON_VERSION }}.xml
- name: Upload pytest test results artifact
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ env.PYTHON_VERSION }}
path: test-results-${{ env.PYTHON_VERSION }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload coverage results artifact
uses: actions/upload-artifact@v3
with:
name: pytest-coverage-${{ env.PYTHON_VERSION }}
path: coverage-${{ env.PYTHON_VERSION }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Publish coverage results to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-${{ env.PYTHON_VERSION }}.xml
fail_ci_if_error: true