Skip to content

Commit 01feb02

Browse files
Merge pull request #248 from stringertheory/update_ci
update repository structure
2 parents dd53026 + 85a70b6 commit 01feb02

File tree

14 files changed

+689
-203
lines changed

14 files changed

+689
-203
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
max_line_length = 80
2+
3+
[*.json]
4+
indent_style = space
5+
indent_size = 2
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "setup-poetry-env"
2+
description: "Composite action to setup the Python and poetry environment."
3+
4+
inputs:
5+
python-version:
6+
required: false
7+
description: "The python version to use"
8+
default: "3.11"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
18+
- name: Install Poetry
19+
uses: snok/install-poetry@v1
20+
with:
21+
virtualenvs-in-project: true
22+
23+
- name: Load cached venv
24+
id: cached-poetry-dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: .venv
28+
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
29+
30+
- name: Install dependencies
31+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
32+
run: poetry install --no-interaction
33+
shell: bash

.github/workflows/main.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
quality:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out
15+
uses: actions/checkout@v3
16+
17+
- uses: actions/cache@v3
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21+
22+
- name: Set up the environment
23+
uses: ./.github/actions/setup-poetry-env
24+
25+
- name: Run checks
26+
run: make check
27+
28+
tox:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
python-version: ['3.8', '3.9', '3.10', '3.11']
33+
fail-fast: false
34+
steps:
35+
- name: Check out
36+
uses: actions/checkout@v3
37+
38+
- name: Set up python
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Install Poetry
44+
uses: snok/install-poetry@v1
45+
46+
- name: Load cached venv
47+
uses: actions/cache@v3
48+
with:
49+
path: .tox
50+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
51+
52+
- name: Install tox
53+
run: |
54+
python -m pip install --upgrade pip
55+
python -m pip install tox tox-gh-actions
56+
57+
- name: Test with tox
58+
run: tox
59+
60+
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
61+
uses: codecov/codecov-action@v3
62+
if: ${{ matrix.python-version == '3.11' }}
63+
64+
check-docs:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Check out
68+
uses: actions/checkout@v3
69+
70+
- name: Set up the environment
71+
uses: ./.github/actions/setup-poetry-env
72+
73+
- name: Check if documentation can be built
74+
run: poetry run mkdocs build -s

.github/workflows/on-release-main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: release-main
2+
3+
on:
4+
release:
5+
types: [published]
6+
branches: [main]
7+
8+
jobs:
9+
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out
14+
uses: actions/checkout@v3
15+
16+
- name: Set up the environment
17+
uses: ./.github/actions/setup-poetry-env
18+
19+
- name: Export tag
20+
id: vars
21+
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
22+
23+
- name: Build and publish
24+
run: |
25+
source .venv/bin/activate
26+
poetry version $RELEASE_VERSION
27+
make build-and-publish
28+
env:
29+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
30+
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
31+
32+
deploy-docs:
33+
needs: publish
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Check out
37+
uses: actions/checkout@v3
38+
39+
- name: Set up the environment
40+
uses: ./.github/actions/setup-poetry-env
41+
42+
- name: Deploy documentation
43+
run: poetry run mkdocs gh-deploy --force
44+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: validate-codecov-config
2+
3+
on:
4+
pull_request:
5+
paths: [codecov.yaml]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
validate-codecov-config:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Validate codecov configuration
15+
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate

.gitignore

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,171 @@ docs/_build
5656
# PyBuilder
5757
target/
5858
.vscode
59+
60+
docs/source
61+
62+
# From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
63+
64+
# Byte-compiled / optimized / DLL files
65+
__pycache__/
66+
*.py[cod]
67+
*$py.class
68+
69+
# C extensions
70+
*.so
71+
72+
# Distribution / packaging
73+
.Python
74+
build/
75+
develop-eggs/
76+
dist/
77+
downloads/
78+
eggs/
79+
.eggs/
80+
lib/
81+
lib64/
82+
parts/
83+
sdist/
84+
var/
85+
wheels/
86+
share/python-wheels/
87+
*.egg-info/
88+
.installed.cfg
89+
*.egg
90+
MANIFEST
91+
92+
# PyInstaller
93+
# Usually these files are written by a python script from a template
94+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
95+
*.manifest
96+
*.spec
97+
98+
# Installer logs
99+
pip-log.txt
100+
pip-delete-this-directory.txt
101+
102+
# Unit test / coverage reports
103+
htmlcov/
104+
.tox/
105+
.nox/
106+
.coverage
107+
.coverage.*
108+
.cache
109+
nosetests.xml
110+
coverage.xml
111+
*.cover
112+
*.py,cover
113+
.hypothesis/
114+
.pytest_cache/
115+
cover/
116+
117+
# Translations
118+
*.mo
119+
*.pot
120+
121+
# Django stuff:
122+
*.log
123+
local_settings.py
124+
db.sqlite3
125+
db.sqlite3-journal
126+
127+
# Flask stuff:
128+
instance/
129+
.webassets-cache
130+
131+
# Scrapy stuff:
132+
.scrapy
133+
134+
# Sphinx documentation
135+
docs/_build/
136+
137+
# PyBuilder
138+
.pybuilder/
139+
target/
140+
141+
# Jupyter Notebook
142+
.ipynb_checkpoints
143+
144+
# IPython
145+
profile_default/
146+
ipython_config.py
147+
148+
# pyenv
149+
# For a library or package, you might want to ignore these files since the code is
150+
# intended to run in multiple environments; otherwise, check them in:
151+
# .python-version
152+
153+
# pipenv
154+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
155+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
156+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
157+
# install all needed dependencies.
158+
#Pipfile.lock
159+
160+
# poetry
161+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
162+
# This is especially recommended for binary packages to ensure reproducibility, and is more
163+
# commonly ignored for libraries.
164+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
165+
#poetry.lock
166+
167+
# pdm
168+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
169+
#pdm.lock
170+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
171+
# in version control.
172+
# https://pdm.fming.dev/#use-with-ide
173+
.pdm.toml
174+
175+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
176+
__pypackages__/
177+
178+
# Celery stuff
179+
celerybeat-schedule
180+
celerybeat.pid
181+
182+
# SageMath parsed files
183+
*.sage.py
184+
185+
# Environments
186+
.env
187+
.venv
188+
env/
189+
venv/
190+
ENV/
191+
env.bak/
192+
venv.bak/
193+
194+
# Spyder project settings
195+
.spyderproject
196+
.spyproject
197+
198+
# Rope project settings
199+
.ropeproject
200+
201+
# mkdocs documentation
202+
/site
203+
204+
# mypy
205+
.mypy_cache/
206+
.dmypy.json
207+
dmypy.json
208+
209+
# Pyre type checker
210+
.pyre/
211+
212+
# pytype static type analyzer
213+
.pytype/
214+
215+
# Cython debug symbols
216+
cython_debug/
217+
218+
# Vscode config files
219+
.vscode/
220+
221+
# PyCharm
222+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
223+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
224+
# and can be added to the global gitignore or merged into this file. For a more nuclear
225+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
226+
#.idea/

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v4.4.0"
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: "v0.1.6"
14+
hooks:
15+
- id: ruff
16+
args: [--exit-non-zero-on-fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/pre-commit/mirrors-prettier
20+
rev: "v3.0.3"
21+
hooks:
22+
- id: prettier

0 commit comments

Comments
 (0)