-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (86 loc) · 3.16 KB
/
test.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: 🧪 tests
on:
push:
pull_request:
types: [ opened, reopened, synchronize ]
workflow_call:
permissions:
contents: write
checks: write
pull-requests: write
jobs:
test:
strategy:
fail-fast: true
matrix:
#python-version: [ "3.9", "3.10", "3.11"]
#os: [ ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
name: 🧪 Run pytests
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
- name: 🐍Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: 🔨Install rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
- name: 🔨Install chrome driver
uses: nanasess/setup-chromedriver@v2
- name: 🔨Install dependencies
run: |
rye pin ${{ matrix.python-version }}
rye lock --update-all
rye sync
- run: mkdir results && touch results/test-results-${{ matrix.python-version }}-${{matrix.os}}-summary.md
- name: 🧪 Run tests
uses: aiakide/pytest-summary@rye
with:
extensions: pytest-cov icecream selenium pytest-selenium
options: --doctest-modules --cov-report term --cov-report xml:coverage-${{ matrix.python-version }}-${{matrix.os}}.xml --cov=nicemldashboard
paths: tests/**
output: test-results-${{ matrix.python-version }}-${{matrix.os}}-summary.md
show: "fail, skip"
- name: ⬆️ Upload pytest results
uses: actions/upload-artifact@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: pytest-results-${{ matrix.python-version }}-${{matrix.os}}
path: |
coverage-${{ matrix.python-version }}-${{matrix.os}}.xml
test-results-${{ matrix.python-version }}-${{matrix.os}}-summary.md
.test_report.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: 🖊️ Write job summary
run: |
if [[ "${{matrix.os}}" == "windows-latest" ]]
then
echo "No summary available for Windows runners" >> $GITHUB_STEP_SUMMARY
else
cat test-results-${{ matrix.python-version }}-${{matrix.os}}-summary.md >> $GITHUB_STEP_SUMMARY
fi
shell: bash
if: ${{ always() }}
- name: ✏️ Write test result as comment
uses: MishaKav/[email protected]
with:
pytest-xml-coverage-path: coverage-${{ matrix.python-version }}-${{matrix.os}}.xml
title: Coverage Report
badge-title: Code Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: true
remove-link-from-badge: false
junitxml-path: .test_report.xml
junitxml-title: Pytest summary
github-token: ${{ secrets.GITHUB_TOKEN }}