Initial CI/CD pipeline
## Description Add Forgejo Actions CI pipeline with flatpak builds and tests. Closes #<!-- issue number --> ## Type of change - [ ] 🐛 Bug fix - [ ] ✨ New feature - [ ] ♻️ Refactor / code cleanup - [ ] 📖 Documentation - [x] 🔧 Dependencies / build tooling ## How was this tested? Verified CI pipeline runs successfully with flatpak builds and tests in Forgejo Actions. ## Checklist - [ ] I have read the [contributing guide](CONTRIBUTING.md) - [ ] My code follows the project's style guidelines - [ ] I have added or updated tests as needed - [ ] Documentation has been updated where applicable - [ ] All existing tests pass Pull request: (#3) ## Description Add Forgejo Actions CI pipeline with flatpak builds and tests. Closes #<!-- issue number --> ## Type of change - [ ] 🐛 Bug fix - [ ] ✨ New feature - [ ] ♻️ Refactor / code cleanup - [ ] 📖 Documentation - [x] 🔧 Dependencies / build tooling ## How was this tested? Verified CI pipeline runs successfully with flatpak builds and tests in Forgejo Actions. ## Checklist - [ ] I have read the [contributing guide](CONTRIBUTING.md) - [ ] My code follows the project's style guidelines - [ ] I have added or updated tests as needed - [ ] Documentation has been updated where applicable - [ ] All existing tests pass Co-authored-by: Brendan Szymanski <hello@bscubed.dev> Co-committed-by: Brendan Szymanski <hello@bscubed.dev>
This commit is contained in:
parent
f374dc663d
commit
70731ec633
6 changed files with 328 additions and 3 deletions
34
.forgejo/workflows/pr-checks.yml
Normal file
34
.forgejo/workflows/pr-checks.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: PR Checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: swift:6.3
|
||||
steps:
|
||||
- name: Install Node.js
|
||||
run: apt-get update -qq && apt-get install -y -qq nodejs
|
||||
- uses: actions/checkout@v4
|
||||
- name: Lint
|
||||
run: swift format lint --recursive Sources/
|
||||
|
||||
flatpak-build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/flathub/flatpak-builder-lint:latest
|
||||
options: --privileged --security-opt seccomp=unconfined --security-opt apparmor=unconfined
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Add Flathub remote
|
||||
run: |
|
||||
flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
- uses: https://github.com/flatpak/flatpak-github-actions/flatpak-builder@v6.7
|
||||
with:
|
||||
manifest-path: dev.bscubed.Luminate.json
|
||||
bundle: Luminate.flatpak
|
||||
upload-artifact: false
|
||||
keep-build-dirs: true
|
||||
34
.forgejo/workflows/pr-labeler.yml
Normal file
34
.forgejo/workflows/pr-labeler.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: PR Labeler
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label by branch prefix
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
run: |
|
||||
BRANCH="${{ forge.head_ref }}"
|
||||
case "$BRANCH" in
|
||||
feature/*) LABEL="enhancement/feature" ;;
|
||||
fix/*) LABEL="bug" ;;
|
||||
chore/*) LABEL="enhancement/chore" ;;
|
||||
refactor/*) LABEL="enhancement/refactor" ;;
|
||||
docs/*) LABEL="enhancement/docs" ;;
|
||||
test/*) LABEL="enhancement/test" ;;
|
||||
perf/*) LABEL="enhancement/perf" ;;
|
||||
style/*) LABEL="enhancement/style" ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
REPO="${{ forge.repository }}"
|
||||
API_URL="${{ forge.api_url }}"
|
||||
PR_NUMBER="${{ forge.event.number }}"
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"labels\": [\"$LABEL\"]}" \
|
||||
"$API_URL/repos/$REPO/issues/$PR_NUMBER/labels"
|
||||
60
.forgejo/workflows/release.yml
Normal file
60
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50
|
||||
options: --privileged
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: https://github.com/flatpak/flatpak-github-actions/flatpak-builder@v6.7
|
||||
with:
|
||||
manifest-path: dev.bscubed.Luminate.json
|
||||
bundle: Luminate.flatpak
|
||||
cache-key: flatpak-builder-${arch}-${sha256(dev.bscubed.Luminate.json)}-release
|
||||
branch: stable
|
||||
repository-url: https://flathub.org/repo/flathub.flatpakrepo
|
||||
upload-artifact: false
|
||||
- name: Install tools
|
||||
run: apt-get update -qq && apt-get install -y -qq jq
|
||||
- name: Generate changelog
|
||||
run: |
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
if [ -n "$PREV_TAG" ]; then
|
||||
git log --oneline --no-decorate "$PREV_TAG..HEAD" > /tmp/changelog.md
|
||||
else
|
||||
echo "Initial release" > /tmp/changelog.md
|
||||
fi
|
||||
- name: Create Forgejo release
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ forge.ref_name }}"
|
||||
REPO="${{ forge.repository }}"
|
||||
API_URL="${{ forge.api_url }}"
|
||||
jq -n --arg tag "$TAG" --rawfile body /tmp/changelog.md \
|
||||
'{tag_name: $tag, name: $tag, body: $body}' > /tmp/release-payload.json
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @/tmp/release-payload.json \
|
||||
"$API_URL/repos/$REPO/releases")
|
||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||
echo "Failed to create release:"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@Luminate.flatpak" \
|
||||
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=Luminate-$TAG.flatpak"
|
||||
Loading…
Add table
Add a link
Reference in a new issue