Skip to content

Commit dbae8f3

Browse files
authored
Merge pull request #13 from pimoroni/feature/venv-support
Raspberry Pi OS Bookworm + Pep 668
2 parents 01428ac + c2d4193 commit dbae8f3

File tree

10 files changed

+241
-105
lines changed

10 files changed

+241
-105
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919

2020
steps:
2121
- name: Checkout Code
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323

2424
- name: Set up Python ${{ matrix.python }}
25-
uses: actions/setup-python@v3
25+
uses: actions/setup-python@v5
2626
with:
2727
python-version: ${{ matrix.python }}
2828

@@ -35,7 +35,7 @@ jobs:
3535
make build
3636
3737
- name: Upload Packages
38-
uses: actions/upload-artifact@v3
38+
uses: actions/upload-artifact@v4
3939
with:
4040
name: ${{ env.RELEASE_FILE }}
4141
path: dist/

.github/workflows/qa.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ jobs:
1010
test:
1111
name: linting & spelling
1212
runs-on: ubuntu-latest
13-
1413
env:
1514
TERM: xterm-256color
1615

1716
steps:
1817
- name: Checkout Code
19-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
2019

2120
- name: Set up Python '3,11'
22-
uses: actions/setup-python@v3
21+
uses: actions/setup-python@v5
2322
with:
2423
python-version: '3.11'
2524

@@ -34,3 +33,7 @@ jobs:
3433
- name: Run Code Checks
3534
run: |
3635
make check
36+
37+
- name: Run Bash Code Checks
38+
run: |
39+
make shellcheck

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/checkout@v3
2020

2121
- name: Set up Python ${{ matrix.python }}
22-
uses: actions/setup-python@v3
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python }}
2525

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ endif
2222
@echo "deploy: build and upload to PyPi"
2323
@echo "tag: tag the repository with the current version\n"
2424

25+
version:
26+
@hatch version
27+
2528
install:
2629
./install.sh --unstable
2730

@@ -30,11 +33,14 @@ uninstall:
3033

3134
dev-deps:
3235
python3 -m pip install -r requirements-dev.txt
33-
sudo apt install dos2unix
36+
sudo apt install dos2unix shellcheck
3437

3538
check:
3639
@bash check.sh
3740

41+
shellcheck:
42+
shellcheck *.sh
43+
3844
qa:
3945
tox -e qa
4046

@@ -44,7 +50,7 @@ pytest:
4450
nopost:
4551
@bash check.sh --nopost
4652

47-
tag:
53+
tag: version
4854
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"
4955

5056
build: check

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# __TITLE__
22

33
[![Build Status](https://img.shields.io/github/actions/workflow/status/pimoroni/PROJECT_NAME-python/test.yml?branch=main)](https://github.com/pimoroni/PROJECT_NAME-python/actions/workflows/test.yml)
4-
[![Coverage Status](https://coveralls.io/repos/github/pimoroni/PROJECT_NAME-python/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/PROJECT_NAME-python?branch=master)
4+
[![Coverage Status](https://coveralls.io/repos/github/pimoroni/PROJECT_NAME-python/badge.svg?branch=main)](https://coveralls.io/github/pimoroni/PROJECT_NAME-python?branch=main)
55
[![PyPi Package](https://img.shields.io/pypi/v/PROJECT_NAME.svg)](https://pypi.python.org/pypi/PROJECT_NAME)
66
[![Python Versions](https://img.shields.io/pypi/pyversions/PROJECT_NAME.svg)](https://pypi.python.org/pypi/PROJECT_NAME)
77

check.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# This script handles some basic QA checks on the source
44

55
NOPOST=$1
6-
LIBRARY_NAME=`hatch project metadata name`
7-
LIBRARY_VERSION=`hatch version | awk -F "." '{print $1"."$2"."$3}'`
8-
POST_VERSION=`hatch version | awk -F "." '{print substr($4,0,length($4))}'`
6+
LIBRARY_NAME=$(hatch project metadata name)
7+
LIBRARY_VERSION=$(hatch version | awk -F "." '{print $1"."$2"."$3}')
8+
POST_VERSION=$(hatch version | awk -F "." '{print substr($4,0,length($4))}')
9+
TERM=${TERM:="xterm-256color"}
910

1011
success() {
1112
echo -e "$(tput setaf 2)$1$(tput sgr0)"
@@ -28,7 +29,7 @@ while [[ $# -gt 0 ]]; do
2829
;;
2930
*)
3031
if [[ $1 == -* ]]; then
31-
printf "Unrecognised option: $1\n";
32+
printf "Unrecognised option: %s\n" "$1";
3233
exit 1
3334
fi
3435
POSITIONAL_ARGS+=("$1")
@@ -39,8 +40,7 @@ done
3940
inform "Checking $LIBRARY_NAME $LIBRARY_VERSION\n"
4041

4142
inform "Checking for trailing whitespace..."
42-
grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
43-
if [[ $? -eq 0 ]]; then
43+
if grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO; then
4444
warning "Trailing whitespace found!"
4545
exit 1
4646
else
@@ -49,8 +49,7 @@ fi
4949
printf "\n"
5050

5151
inform "Checking for DOS line-endings..."
52-
grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
53-
if [[ $? -eq 0 ]]; then
52+
if grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile; then
5453
warning "DOS line-endings found!"
5554
exit 1
5655
else
@@ -59,8 +58,7 @@ fi
5958
printf "\n"
6059

6160
inform "Checking CHANGELOG.md..."
62-
cat CHANGELOG.md | grep ^${LIBRARY_VERSION} > /dev/null 2>&1
63-
if [[ $? -eq 1 ]]; then
61+
if ! grep "^${LIBRARY_VERSION}" CHANGELOG.md > /dev/null 2>&1; then
6462
warning "Changes missing for version ${LIBRARY_VERSION}! Please update CHANGELOG.md."
6563
exit 1
6664
else
@@ -69,8 +67,7 @@ fi
6967
printf "\n"
7068

7169
inform "Checking for git tag ${LIBRARY_VERSION}..."
72-
git tag -l | grep -E "${LIBRARY_VERSION}$"
73-
if [[ $? -eq 1 ]]; then
70+
if ! git tag -l | grep -E "${LIBRARY_VERSION}$"; then
7471
warning "Missing git tag for version ${LIBRARY_VERSION}"
7572
fi
7673
printf "\n"

0 commit comments

Comments
 (0)