-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (110 loc) · 3.74 KB
/
_local_ci_tests.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI - Tests
on:
pull_request:
push:
branches:
- 'main'
- 'push-action/**'
jobs:
base-tests:
name: Call reusable workflow
uses: ./.github/workflows/ci_tests.yml
with:
# general
install_extras: "[dev,docs,testing]"
# pre-commit
skip_pre-commit_hooks: pylint,pylint-tests
# pylint
pylint_runs: |
--rcfile=pyproject.toml ci_cd
--rcfile=pyproject.toml --disable=import-outside-toplevel,redefined-outer-name tests
# build dist
build_libs: flit
build_cmd: flit build
# build docs
update_python_api_ref: true
update_docs_landing_page: false
package_dirs: ci_cd
debug: false
pytest:
name: pytest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version}}
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .[testing]
- name: Test with pytest
run: pytest -vvv --cov=ci_cd --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'SINTEF/ci-cd'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# These jobs are mainly to test a default run of the hooks including `--pre-commit`
run_hooks:
name: Run custom pre-commit hooks
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.10"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version}}
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel flit
pip install -e .
pip install -U pre-commit
# docs-api-reference
- name: Run docs-api-reference ('ci-cd create-api-reference-docs')
run: python .github/utils/run_hooks.py docs-api-reference
- name: Run docs-api-reference ('ci-cd create-api-reference-docs') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py docs-api-reference
shell: cmd
# docs-landing-page
- name: Run docs-landing-page ('ci-cd create-docs-index')
run: python .github/utils/run_hooks.py docs-landing-page
- name: Run docs-landing-page ('ci-cd create-docs-index') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py docs-landing-page
shell: cmd
# update-pyproject
- name: Run update-pyproject ('ci-cd update-deps')
run: python .github/utils/run_hooks.py update-pyproject
- name: Run update-pyproject ('ci-cd update-deps') (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py update-pyproject
shell: cmd
# set-version
- name: Run 'ci-cd setver'
run: python .github/utils/run_hooks.py set-version
- name: Run 'ci-cd setver' (cmd)
if: runner.os == 'Windows'
run: python .github/utils/run_hooks.py set-version
shell: cmd
- name: Bare run
if: runner.os == 'Windows'
run: pre-commit run -c .github/utils/.pre-commit-config_testing.yaml --all-files --verbose docs-api-reference
shell: cmd