106 lines (105 loc) · 3.4 KB
/
validate.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
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
106
name: validate
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: paths-filter
with:
filters: |
run_tests:
- .github/actions/**/*.yml
- .github/workflows/**/*.yml
- policies/**/*.yaml
- policies/**/*.yml
- policies/**/*.pol
- policies/**/*.inc
- def/**/*.yaml
- def/**/*.yml
- def/**/*.net
- def/**/*.svc
- tests/**/*.ref
- codecov.yml
- poetry.toml
- pyproject.toml
- '**.py'
#----------------------------------------------
# Install Python, Poetry, and CI deps
#----------------------------------------------
- name: Set up CI dependencies
if: steps.paths-filter.outputs.run_tests == 'true'
uses: ./.github/actions/setup
id: project-setup
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# run test suite and output coverage file
#----------------------------------------------
- name: Test with pytest
if: steps.paths-filter.outputs.run_tests == 'true'
run: |
poetry run coverage erase
poetry run coverage run
poetry run coverage xml
#----------------------------------------------
# upload coverage to codecov
#----------------------------------------------
- name: Upload coverage to Codecov
if: steps.paths-filter.outputs.run_tests == 'true'
uses: codecov/codecov-action@v3
with:
directory: ./
env_vars: OS,PYTHON
files: ./coverage.xml
flags: tests
name: codecov-umbrella
verbose: true
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: paths-filter
with:
filters: |
run_format:
- '**.py'
#----------------------------------------------
# Install Python, Poetry, and CI deps
#----------------------------------------------
- name: Set up CI dependencies
if: steps.paths-filter.outputs.run_format == 'true'
uses: ./.github/actions/setup
id: project-setup
with:
python-version: "3.10"
#----------------------------------------------
# run 'black', will use installed version
#----------------------------------------------
- name: Format project using Black
if: steps.paths-filter.outputs.run_format == 'true'
uses: psf/black@stable
with:
version: "22.12.0"
#----------------------------------------------
# run isort
#----------------------------------------------
- name: Format project using isort
if: steps.paths-filter.outputs.run_format == 'true'
uses: isort/isort-action@v1.1.0
with:
isort-version: ""