Skip to content

Commit 580c785

Browse files
author
Andy Babic
committed
Configure CI pipelines
1 parent dd1d58f commit 580c785

File tree

6 files changed

+199
-2
lines changed

6 files changed

+199
-2
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

.github/workflows/format.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "stable/**"
8+
pull_request:
9+
branches: [main]
10+
11+
jobs:
12+
ruff:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- run: python -Im pip install --user ruff==0.8.4
19+
20+
- name: Run ruff
21+
working-directory: ./mlstreamfield
22+
run: ruff check . --output-format=github

.github/workflows/mypy.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on: [pull_request]
2+
3+
jobs:
4+
type-check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Set up Python
9+
uses: actions/setup-python@v5
10+
with:
11+
python-version: '3.x'
12+
- name: Install dependencies
13+
run: |
14+
python -m pip install --upgrade pip flit
15+
python -m flit install --extras type-checking
16+
- name: Run type checker
17+
run: mypy mlstreamfield/ --strict

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read # to fetch code (actions/checkout)
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
cache: "pip"
21+
cache-dependency-path: "**/pyproject.toml"
22+
23+
- name: ⬇️ Install build dependencies
24+
run: |
25+
python -m pip install -U flit
26+
27+
- name: 🏗️ Build
28+
run: python -m flit build
29+
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
path: ./dist
33+
34+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
35+
pypi-publish:
36+
needs: build
37+
environment: 'publish'
38+
39+
name: ⬆️ Upload release to PyPI
40+
runs-on: ubuntu-latest
41+
permissions:
42+
# Mandatory for trusted publishing
43+
id-token: write
44+
steps:
45+
- uses: actions/download-artifact@v4
46+
47+
- name: 🚀 Publish package distributions to PyPI
48+
uses: pypa/gh-action-pypi-publish@release/v1
49+
with:
50+
packages-dir: artifact/
51+
print-hash: true

.github/workflows/test.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "stable/**"
8+
9+
pull_request:
10+
branches: [main]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read # to fetch code (actions/checkout)
18+
19+
env:
20+
FORCE_COLOR: "1" # Make tools pretty.
21+
TOX_TESTENV_PASSENV: FORCE_COLOR
22+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
23+
PIP_NO_PYTHON_VERSION_WARNING: "1"
24+
PYTHON_LATEST: "3.11"
25+
26+
jobs:
27+
test:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
python-version: ["3.11", "3.12"]
32+
django: ["5.1"]
33+
wagtail: ["6.2", "6.3"]
34+
db: ["sqlite"]
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Install dependencies
44+
run: |
45+
python -Im pip install --upgrade pip flit tox tox-gh-actions
46+
47+
- name: 🏗️ Build wheel
48+
run: python -Im flit build --format wheel
49+
50+
- name: Test
51+
env:
52+
TOXENV: py${{ matrix.python-version }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-sqlite
53+
run: tox --installpkg ./dist/*.whl
54+
55+
- name: ⬆️ Upload coverage data
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: coverage-data-${{ matrix.python-version }}-${{ matrix.django }}-${{ matrix.wagtail }}-sqlite
59+
path: .coverage.*
60+
if-no-files-found: ignore
61+
include-hidden-files: true
62+
retention-days: 1
63+
64+
coverage:
65+
runs-on: ubuntu-latest
66+
needs:
67+
- test
68+
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: actions/setup-python@v5
72+
with:
73+
# Use latest Python, so it understands all syntax.
74+
python-version: ${{env.PYTHON_LATEST}}
75+
76+
- run: python -Im pip install --upgrade coverage
77+
78+
- name: ⬇️ Download coverage data
79+
uses: actions/download-artifact@v4
80+
with:
81+
pattern: coverage-data-*
82+
merge-multiple: true
83+
84+
- name: + Combine coverage
85+
run: |
86+
python -Im coverage combine
87+
python -Im coverage html --skip-covered --skip-empty
88+
python -Im coverage report
89+
echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY
90+
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
91+
- name: 📈 Upload HTML report
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: html-report
95+
path: htmlcov

ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ extend-select = [
1919
]
2020

2121
extend-ignore = [
22-
"E501", # no line lenght errors
22+
"E501", # no line length errors
2323
]
2424
fixable = ["C4", "E", "F", "I", "UP"]
2525

2626
[lint.isort]
27-
known-first-party = ["src", "mlstreamfield"]
27+
known-first-party = ["mlstreamfield"]
2828
lines-between-types = 1
2929
lines-after-imports = 2
3030

0 commit comments

Comments
 (0)