Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with boilerplate. #25

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

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

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

Expand All @@ -35,7 +35,7 @@ jobs:
make build

- name: Upload Packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_FILE }}
path: dist/
9 changes: 6 additions & 3 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ jobs:
test:
name: linting & spelling
runs-on: ubuntu-latest

env:
TERM: xterm-256color

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

- name: Set up Python '3,11'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand All @@ -34,3 +33,7 @@ jobs:
- name: Run Code Checks
run: |
make check

- name: Run Bash Code Checks
run: |
make shellcheck
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v3

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

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ uninstall:

dev-deps:
python3 -m pip install -r requirements-dev.txt
sudo apt install dos2unix
sudo apt install dos2unix shellcheck

check:
@bash check.sh

shellcheck:
shellcheck *.sh

qa:
tox -e qa

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PMS5003 Particulate Sensor

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

Expand Down
20 changes: 8 additions & 12 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# This script handles some basic QA checks on the source

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

success() {
Expand All @@ -29,7 +29,7 @@ while [[ $# -gt 0 ]]; do
;;
*)
if [[ $1 == -* ]]; then
printf "Unrecognised option: $1\n";
printf "Unrecognised option: %s\n" "$1";
exit 1
fi
POSITIONAL_ARGS+=("$1")
Expand All @@ -40,8 +40,7 @@ done
inform "Checking $LIBRARY_NAME $LIBRARY_VERSION\n"

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

inform "Checking for DOS line-endings..."
grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
if [[ $? -eq 0 ]]; then
if grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile; then
warning "DOS line-endings found!"
exit 1
else
Expand All @@ -60,8 +58,7 @@ fi
printf "\n"

inform "Checking CHANGELOG.md..."
cat CHANGELOG.md | grep ^${LIBRARY_VERSION} > /dev/null 2>&1
if [[ $? -eq 1 ]]; then
if ! grep "^${LIBRARY_VERSION}" CHANGELOG.md > /dev/null 2>&1; then
warning "Changes missing for version ${LIBRARY_VERSION}! Please update CHANGELOG.md."
exit 1
else
Expand All @@ -70,8 +67,7 @@ fi
printf "\n"

inform "Checking for git tag ${LIBRARY_VERSION}..."
git tag -l | grep -E "${LIBRARY_VERSION}$"
if [[ $? -eq 1 ]]; then
if ! git tag -l | grep -E "${LIBRARY_VERSION}$"; then
warning "Missing git tag for version ${LIBRARY_VERSION}"
fi
printf "\n"
Expand Down
Loading
Loading