This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
105 lines (87 loc) · 2.44 KB
/
unitAndLint.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: unitTestsAndLint
on:
push:
# Only run if there are changes to Python code or related configurations
paths:
- "**.py"
- "**.yaml"
- "**.toml"
- ".flake8"
- "Pipfile"
- "Pipfile.lock"
branches:
- main
pull_request:
# Only run if there are changes to Python code or related configurations
paths:
- "**.py"
- "**.yaml"
- "**.toml"
- ".flake8"
- "Pipfile"
- "Pipfile.lock"
branches:
- main
jobs:
unitTests:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/setup-python
- name: Install Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv
# https://github.com/actions/checkout
- uses: actions/checkout@v4
- name: Install Python dependencies
run: |
pipenv sync --dev
- name: Test with pytest
run: |
mkdir test-reports
pipenv run pytest -v --junitxml=test-reports/junit.xml
# https://github.com/actions/upload-artifact
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: unitTest-report
path: test-reports/junit.xml
# Use always() to always run this step to publish test results when
# there are test failures
if: always()
lint:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/setup-python
- name: Install Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv
# https://github.com/actions/checkout
- uses: actions/checkout@v4
- name: Install Python dependencies
run: |
pipenv sync --dev
- name: Testing with flake8
run: |
mkdir test-reports
pipenv run flake8 ./ --output-file test-reports/flake8
- name: Testing with black
run: |
pipenv run black --check ./
# https://github.com/actions/upload-artifact
- name: Upload flake test results
uses: actions/upload-artifact@v4
with:
name: flake-report
path: test-reports/flake8
# Use failure() to upload only if failure occurs
if: failure()