Skip to content

Commit 0186328

Browse files
committed
Build system for pipenv, docs, CI
1 parent af652c2 commit 0186328

22 files changed

Lines changed: 1098 additions & 408 deletions

.github/pages/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Redirecting to master branch</title>
5+
<meta charset="utf-8">
6+
<meta http-equiv="refresh" content="0; url=./master/index.html">
7+
<link rel="canonical" href="master/index.html">
8+
</head>
9+
</html>

.github/workflows/code.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Code CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
lint:
9+
runs-on: "ubuntu-latest"
10+
steps:
11+
- name: Checkout Source
12+
uses: actions/checkout@v2
13+
14+
- name: Install Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.7'
18+
19+
- name: Install Python Dependencies
20+
run: pip install flake8
21+
22+
- name: Lint
23+
run: flake8
24+
25+
build:
26+
name: ${{ matrix.os }}/${{ matrix.python }}
27+
runs-on: ${{ matrix.os }}
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
os: [ubuntu-latest, windows-latest, macos-latest]
33+
python: [cp27, cp37, cp38, cp39]
34+
35+
include:
36+
- os: macos-latest
37+
TEST_REQUIRES: pytest-cov cothread
38+
39+
- os: ubuntu-latest
40+
TEST_REQUIRES: pytest-cov cothread
41+
42+
- os: windows-latest
43+
# cothread doesn't work on windows
44+
TEST_REQUIRES: pytest-cov
45+
46+
steps:
47+
- name: Checkout Source
48+
uses: actions/checkout@v2
49+
with:
50+
submodules: true
51+
52+
- name: Install Python
53+
uses: actions/setup-python@v2
54+
with:
55+
python-version: '3.7'
56+
57+
- name: Install Python Dependencies
58+
run: pip install twine build cibuildwheel
59+
60+
- name: Build Sdist
61+
run: python -m build --sdist .
62+
63+
- run: ls -R dist
64+
65+
- name: Build Wheel
66+
run: cibuildwheel --output-dir dist
67+
env:
68+
CIBW_BUILD: ${{ matrix.python }}*64
69+
CIBW_TEST_REQUIRES: ${{ matrix.TEST_REQUIRES }}
70+
CIBW_TEST_COMMAND: pytest --cov=softioc {project}/tests --cov-report xml:{project}/dist/coverage.xml && ls -R {project}/dist
71+
# Disable auditwheel as it isn't compatible with setuptools_dso approach
72+
# https://github.com/mdavidsaver/setuptools_dso/issues/17
73+
CIBW_REPAIR_WHEEL_COMMAND: ''
74+
75+
- run: ls -R dist
76+
77+
- name: Upload Wheel and Sdist
78+
uses: actions/upload-artifact@v2
79+
with:
80+
path: dist/softioc*
81+
82+
- name: Upload coverage to Codecov
83+
uses: codecov/codecov-action@v1
84+
with:
85+
name: ${{ matrix.os }}/${{ matrix.python }}
86+
directory: dist
87+
88+
upload_pypi:
89+
needs: [build]
90+
runs-on: ubuntu-latest
91+
# upload to PyPI on every tag
92+
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
93+
steps:
94+
- uses: actions/download-artifact@v2
95+
with:
96+
path: dist
97+
98+
- name: Display structure of downloaded files
99+
run: ls -R
100+
101+
- name: Publish to PyPI
102+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
103+
env:
104+
TWINE_USERNAME: __token__
105+
TWINE_PASSWORD: ${{ secrets.pypi_token }}
106+
run: twine upload dist/*
107+

.github/workflows/docs.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
name: Docs CI
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Source
14+
uses: actions/checkout@v2
15+
with:
16+
# require all of history to see all tagged versions' docs
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.7"
23+
24+
- name: Install Packages
25+
# Can delete this if you don't use graphviz in your docs
26+
run: sudo apt-get install graphviz
27+
28+
- name: Install Python Dependencies
29+
run: |
30+
pip install pipenv
31+
pipenv install --dev --deploy --python $(which python) && pipenv graph
32+
33+
- name: Deploy index
34+
# We pin to the SHA, not the tag, for security reasons.
35+
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
36+
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: .github/pages
40+
keep_files: true
41+
42+
- name: Checkout gh-pages
43+
# As we already did a deploy of gh-pages above, it is guaranteed to be there
44+
# so check it out so we can selectively build docs below
45+
uses: actions/checkout@v2
46+
with:
47+
ref: gh-pages
48+
path: build/html
49+
50+
- name: Maybe use sphinx-multiversion
51+
# If we are building master or a tag we will publish
52+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
53+
# So use the args we normally pass to sphinx-build, but run sphinx-multiversion
54+
run: mv $(pipenv --venv)/bin/sphinx-multiversion $(pipenv --venv)/bin/sphinx-build
55+
56+
- name: Build Docs
57+
run: pipenv run docs
58+
59+
- name: Publish Docs to gh-pages
60+
# Only master and tags are published
61+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
62+
# We pin to the SHA, not the tag, for security reasons.
63+
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
64+
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: build/html
68+
keep_files: true
69+

.gitignore

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,67 @@
1-
/.vscode
2-
/venv
3-
*.pyc
4-
/docs/html/
5-
/softioc/_extension.*
6-
7-
# Dist build output
8-
/build
9-
/dist
10-
/softioc.egg-info/
11-
12-
# Coverage reports
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
26+
# PyInstaller
27+
# Usually these files are written by a python script from a template
28+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
29+
*.manifest
30+
*.spec
31+
32+
# Installer logs
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
36+
# Unit test / coverage reports
37+
htmlcov/
38+
.tox/
1339
.coverage
40+
.coverage.*
41+
.cache
42+
nosetests.xml
43+
coverage.xml
44+
*,cover
45+
*.mypy_cache
46+
*.pytest_cache
1447
cov.xml
1548

49+
# DLS build dir and virtual environment
50+
/prefix/
51+
/venv/
52+
/lightweight-venv/
53+
/installed.files
54+
55+
# Docs output
1656
/docs/papers/*/*.aux
1757
/docs/papers/*/*.pdf
1858
/docs/papers/*/*.nav
1959
/docs/papers/*/*.out
2060
/docs/papers/*/*.snm
2161
/docs/papers/*/*.toc
2262
/docs/papers/*/*.vrb
63+
64+
# setup.py develop (via pipenv install) places this link here
65+
# so editable installs work. Related:
66+
# https://github.com/mdavidsaver/setuptools_dso/issues/11
67+
/epicscorelibs

Pipfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ sphinx-rtd-theme = "*"
1010
# switch to main repo after PR https://github.com/Holzhaus/sphinx-multiversion/pull/60 is merged
1111
sphinx-multiversion = {editable = true,git = "https://github.com/dls-controls/sphinx-multiversion.git",ref = "only-arg"}
1212
setuptools-dso = "*"
13+
aioca = "*"
1314

1415
[packages]
1516
# All other package requirements from setup.py
16-
softioc = {editable = true,path = "."}
17+
softioc = {editable = true, path = "."}
18+
# Apart from the epicscorelibs which comes from pyproject.toml so needs to be here too
19+
epicscorelibs = "*"
20+
# Add some other useful extras
21+
cothread = "*"
22+
scipy = "*"
1723

1824
[scripts]
1925
# Put coverage here so we don't interfere with debugging in the IDE
20-
tests = "python -m pytest --cov=epicsdbbuilder --cov-report term"
26+
tests = "python -m pytest --cov=softioc --cov-report term"
2127
docs = "sphinx-build -EWT --keep-going docs build/html"
22-
clean = "rm -rf build prefix */__pycache__ .coverage cov.xml *.egg-info .mypy_cache .pytest_cache"
28+
gitclean = "git clean -fdX"

0 commit comments

Comments
 (0)