Skip to content
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
48 changes: 26 additions & 22 deletions .github/workflows/check-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:

- name: Run Flake8
# TODO: Run from locked dependencies, once project's Python version has been updated to 3.14
run: uvx --python 3.14 --with flake8-carrot>=0.1.4 --with flake8-pyproject>=1.2 --
flake8
run: uvx --python 3.14 --with "flake8-carrot>=0.1.4" --with "flake8-pyproject>=1.2"
-- flake8

mypy: # yamllint disable-line rule:key-ordering
env:
Expand Down Expand Up @@ -76,20 +76,20 @@ jobs:
- name: Install mypy From Locked Dependencies
run: |
if [ "${{matrix.component}}" == "package" ]; then
ARGS=""
ARGS=()
elif [ "${{matrix.component}}" == "tests" ]; then
ARGS="--group test"
ARGS=("--group" "test")
else
echo "Error: Unknown matrix.component value: '${{matrix.component}}'" >&2
exit 1
echo "Error: Unknown matrix.component value: '${{matrix.component}}'" >&2
exit 1
fi

uv sync --no-group dev --group type-check $ARGS
uv sync --no-group dev --group type-check "${ARGS[@]}"

- id: store-hashed-python-version
name: Store Hashed Python Version
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
>> $GITHUB_OUTPUT
>> "$GITHUB_OUTPUT"

- uses: actions/cache@v5
with:
Expand All @@ -99,15 +99,15 @@ jobs:
- name: Run mypy # TODO: Add GitHub workflows output format
run: |
if [ "${{matrix.component}}" == "package" ]; then
ARGS=". --exclude tests/"
ARGS=("." "--exclude" "tests/")
elif [ "${{matrix.component}}" == "tests" ]; then
ARGS="tests/"
ARGS=("tests/")
else
echo "Error: Unknown matrix.component value: '${{matrix.component}}'" >&2
exit 1
echo "Error: Unknown matrix.component value: '${{matrix.component}}'" >&2
exit 1
fi

uv run -- mypy $ARGS
uv run -- mypy "${ARGS[@]}"

pre-commit: # yamllint disable-line rule:key-ordering
env:
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
- id: store-hashed-python-version
name: Store Hashed Python Version
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
>> $GITHUB_OUTPUT
>> "$GITHUB_OUTPUT"

- uses: actions/cache@v5
with:
Expand All @@ -155,13 +155,18 @@ jobs:
- name: Save pre-commit Checks Which Require Skipping
run: |
if [[ "${{github.event_name}}" == "push" && "${{github.ref_name}}" == "${{github.event.repository.default_branch}}" ]]; then
echo "SKIP=check-github-workflows,flake8,ruff-check,uv-lock,gitlint-ci" >> $GITHUB_ENV
echo "SKIP=flake8,ruff-check,uv-lock,gitlint-ci" >> "$GITHUB_ENV"
else
echo "SKIP=check-github-workflows,flake8,ruff-check,uv-lock" >> $GITHUB_ENV
echo "SKIP=flake8,ruff-check,uv-lock" >> "$GITHUB_ENV"
fi

- name: Run pre-commit
run: uv run -- pre-commit run --all-files --hook-stage manual # TODO: Add GitHub workflows output format
run: |
set -o pipefail
uv run -- pre-commit run --all-files --hook-stage manual | tee /tmp/pre-commit.log

- name: Ensure No Warnings
run: if grep -q "\[WARNING\]" /tmp/pre-commit.log; then exit 1; fi

- if: ${{!cancelled()}}
uses: pre-commit-ci/lite-action@v1.1.0
Expand Down Expand Up @@ -221,7 +226,7 @@ jobs:
- id: store-hashed-python-version
name: Store Hashed Python Version
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
>> $GITHUB_OUTPUT
>> "$GITHUB_OUTPUT"

- uses: actions/cache@v5
with:
Expand Down Expand Up @@ -269,7 +274,7 @@ jobs:
- id: store-hashed-python-version
name: Store Hashed Python Version
run: echo "hashed_python_version=$(uv run -- python -VV | sha256sum | cut -d' ' -f1)"
>> $GITHUB_OUTPUT
>> "$GITHUB_OUTPUT"

- uses: actions/cache@v5
with:
Expand All @@ -284,9 +289,8 @@ jobs:
IMAGE_NAME: ${{github.repository}}
REGISTRY: ghcr.io
environment: publish
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == 'CSSUoB/TeX-Bot-Py-V2'
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name
== 'CSSUoB/TeX-Bot-Py-V2'
needs: [mypy, pre-commit, pymarkdown, pytest, ruff-lint, uv-check]
permissions:
attestations: write
Expand Down
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ default_language_version:
default_stages: [pre-commit, pre-merge-commit, manual]

repos:
- repo: https://github.com/rhysd/actionlint
rev: v1.7.9
hooks:
- id: actionlint
additional_dependencies: [github.com/wasilibs/go-shellcheck/cmd/shellcheck@latest] # yamllint disable-line rule:key-ordering
args: [-pyflakes=]

- repo: https://github.com/dotenv-linter/dotenv-linter
rev: v4.0.0
hooks:
Expand Down Expand Up @@ -31,8 +38,6 @@ repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.35.0
hooks:
- id: check-github-workflows

- id: check-jsonschema
args: [--schemafile, 'https://json.schemastore.org/yamllint.json'] # yamllint disable-line rule:quoted-strings
files: ^\.yamllint\.yaml$ # yamllint disable-line rule:key-ordering
Expand Down