Skip to content

Commit ae8178f

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

File tree

19 files changed

+1060
-396
lines changed

19 files changed

+1060
-396
lines changed

.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: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Code CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: ${{ matrix.os }}/${{ matrix.python }}
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
17+
steps:
18+
- name: Checkout Source
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: true
22+
23+
- uses: actions/setup-python@v2
24+
name: Install Python
25+
with:
26+
python-version: '3.7'
27+
28+
- name: Install Python Dependencies
29+
run: pip install twine build
30+
31+
- name: Build Sdist
32+
run: python -m build --sdist .
33+
34+
- name: Build Wheel
35+
uses: joerick/[email protected]
36+
env:
37+
CIBW_TEST_REQUIRES: pipfile-requirements
38+
CIBW_BEFORE_TEST: pipfile2req --dev > r.txt && pip install -r r.txt
39+
CIBW_TEST_COMMAND: pytest {project} --cov={package} --cov-report xml:cov.xml
40+
CIBW_REPAIR_WHEEL_COMMAND: ''
41+
42+
- name: Display structure of produced files
43+
run: ls -R dist wheelhouse
44+
45+
- name: Upload Wheel and Sdist
46+
uses: actions/upload-artifact@v2
47+
with:
48+
path: |
49+
./wheelhouse/*.whl
50+
dist/*
51+
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v1
54+
with:
55+
name: ${{ matrix.os }}/${{ matrix.python }}
56+
files: cov.xml
57+
58+
upload_pypi:
59+
needs: [build]
60+
runs-on: ubuntu-latest
61+
# upload to PyPI on every tag
62+
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
63+
steps:
64+
- uses: actions/download-artifact@v2
65+
with:
66+
path: dist
67+
68+
- name: Display structure of downloaded files
69+
run: ls -R
70+
71+
- name: Publish to PyPI
72+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
73+
env:
74+
TWINE_USERNAME: __token__
75+
TWINE_PASSWORD: ${{ secrets.pypi_token }}
76+
run: twine upload dist/*
77+

.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: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ 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+
# Same version of wheel as inside DLS
14+
wheel = "0.33.1"
15+
aioca = "*"
1316

1417
[packages]
1518
# All other package requirements from setup.py
16-
softioc = {editable = true,path = "."}
19+
softioc = {editable = true, path = "."}
20+
# Apart from the epicscorelibs which comes from pyproject.toml so needs to be here too
21+
epicscorelibs = "*"
22+
# And some other useful libs that pythonIocs might needs
23+
scipy = "*"
24+
cothread = "*"
1725

1826
[scripts]
1927
# Put coverage here so we don't interfere with debugging in the IDE
20-
tests = "python -m pytest --cov=epicsdbbuilder --cov-report term"
28+
tests = "python -m pytest --cov=softioc --cov-report term"
2129
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"
30+
gitclean = "git clean -fdX"

0 commit comments

Comments
 (0)