-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (60 loc) · 1.73 KB
/
ci.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
name: CI
on: [push, pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diraccfg'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: False
matrix:
python_version:
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Prepare environment
run: .github/workflows/prepare_environment.sh ${{ matrix.python_version }}
- name: Run pytest
run: |
. "${CONDA}/bin/activate" test-env
pytest
- name: Run mypy
run: |
. "${CONDA}/bin/activate" test-env
mypy
- name: Run pylint
run: |
. "${CONDA}/bin/activate" test-env
pylint -E src/diraccfg/ tests/
publish-pypi:
runs-on: ubuntu-latest
name: Publish package to PyPI
needs: [pytest, pre-commit]
steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Prepare environment
run: .github/workflows/prepare_environment.sh 3
- name: Build distributions
run: |
. "${CONDA}/bin/activate" test-env
python setup.py sdist bdist_wheel --universal
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}