Skip to content

Commit

Permalink
fix: Update build to use modern style pipeline and tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Dec 21, 2024
1 parent d6d0e8c commit f7adce3
Show file tree
Hide file tree
Showing 17 changed files with 1,329 additions and 351 deletions.
42 changes: 5 additions & 37 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,12 @@
name: Lint and Test

on:
push:
branches-ignore:
- develop
pull_request:
branches:
- main
- gh-pages

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- run: pip install -r requirements-dev.txt

- name: Run pre-commit
uses: pre-commit/[email protected]

pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.x', '3.12' ]
name: Test python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- run: pip install -r requirements-dev.txt

- run: pytest --cov-fail-under=100
uses: radiorabe/actions/.github/workflows/[email protected]
test-python-poetry:
uses: radiorabe/actions/.github/workflows/[email protected]
31 changes: 4 additions & 27 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,7 @@ on:
types: [created]

jobs:
publish:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- run: python -m pip install --upgrade pip

- run: pip install -r requirements-dev.txt

- run: make clean

- name: Run twine
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.RABE_PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: true
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python-poetry:
uses: radiorabe/actions/.github/workflows/[email protected]
secrets:
RABE_PYPI_TOKEN: ${{ secrets.RABE_PYPI_TOKEN }}
17 changes: 4 additions & 13 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,10 @@ on:
push:
branches:
- main
- release/*

jobs:
semantic-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run go-semantic-release
id: semrel
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.RABE_ITREAKTION_GITHUB_TOKEN }}
allow-initial-development-versions: true
uses: radiorabe/actions/.github/workflows/[email protected]
secrets:
RABE_ITREAKTION_GITHUB_TOKEN: ${{ secrets.RABE_ITREAKTION_GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ ENV/

# Rope project settings
.ropeproject
site/
16 changes: 16 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: nowplaypadgen
title: Python nowplaypadgen
description: |
DAB+ now playing PAD (DLS+ generator)
annotations:
backstage.io/techdocs-ref: dir:.
github.com/project-slug: radiorabe/nowplaypadgen
spec:
type: service
lifecycle: production
owner: it-reaktion
system: rabe-songticker
29 changes: 0 additions & 29 deletions docs/Makefile

This file was deleted.

186 changes: 0 additions & 186 deletions docs/conf.py

This file was deleted.

10 changes: 10 additions & 0 deletions docs/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* set primary color */
:root {
--md-primary-fg-color: #00C9BF;
--md-accent-fg-color: #00C9BF;
}

/* make code selectable on main */
.highlight .o {
user-select: none;
}
38 changes: 38 additions & 0 deletions docs/gen_ref_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Generate the code reference pages and navigation.
From https://mkdocstrings.github.io/recipes/
"""

from pathlib import Path

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()

for path in sorted(Path("nowplaypadgen").rglob("*.py")):
module_path = path.relative_to("nowplaypadgen").with_suffix("")
doc_path = path.relative_to("nowplaypadgen").with_suffix(".md")
full_doc_path = Path("reference", doc_path)

parts = list(module_path.parts)

if parts[-1] in ["__init__", "__main__"]:
continue

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
identifier = ".".join(parts)
print("::: " + identifier, file=fd)

mkdocs_gen_files.set_edit_path(full_doc_path, path)

with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())

with (
Path("README.md").open("r") as readme,
mkdocs_gen_files.open(
"index.md",
"w",
) as index_file,
):
index_file.writelines(readme.read())
Loading

0 comments on commit f7adce3

Please sign in to comment.