Skip to content

Commit 2d948d5

Browse files
committed
ci: add GitHub Actions workflows mirroring Gitea CI
Add two GitHub Actions workflows as corollaries to the existing .gitea/workflows/ci.yml pipeline: - .github/workflows/ci.yml: direct port of the Gitea CI — same 5-stage pipeline (lint, composer install, phpcs, phpstan, phpunit) using the same docker-based scripts. Triggers on push/PR to main. - .github/workflows/release.yml: creates a GitHub Release when a semver tag (v*.*.* ) is pushed. Builds a distributable plugin ZIP with the required root directory name AssignColorsByDayOfWeek (Kanboard plugin installer convention). vendor/ is intentionally excluded — this plugin has no production Composer dependencies. Uses gh CLI with --generate-notes for auto-generated release notes.
1 parent 21e8b58 commit 2d948d5

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# Stage 1 — PHP syntax check
20+
# Uses kanboard/kanboard image with entrypoint override (default entrypoint
21+
# starts Apache and runs forever; we override to /bin/sh for one-shot use).
22+
- name: Lint — PHP syntax check
23+
run: bash scripts/docker-lint.sh
24+
25+
# Stage 2 — Install Composer dependencies
26+
# vendor/ is not committed (.gitignore); install it here so the remaining
27+
# stages can find vendor/bin/phpcs, vendor/bin/phpstan, vendor/bin/phpunit.
28+
- name: Install Composer dependencies
29+
run: |
30+
docker run --rm \
31+
-v "$PWD":/app \
32+
composer:2 \
33+
install --no-interaction --prefer-dist --no-progress
34+
35+
# Stage 3 — PSR-12 code style check
36+
- name: PHPCS — PSR-12 style check
37+
run: bash scripts/docker-phpcs.sh
38+
39+
# Stage 4 — Static analysis (PHPStan level 5)
40+
# Uses php:8.4-cli — kanboard/kanboard lacks the tokenizer extension
41+
# required by PHPStan.
42+
- name: PHPStan — static analysis
43+
run: bash scripts/docker-phpstan.sh
44+
45+
# Stage 5 — Unit tests
46+
# Uses php:8.4-cli for the same reason as PHPStan above.
47+
- name: PHPUnit — unit tests
48+
run: bash scripts/docker-test.sh

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Extract version from tag
19+
id: version
20+
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
21+
22+
# Build a distributable plugin ZIP.
23+
# Kanboard's plugin installer expects a ZIP containing a single root
24+
# directory named exactly after the plugin class: AssignColorsByDayOfWeek.
25+
# This plugin has no production Composer dependencies (require-dev only),
26+
# so vendor/ is intentionally excluded from the archive.
27+
- name: Build plugin archive
28+
run: |
29+
ARCHIVE="AssignColorsByDayOfWeek-${{ steps.version.outputs.version }}.zip"
30+
PLUGIN_DIR="AssignColorsByDayOfWeek"
31+
32+
mkdir -p "dist/$PLUGIN_DIR"
33+
cp -r Action "dist/$PLUGIN_DIR/"
34+
cp Plugin.php LICENSE README.md CHANGELOG.md composer.json "dist/$PLUGIN_DIR/"
35+
36+
cd dist
37+
zip -r "../$ARCHIVE" "$PLUGIN_DIR/"
38+
cd ..
39+
40+
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
41+
42+
- name: Create GitHub Release
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
run: |
46+
gh release create "${{ github.ref_name }}" \
47+
--title "${{ github.ref_name }}" \
48+
--generate-notes \
49+
"$ARCHIVE"

0 commit comments

Comments
 (0)