Skip to content

Commit 09cf630

Browse files
authored
Merge pull request #120 from BurningEnlightenment/dev/ci
ci: Split deployment jobs into separate workflows
2 parents a5c2347 + 9fcb06e commit 09cf630

File tree

6 files changed

+240
-78
lines changed

6 files changed

+240
-78
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 4
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
max_line_length = 79
12+
13+
[*.{md,rst}]
14+
trim_trailing_whitespace = false
15+
16+
[*.y{,a}ml]
17+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/build.yml

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
name: build
22

33
on:
4-
push:
54
pull_request:
5+
workflow_call:
66

77
jobs:
88
build:
99
name: Build and Test Package
1010
strategy:
11-
matrix:
12-
version:
13-
- '3.8'
14-
- '3.9'
15-
- '3.10'
16-
- '3.11'
17-
- '3.12'
18-
os: [ubuntu-latest, windows-latest]
11+
matrix:
12+
version:
13+
- '3.8'
14+
- '3.9'
15+
- '3.10'
16+
- '3.11'
17+
- '3.12'
18+
os: [ubuntu-latest, windows-latest]
19+
include:
20+
- version: '3.12'
21+
os: ubuntu-latest
22+
upload: true
1923
runs-on: ${{ matrix.os }}
2024

2125
steps:
22-
- name: Check out repository
23-
uses: actions/checkout@v4
24-
25-
- name: Set up Python
26+
- uses: actions/checkout@v4
27+
- name: Set up Python ${{ matrix.version }}
2628
uses: actions/setup-python@v5
2729
with:
2830
python-version: ${{ matrix.version }}
2931

30-
- name: Install package
32+
- name: Install packages
3133
run: pip install .
3234

3335
- name: Run tests
@@ -42,9 +44,8 @@ jobs:
4244
4345
- name: Upload the Docs
4446
uses: actions/upload-pages-artifact@v3
45-
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12'
47+
if: matrix.upload
4648
with:
47-
name: docs
4849
path: html/
4950

5051
- name: Install pypa/build
@@ -54,69 +55,8 @@ jobs:
5455
run: python3 -m build
5556

5657
- name: Store the distribution packages
57-
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.12'
58+
if: matrix.upload
5859
uses: actions/upload-artifact@v4
5960
with:
6061
name: python-package-distributions
6162
path: dist/
62-
63-
deploy-docs:
64-
name: Deploy Docs to GitHub Pages
65-
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }}
66-
runs-on: ubuntu-latest
67-
needs: [build]
68-
permissions:
69-
pages: write # to deploy to Pages
70-
id-token: write # to verify the deployment originates from an appropriate source
71-
environment:
72-
name: github-pages
73-
url: ${{ steps.deployment.outputs.page_url }}
74-
75-
steps:
76-
- name: Deploy to GitHub Pages
77-
id: deployment
78-
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
79-
with:
80-
artifact_name: docs
81-
82-
deploy-testpypi:
83-
name: Deploy Distribution to Test PyPI
84-
if: false # Currently disabled
85-
needs: [build]
86-
runs-on: ubuntu-latest
87-
environment:
88-
name: testpypi
89-
url: https://test.pypi.org/p/sphinx-multiversion
90-
permissions:
91-
id-token: write
92-
93-
steps:
94-
- name: Download the Distributions
95-
uses: actions/download-artifact@v4
96-
with:
97-
name: python-package-distributions
98-
path: dist/
99-
100-
- name: Publish Distributions to Test PyPI
101-
uses: pypa/gh-action-pypi-publish@release/v1
102-
103-
deploy-pypi:
104-
name: Deploy Distribution to PyPI
105-
if: startsWith(github.ref, 'refs/tags/')
106-
needs: [build]
107-
runs-on: ubuntu-latest
108-
environment:
109-
name: pypi
110-
url: https://pypi.org/p/sphinx-multiversion
111-
permissions:
112-
id-token: write
113-
114-
steps:
115-
- name: Download the Distributions
116-
uses: actions/download-artifact@v4
117-
with:
118-
name: python-package-distributions
119-
path: dist/
120-
121-
- name: Publish Distributions to PyPI
122-
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy docs to Github Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*'
8+
9+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
10+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
if: github.ref_protected == true
18+
uses: ./.github/workflows/build.yml
19+
20+
deploy-docs:
21+
name: Deploy Docs to GitHub Pages
22+
if: github.ref_protected == true
23+
runs-on: ubuntu-latest
24+
needs: [build]
25+
permissions:
26+
pages: write # to deploy to Pages
27+
id-token: write # to verify the deployment originates from an appropriate source
28+
environment:
29+
name: github-pages
30+
url: ${{ steps.deployment.outputs.page_url }}
31+
32+
steps:
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v4

.github/workflows/deploy-pypi.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: deploy-pypi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
if: github.ref_protected == true
10+
uses: ./.github/workflows/build.yml
11+
12+
deploy-pypi:
13+
if: github.ref_protected == true
14+
needs: [build]
15+
strategy:
16+
matrix:
17+
environment: [test.pypi, pypi]
18+
name: Deploy Distribution to ${{ matrix.environment }}.org
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: ${{ matrix.environment }}
22+
url: https://${{ matrix.environment }}.org/p/sphinx-multiversion
23+
permissions:
24+
id-token: write
25+
26+
steps:
27+
- name: Download the Distributions
28+
uses: actions/download-artifact@v4 # eventually rely on artifacts uploaded to the draft release
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
- name: Publish Distributions to ${{ matrix.environment }}.org
34+
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597

.gitignore

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Sphinx documentation
55+
docs/_build/
56+
57+
# PyBuilder
58+
.pybuilder/
59+
target/
60+
61+
# Jupyter Notebook
62+
.ipynb_checkpoints
63+
64+
# IPython
65+
profile_default/
66+
ipython_config.py
67+
68+
# pyenv
69+
# For a library or package, you might want to ignore these files since the code is
70+
# intended to run in multiple environments; otherwise, check them in:
71+
# .python-version
72+
73+
# pipenv
74+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
75+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
76+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
77+
# install all needed dependencies.
78+
#Pipfile.lock
79+
80+
# poetry
81+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
82+
# This is especially recommended for binary packages to ensure reproducibility, and is more
83+
# commonly ignored for libraries.
84+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
85+
#poetry.lock
86+
87+
# pdm
88+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
89+
#pdm.lock
90+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
91+
# in version control.
92+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
93+
.pdm.toml
94+
.pdm-python
95+
.pdm-build/
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# pytype static type analyzer
132+
.pytype/
133+
134+
# Cython debug symbols
135+
cython_debug/

0 commit comments

Comments
 (0)