Skip to content

Update docker/setup-buildx-action action to v3.6.1 #45

Update docker/setup-buildx-action action to v3.6.1

Update docker/setup-buildx-action action to v3.6.1 #45

Workflow file for this run

name: Python (checks)
on:
pull_request: # any pull request
push:
branches:
- master
workflow_call:
inputs:
disable-tests:
default: false
description: Whether to disable running `pytest`.
required: false
type: boolean
node-version:
default: '20'
description: Version of node to use.
required: false
type: string
poetry-plugins:
default: poetry-dynamic-versioning[plugin]
description: A whitespace seperated list of poetry plugins to be installed.
required: false
type: string
python-version:
description: |
Version range or exact version of a Python version to use, using semver version range syntax.
Read from `pyproject.toml` if unset.
required: false
type: string
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
FORCE_COLOR: '1'
steps:
- name: ‡️ Check out code from GitHub
uses: actions/checkout@v4
- name: πŸ— Setup Node
uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{ inputs.node-version }}
- name: πŸ— Setup Python
uses: finleyfamily/[email protected]
with:
poetry-plugins: ${{ inputs.poetry-plugins }}
python-version: ${{ inputs.python-version }}
- name: ‡️ Install Node Dependencies
run: |
if [[ -f "Makefile" ]]; then
MAKEFILE_LIST="$(make -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }')"
fi
if [[ -f "Makefile" ]] && [[ " ${MAKEFILE_LIST[*]} " =~ setup-npm ]]; then
echo "installing node dependencies using Makefile...";
make setup-npm;
elif [[ -f "package-lock.json" ]]; then
echo "installing node dependencies using pipeline";
npm ci;
else
red="\e[31m";
end_color="\e[0m";
echo "${red}lockfile missing - can't install dependencies${end_color}";
exit 9;
fi
- name: πŸš€ Run Linters
run: |
if [[ -f "Makefile" ]]; then
MAKEFILE_LIST="$(make -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }')"
fi
if [[ -f "Makefile" ]] && [[ " ${MAKEFILE_LIST[*]} " =~ lint ]]; then
echo "running lint using Makefile...";
make lint;
else
echo "running linters using pipeline...";
echo "to customize what is run, include a 'Makefile' with a 'lint' target";
poetry run black . --check --color --diff
poetry run ruff check . --select ALL
npx --yes pyright --venv-path ./;
fi
test:
name: Test
if: inputs.disable-tests != 'true'
runs-on: ubuntu-latest
steps:
- name: ‡️ Check out code from GitHub
uses: actions/checkout@v4
- name: πŸ— Setup Python
uses: finleyfamily/[email protected]
with:
poetry-plugins: ${{ inputs.poetry-plugins || 'poetry-dynamic-versioning' }}
python-version: ${{ inputs.python-version }}
- name: πŸš€ Run Tests
run: |
if [[ -f "Makefile" ]]; then
MAKEFILE_LIST="$(make -rpn | sed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/ { s/:.*$// ; p ; } ; }')"
fi
if [[ -f "Makefile" ]] && [[ " ${MAKEFILE_LIST[*]} " =~ test ]]; then
echo "running tests using Makefile...";
make test;
else
echo "no tests configured";
echo "to customize what is run, include a 'Makefile' with a 'test' target";
fi