]> kaliko git repositories - python-musicpd.git/commitdiff
Add woodpecker ci
authorKaliko Jack <kaliko@azylum.org>
Sun, 11 Feb 2024 17:50:11 +0000 (18:50 +0100)
committerKaliko Jack <kaliko@azylum.org>
Sat, 29 Mar 2025 09:25:11 +0000 (10:25 +0100)
.woodpecker/notify-failure.yaml [new file with mode: 0644]
.woodpecker/notify-success.yaml [new file with mode: 0644]
.woodpecker/notify.sh [new file with mode: 0644]
.woodpecker/tests.yaml [new file with mode: 0644]

diff --git a/.woodpecker/notify-failure.yaml b/.woodpecker/notify-failure.yaml
new file mode 100644 (file)
index 0000000..0ebd3f1
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# CI_PREV_PIPELINE_STATUS is set wrong on workflow failures
+# https://github.com/woodpecker-ci/woodpecker/issues/3343
+
+steps:
+  - name: notify fail
+    image: debian:stable-backports
+    environment:
+      STATUS: failure
+    commands:
+      - apt update && apt install -q2 -y go-sendxmpp/stable-backports ca-certificates
+      - bash .woodpecker/notify.sh
+    when:
+      - event: [ push, manual ]
+
+depends_on:
+  - tests
+
+runs_on: [ failure ]
diff --git a/.woodpecker/notify-success.yaml b/.woodpecker/notify-success.yaml
new file mode 100644 (file)
index 0000000..7ef2493
--- /dev/null
@@ -0,0 +1,19 @@
+---
+# CI_PREV_PIPELINE_STATUS is set wrong on workflow failures
+# https://github.com/woodpecker-ci/woodpecker/issues/3343
+
+steps:
+  - name: notify success
+    image: debian:stable-backports
+    environment:
+      STATUS: success
+    commands:
+      - apt update && apt install -q2 -y go-sendxmpp/stable-backports ca-certificates
+      - bash .woodpecker/notify.sh
+    when:
+      - event: [ push, manual ]
+
+depends_on:
+  - tests
+
+runs_on: [ success ]
diff --git a/.woodpecker/notify.sh b/.woodpecker/notify.sh
new file mode 100644 (file)
index 0000000..2ec9cfd
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+#slixsend -j anon.azylum.org -p foo -m -t kaliko@conf.azylum.org "${CI_REPO}: ${CI_PIPELINE_URL}"
+env
+
+if [ "${CI_PREV_PIPELINE_STATUS}" != "failure" ] && [ "${STATUS}" != "failure" ];then
+  exit 0
+fi
+
+# Set the correct message
+if [ "${STATUS}" = "success" ]; then
+  MESSAGE="✔️  Pipeline for ${CI_COMMIT_SHA:0:8} on ${CI_REPO} succeeded."
+else
+  MESSAGE="❌ Pipeline for \"${CI_COMMIT_MESSAGE}\" ${CI_COMMIT_SHA:0:8} on ${CI_REPO} failed.\nSee ${CI_PIPELINE_URL}"
+fi
+
+#slixsend -j anon.azylum.org -p foo -m -t kaliko@conf.azylum.org "${MESSAGE}"
+printf "%s" "${MESSAGE}" | go-sendxmpp --anonymous -u "anon.azylum.org" -a woodpecker -c kaliko@conf.azylum.org || echo "❌ Failed to send notification!"
diff --git a/.woodpecker/tests.yaml b/.woodpecker/tests.yaml
new file mode 100644 (file)
index 0000000..46d393f
--- /dev/null
@@ -0,0 +1,47 @@
+matrix:
+  PYTHON_VERSION:
+    - 3.6
+    - 3.7
+    - 3.8
+    - 3.9
+    - 3.10
+    - 3.11
+    - 3.12
+
+steps:
+  - name: test
+    image: python:${PYTHON_VERSION}
+    commands:
+      - python -m venv venv
+      - . venv/bin/activate
+      - pip install pytest-cov build
+      - py.test -q --cov=musicpd test.py
+    when:
+      - path:
+          include: ['musicpd.py', 'test.py', '.woodpecker/*']
+        event: [ push, tag, manual ]
+
+  - name: build
+    image: python:${PYTHON_VERSION}
+    commands:
+      - . venv/bin/activate
+      # packaging test
+      - python3 -m build -s -w
+      - pip install dist/*.whl
+    when:
+      - evaluate: 'PYTHON_VERSION in ["3.9", "3.10", "3.11", "3.12"]'
+        path:
+          include: ['pyproject.toml', '.woodpecker/*']
+        event: [ push, tag, manual ]
+
+  - name: sphinx
+    image: python:${PYTHON_VERSION}
+    commands:
+      - . venv/bin/activate
+      - pip install sphinx sphinx_rtd_theme
+      - sphinx-build doc/source -b html ./html -D html_theme=sphinx_rtd_theme
+    when:
+      - evaluate: 'PYTHON_VERSION == "3.12"'
+        path:
+          include: ['doc/**', '.woodpecker/*', 'README.rst']
+        event: [push, tag, manual]