-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (92 loc) · 2.73 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
name: Build and publish the package to PyPi registry
env:
PACKAGE_NAME: cluster_conformers
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.10.15]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version}}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest pytest-cov pre-commit
pre-commit install
- name: Run pre-commit
run: pre-commit run --all
- name: Run Tests
run: |
coverage run -m pytest --junitxml=report.xml
coverage xml -o coverage/cobertura-coverage.xml
coverage report -m
- name: Upload coverage to Codecov
if: github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v1
with:
file: ./coverage/cobertura-coverage.xml
flags: unittests
name: codecov-${{ env.PACKAGE_NAME }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Create distribution
if: github.ref == 'refs/heads/main'
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Upload artifact for publish job
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-app
path: dist/
documentation:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10.15]
needs: build
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version}}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install -e ".[docs]"
- name: Build documentation
run: |
cd doc
make html
- name: Deploy pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/_build/html
publish:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-app
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
continue-on-error: false