Adapt GitHub Actions workflows for self-hosted Gitea instance: - CI workflow with PlatformIO build, cppcheck, and clang-format - PR title format checker using conventional commits - Release workflow for tagged builds Keeps original .github/workflows/ for upstream compatibility.
This commit is contained in:
parent
54004d5a5b
commit
e8d332e34f
37
.gitea/workflows/ci.yml
Normal file
37
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,37 @@
|
||||
name: CI
|
||||
'on':
|
||||
push:
|
||||
branches: [master, crosspoint-ef]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
- name: Install clang-format-21
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 21
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format-21
|
||||
|
||||
- name: Run cppcheck
|
||||
run: pio check --fail-on-defect low --fail-on-defect medium --fail-on-defect high
|
||||
|
||||
- name: Run clang-format
|
||||
run: PATH="/usr/lib/llvm-21/bin:$PATH" ./bin/clang-format-fix && git diff --exit-code || (echo "Please run 'bin/clang-format-fix' to fix formatting issues" && exit 1)
|
||||
|
||||
- name: Build CrossPoint
|
||||
run: pio run
|
||||
40
.gitea/workflows/pr-formatting-check.yml
Normal file
40
.gitea/workflows/pr-formatting-check.yml
Normal file
@ -0,0 +1,40 @@
|
||||
name: "PR Formatting"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
title-check:
|
||||
name: Title Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check PR Title Format
|
||||
run: |
|
||||
PR_TITLE="${{ github.event.pull_request.title }}"
|
||||
echo "Checking PR title: $PR_TITLE"
|
||||
|
||||
# Conventional commit pattern: type(scope): description or type: description
|
||||
# Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
|
||||
PATTERN="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-zA-Z0-9_-]+\))?: .+"
|
||||
|
||||
if echo "$PR_TITLE" | grep -qE "$PATTERN"; then
|
||||
echo "✓ PR title follows conventional commit format"
|
||||
else
|
||||
echo "✗ PR title does not follow conventional commit format"
|
||||
echo ""
|
||||
echo "Expected format: type(scope): description"
|
||||
echo " or: type: description"
|
||||
echo ""
|
||||
echo "Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " feat(reader): add bookmark sync feature"
|
||||
echo " fix: resolve memory leak in epub parser"
|
||||
echo " docs: update README with new instructions"
|
||||
exit 1
|
||||
fi
|
||||
41
.gitea/workflows/release.yml
Normal file
41
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,41 @@
|
||||
name: Compile Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
key: ${{ runner.os }}-pio
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
- name: Build CrossPoint
|
||||
run: pio run -e gh_release
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: CrossPoint-${{ github.ref_name }}
|
||||
path: |
|
||||
.pio/build/gh_release/bootloader.bin
|
||||
.pio/build/gh_release/firmware.bin
|
||||
.pio/build/gh_release/firmware.elf
|
||||
.pio/build/gh_release/firmware.map
|
||||
.pio/build/gh_release/partitions.bin
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -11,3 +11,7 @@ build
|
||||
**/__pycache__/
|
||||
test/epubs/
|
||||
CrossPoint-ef.md
|
||||
|
||||
# Gitea Actions runner config (contains credentials)
|
||||
.runner
|
||||
.runner.*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user