Project skeleton with Gitea CI and ntfy notifications
CI / lint (push) Successful in 11s
CI / test (push) Successful in 12s
CI / notify (push) Successful in 4s

- Rename the project to "scrobbler" with a src/ layout (hatchling)
- ruff + pytest dev tooling and a smoke test
- CI workflow (lint, test) that reports every run to ntfy via a
  reusable composite action

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 13:46:26 +01:00
commit ccc0e0d416
7 files changed
+277

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
name: Notify
description: Publish a workflow result to the ScrobblingService ntfy topic. Never fails the calling job.
inputs:
status:
description: Overall result (success, failure or cancelled)
required: true
title:
description: Notification title, e.g. "CI main"
required: true
message:
description: Extra lines appended to the notification body
required: false
default: ""
url:
description: ntfy server base URL
required: true
topic:
description: ntfy topic
required: true
user:
description: ntfy username
required: true
password:
description: ntfy password
required: true
runs:
using: composite
steps:
- name: Send ntfy notification
shell: bash
continue-on-error: true
env:
STATUS: ${{ inputs.status }}
TITLE: ${{ inputs.title }}
EXTRA: ${{ inputs.message }}
NTFY_URL: ${{ inputs.url }}
NTFY_TOPIC: ${{ inputs.topic }}
NTFY_USER: ${{ inputs.user }}
NTFY_PASSWORD: ${{ inputs.password }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
REF_NAME: ${{ github.ref_name }}
SHA: ${{ github.sha }}
ACTOR: ${{ github.actor }}
run: |
case "$STATUS" in
success) icon="✅"; priority=3; tags='["white_check_mark"]' ;;
cancelled) icon="⚪"; priority=3; tags='["heavy_minus_sign"]' ;;
*) icon="❌"; priority=4; tags='["x"]' ;;
esac
commit_msg="$(git log -1 --format=%s "$SHA" 2>/dev/null || echo "")"
body="$(printf '%s @ %s by %s\n%s\n%s' "$REF_NAME" "${SHA:0:7}" "$ACTOR" "$commit_msg" "$EXTRA")"
payload="$(jq -n \
--arg topic "$NTFY_TOPIC" \
--arg title "$TITLE $icon" \
--arg message "$body" \
--arg click "$RUN_URL" \
--argjson priority "$priority" \
--argjson tags "$tags" \
'{topic: $topic, title: $title, message: $message, click: $click, priority: $priority, tags: $tags}')"
curl -fsS -m 15 -u "$NTFY_USER:$NTFY_PASSWORD" \
-H 'Content-Type: application/json' \
--data-binary "$payload" "$NTFY_URL" -o /dev/null \
|| echo "::warning::ntfy notification failed"
+42
View File
@@ -0,0 +1,42 @@
name: CI
on:
push:
branches: ["**"]
tags-ignore: ["**"]
pull_request:
workflow_call:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: https://github.com/astral-sh/setup-uv@v6
- run: uv sync --locked
- run: uv run ruff check
- run: uv run ruff format --check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: https://github.com/astral-sh/setup-uv@v6
- run: uv sync --locked
- run: uv run pytest
notify:
needs: [lint, test]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.gitea/actions/notify
with:
status: ${{ (needs.lint.result == 'success' && needs.test.result == 'success') && 'success' || ((needs.lint.result == 'cancelled' || needs.test.result == 'cancelled') && 'cancelled' || 'failure') }}
title: CI ${{ github.ref_name }}
message: "lint: ${{ needs.lint.result }} · test: ${{ needs.test.result }}"
url: ${{ vars.NTFY_URL }}
topic: ${{ vars.NTFY_TOPIC }}
user: ${{ secrets.NTFY_USER }}
password: ${{ secrets.NTFY_PASSWORD }}