-
Notifications
You must be signed in to change notification settings - Fork 11
152 lines (135 loc) · 4.8 KB
/
main.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: main
defaults:
run:
shell: bash
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 12 * * 4'
release:
types: [published]
jobs:
precommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Linting
run: |
pip install pre-commit
pre-commit clean
pre-commit autoupdate
pre-commit run --all-files
pdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Build
run: |
pip3 install pdoc3
pip install -e .
pip install -r test-time-requirements.txt
python -We -m pdoc --html PySDM_examples
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
BRANCH: pdoc
FOLDER: html/PySDM_examples
CLEAN: true
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint==2.14.5 nbqa
python setup.py egg_info
pip install -r *.egg-info/requires.txt
pip install -r test-time-requirements.txt
- name: Analysing the code with pylint
run: |
# TODO #682
pylint --max-module-lines=550 --unsafe-load-any-extension=y --disable=fixme,too-many-function-args,unsubscriptable-object,consider-using-with,protected-access,too-many-statements,too-many-public-methods,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,missing-class-docstring,too-many-locals,too-many-instance-attributes,too-few-public-methods,too-many-arguments $(git ls-files '*.py')
- name: Analysing notebook code with pylint
run: |
# TODO #682
nbqa pylint --unsafe-load-any-extension=y --disable=fixme,duplicate-code,invalid-name,trailing-whitespace,line-too-long,missing-function-docstring,wrong-import-position,missing-module-docstring,wrong-import-order,ungrouped-imports,no-member,too-many-locals,redefined-outer-name,unnecessary-lambda-assignment $(git ls-files '*.ipynb')
build:
needs: [pylint, pdoc, precommit]
strategy:
matrix:
platform: [ubuntu-22.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- run: |
python -m pip install --upgrade --user pip
- run: |
python -m pip install --user -e .
- run: |
python -We -c "import PySDM_examples"
- run: |
python -m pip install --user -r test-time-requirements.txt
- run: |
python -m pip install --user -e .
# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: startsWith(matrix.platform, 'ubuntu-')
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV
- if: startsWith(matrix.platform, 'ubuntu-')
run: |
sudo apt-get install python3-paraview
- if: startsWith(matrix.platform, 'macos-')
run: |
brew install --cask paraview
echo `dirname /Applications/ParaView-*.app/Contents/bin/pvpython | head -1` >> $GITHUB_PATH
- if: matrix.platform != 'windows-latest'
run: pvpython --version
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python -m pytest -v -p no:unraisableexception -We
dist:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- run: pip install twine build
- run: |
unset CI
python -m build 2>&1 | tee build.log
exit `fgrep -i warning build.log | wc -l`
- run: twine check --strict dist/*
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@unstable/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}