Skip to content

Commit

Permalink
Sync with latest boilerplate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Nov 14, 2024
1 parent 79ccffa commit 7b7f5c3
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ on:

jobs:
test:
name: Python ${{ matrix.python }}
name: Build (Python ${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.9', '3.10', '3.11']

env:
TERM: xterm-256color
RELEASE_FILE: ${{ github.event.repository.name }}-${{ github.event.release.tag_name || github.sha }}-py${{ matrix.python }}

steps:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Install Test

on:
pull_request:
push:
branches:
- main

jobs:
test:
name: Install (Python ${{ matrix.python }})
runs-on: ubuntu-latest
env:
TERM: xterm-256color
strategy:
matrix:
python: ['3.9', '3.10', '3.11']

steps:
- name: Checkout Code
uses: actions/checkout@v4

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

- name: Stub files & Patch install.sh
run: |
mkdir -p boot/firmware
touch boot/firmware/config.txt
sed -i "s|/boot/firmware|`pwd`/boot/firmware|g" install.sh
sed -i "s|sudo raspi-config|raspi-config|g" pyproject.toml
touch raspi-config
chmod +x raspi-config
echo `pwd` >> $GITHUB_PATH
- name: Run install.sh
run: |
./install.sh --unstable --force
2 changes: 1 addition & 1 deletion .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
name: linting & spelling
name: Linting & Spelling
runs-on: ubuntu-latest
env:
TERM: xterm-256color
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ on:

jobs:
test:
name: Python ${{ matrix.python }}
name: Test (Python ${{ matrix.python }})
runs-on: ubuntu-latest
env:
TERM: xterm-256color
strategy:
matrix:
python: ['3.9', '3.10', '3.11']

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ endif
@echo "deploy: build and upload to PyPi"
@echo "tag: tag the repository with the current version\n"

version:
@hatch version

install:
./install.sh --unstable

Expand All @@ -47,7 +50,7 @@ pytest:
nopost:
@bash check.sh --nopost

tag:
tag: version
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"

build: check
Expand Down
23 changes: 17 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ find_config() {
if [ ! -f "$CONFIG_DIR/$CONFIG_FILE" ]; then
fatal "Could not find $CONFIG_FILE!"
fi
else
if [ -f "/boot/$CONFIG_FILE" ] && [ ! -L "/boot/$CONFIG_FILE" ]; then
warning "Oops! It looks like /boot/$CONFIG_FILE is not a link to $CONFIG_DIR/$CONFIG_FILE"
warning "You might want to fix this!"
fi
fi
inform "Using $CONFIG_FILE in $CONFIG_DIR"
}
Expand Down Expand Up @@ -156,7 +151,8 @@ function apt_pkg_install {
sudo apt update
APT_HAS_UPDATED=true
fi
sudo apt install -y "$PACKAGES"
# shellcheck disable=SC2086
sudo apt install -y $PACKAGES
check_for_error
if [ -f "$UNINSTALLER" ]; then
echo "apt uninstall -y $PACKAGES" >> "$UNINSTALLER"
Expand All @@ -170,6 +166,12 @@ function pip_pkg_install {
check_for_error
}

function pip_requirements_install {
# A null Keyring prevents pip stalling in the background
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install -r "$@"
check_for_error
}

while [[ $# -gt 0 ]]; do
K="$1"
case $K in
Expand Down Expand Up @@ -339,6 +341,15 @@ fi

printf "\n"

if [ -f "requirements-examples.txt" ]; then
if confirm "Would you like to install example dependencies?"; then
inform "Installing dependencies from requirements-examples.txt..."
pip_requirements_install requirements-examples.txt
fi
fi

printf "\n"

# Use pdoc to generate basic documentation from the installed module

if confirm "Would you like to generate documentation?"; then
Expand Down
11 changes: 2 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@ commands =
python -m build --no-isolation
python -m twine check dist/*
isort --check .
ruff --output-format=github .
ruff check .
codespell .
deps =
check-manifest
ruff
codespell
isort
twine
build
hatch
hatch-fancy-pypi-readme
-r{toxinidir}/requirements-dev.txt

0 comments on commit 7b7f5c3

Please sign in to comment.