-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (116 loc) · 3.55 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
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
name: CI/CD
on: push
jobs:
test:
name: Test Python
runs-on: ubuntu-24.04
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run checks for Python ${{ matrix.python-version }}
env:
CI: true
run: |
python -V
pip install -r requirements.txt
git --no-pager diff --check `git log --oneline | tail -1 | cut --fields=1 --delimiter=' '`
flake8
py.test -vv --cov-config .coveragerc --cov geolink_formatter tests
- name: Send coverage for Python ${{ matrix.python-version }}
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
name: Python ${{ matrix.python-version }}
fail_ci_if_error: true
verbose: true
deploy-dev:
name: Deploy to PyPI Test
needs:
- test
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Build packages
run: |
python -m venv .venv
.venv/bin/pip install wheel -r requirements.txt
sed -i "s/\(version='[0-9]*\.[0-9]*\.[0-9]*\)\('\)/\1.dev$(date +%Y%m%d%H%M%S)\2/g" setup.py
sed -i "s/5 - Production\/Stable/4 - Beta/g" setup.py
.venv/bin/python setup.py clean check sdist bdist_wheel
- name: Upload to PyPI Test
uses: pypa/[email protected]
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
deploy-tag:
name: Deploy to PyPI
needs:
- test
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Build packages
run: |
python -m venv .venv
.venv/bin/pip install wheel -r requirements.txt
.venv/bin/python setup.py clean check sdist bdist_wheel
- name: Upload to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_TOKEN }}
build-doc:
name: Build docs for each version
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Build docs
run: |
python -V
pip install -r requirements.txt
sphinx-build -b html doc/source/ doc/build/html/
touch doc/build/html/.nojekyll
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: doc/build/html/
retention-days: 1
deploy-doc:
name: Deploy docs to GitHub Pages
needs:
- build-doc
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: docs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: doc/build/html