diff --git a/.forgejo/workflows/pr-checks.yml b/.forgejo/workflows/pr-checks.yml new file mode 100644 index 0000000..d60baff --- /dev/null +++ b/.forgejo/workflows/pr-checks.yml @@ -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 diff --git a/.forgejo/workflows/pr-labeler.yml b/.forgejo/workflows/pr-labeler.yml new file mode 100644 index 0000000..643f326 --- /dev/null +++ b/.forgejo/workflows/pr-labeler.yml @@ -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" diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..86eef8d --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -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" diff --git a/dev.bscubed.Luminate.json b/dev.bscubed.Luminate.json index 465f768..c9d679f 100644 --- a/dev.bscubed.Luminate.json +++ b/dev.bscubed.Luminate.json @@ -16,7 +16,10 @@ ], "build-options": { "append-path": "/usr/lib/sdk/swift6/bin", - "prepend-ld-library-path": "/usr/lib/sdk/swift6/lib" + "prepend-ld-library-path": "/usr/lib/sdk/swift6/lib", + "build-args": [ + "--socket=x11" + ] }, "cleanup": [ "/include", @@ -38,10 +41,13 @@ { "type": "dir", "path": "." - } + }, + "generated-sources.json" ], "build-commands": [ - "swift build -c debug --static-swift-stdlib", + "./setup-offline.sh", + "swift build -c debug --static-swift-stdlib --skip-update", + "swift test --enable-code-coverage --skip-update", "strip .build/debug/Luminate", "install -Dm755 .build/debug/Luminate /app/bin/Luminate", "install -Dm644 data/dev.bscubed.Luminate.metainfo.xml $DESTDIR/app/share/metainfo/dev.bscubed.Luminate.metainfo.xml", diff --git a/generated-sources.json b/generated-sources.json new file mode 100644 index 0000000..35327bb --- /dev/null +++ b/generated-sources.json @@ -0,0 +1,146 @@ +[ + { + "type": "git", + "url": "https://git.aparoksha.dev/aparoksha/adwaita-swift", + "disable-shallow-clone": true, + "commit": "fc9837ff7f0a5f2814c458ef401cd57bcedd6eed", + "dest": ".build/checkouts/adwaita-swift" + }, + { + "type": "git", + "url": "https://github.com/stephencelis/CSQLite", + "disable-shallow-clone": true, + "commit": "bdb5580e54cdf49251b365ea34e2651199473240", + "dest": ".build/checkouts/CSQLite" + }, + { + "type": "git", + "url": "https://git.aparoksha.dev/aparoksha/levenshtein-transformations", + "disable-shallow-clone": true, + "commit": "06577a2c4c6419ed859e34a8fb7be87a3b8975da", + "dest": ".build/checkouts/levenshtein-transformations" + }, + { + "type": "git", + "url": "https://git.aparoksha.dev/aparoksha/localized", + "disable-shallow-clone": true, + "commit": "29d4c3fe923ef095a0be2b95cf9b31171edf918b", + "dest": ".build/checkouts/localized" + }, + { + "type": "git", + "url": "https://git.aparoksha.dev/aparoksha/meta", + "disable-shallow-clone": true, + "commit": "f47727df52b1c2b36dec5df1c2bd10dc63e4c7d6", + "dest": ".build/checkouts/meta" + }, + { + "type": "git", + "url": "https://git.aparoksha.dev/aparoksha/meta-sqlite", + "disable-shallow-clone": true, + "commit": "6e7940c06a5ac92b10faf5c62b19fb6a02aea59c", + "dest": ".build/checkouts/meta-sqlite" + }, + { + "type": "git", + "url": "https://github.com/mattpolzin/OpenAPIKit", + "disable-shallow-clone": true, + "commit": "57b6318128e3f901c93f4fbf98d1c1464ec168d3", + "dest": ".build/checkouts/OpenAPIKit" + }, + { + "type": "git", + "url": "https://github.com/sqlcipher/SQLCipher.swift", + "disable-shallow-clone": true, + "commit": "07bf6bc2191a063d6f1e7c3b5f276a3fadfe36b7", + "dest": ".build/checkouts/SQLCipher.swift" + }, + { + "type": "git", + "url": "https://github.com/stephencelis/SQLite.swift", + "disable-shallow-clone": true, + "commit": "964c300fb0736699ce945c9edb56ecd62eba27a3", + "dest": ".build/checkouts/SQLite.swift" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-algorithms", + "disable-shallow-clone": true, + "commit": "87e50f483c54e6efd60e885f7f5aa946cee68023", + "dest": ".build/checkouts/swift-algorithms" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-argument-parser", + "disable-shallow-clone": true, + "commit": "6a52f3251125d74daf04fcbd5e6f08a75d074382", + "dest": ".build/checkouts/swift-argument-parser" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-collections", + "disable-shallow-clone": true, + "commit": "fea17c02d767f46b23070fdfdacc28a03a39232a", + "dest": ".build/checkouts/swift-collections" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-http-types", + "disable-shallow-clone": true, + "commit": "45eb0224913ea070ec4fba17291b9e7ecf4749ca", + "dest": ".build/checkouts/swift-http-types" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-log", + "disable-shallow-clone": true, + "commit": "92448c359f00ebe36ae97d3bd9086f13c7692b5a", + "dest": ".build/checkouts/swift-log" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-numerics.git", + "disable-shallow-clone": true, + "commit": "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "dest": ".build/checkouts/swift-numerics" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-openapi-generator", + "disable-shallow-clone": true, + "commit": "d002e5d9a1ac4ff6466bb89ab8fa1c9a0afd820f", + "dest": ".build/checkouts/swift-openapi-generator" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-openapi-runtime", + "disable-shallow-clone": true, + "commit": "3d3a8457661daf7fb260ceeb9f0e24e5204ba5fb", + "dest": ".build/checkouts/swift-openapi-runtime" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-openapi-urlsession", + "disable-shallow-clone": true, + "commit": "576a65b4ffb8c12ddad4950dc21eea2ef071bec2", + "dest": ".build/checkouts/swift-openapi-urlsession" + }, + { + "type": "git", + "url": "https://github.com/apple/swift-syntax", + "disable-shallow-clone": true, + "commit": "79e4b74a295b6eb74a8b585e3a39d29e70c1dbd1", + "dest": ".build/checkouts/swift-syntax" + }, + { + "type": "git", + "url": "https://github.com/jpsim/Yams", + "disable-shallow-clone": true, + "commit": "3d6871d5b4a5cd519adf233fbb576e0a2af71c17", + "dest": ".build/checkouts/Yams" + }, + { + "type": "file", + "path": "setup-offline.sh" + } +] \ No newline at end of file diff --git a/setup-offline.sh b/setup-offline.sh new file mode 100755 index 0000000..c5961ad --- /dev/null +++ b/setup-offline.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +mkdir .build/repositories +cd .build/repositories +mkdir ./adwaita-swift-3f0bf4f5 +cp -r ../checkouts/adwaita-swift/.git/* ./adwaita-swift-3f0bf4f5 +mkdir ./CSQLite-ccd351fd +cp -r ../checkouts/CSQLite/.git/* ./CSQLite-ccd351fd +mkdir ./levenshtein-transformations-11d2c005 +cp -r ../checkouts/levenshtein-transformations/.git/* ./levenshtein-transformations-11d2c005 +mkdir ./localized-ba75408f +cp -r ../checkouts/localized/.git/* ./localized-ba75408f +mkdir ./meta-e44c5837 +cp -r ../checkouts/meta/.git/* ./meta-e44c5837 +mkdir ./meta-sqlite-d4990edc +cp -r ../checkouts/meta/.git/* ./meta-sqlite-d4990edc +mkdir ./meta-sqlite-d4990edc +cp -r ../checkouts/meta-sqlite/.git/* ./meta-sqlite-d4990edc +mkdir ./OpenAPIKit-5420c066 +cp -r ../checkouts/OpenAPIKit/.git/* ./OpenAPIKit-5420c066 +mkdir ./SQLCipher.swift-5392e827 +cp -r ../checkouts/SQLCipher.swift/.git/* ./SQLCipher.swift-5392e827 +mkdir ./SQLite.swift-bde2929d +cp -r ../checkouts/SQLite.swift/.git/* ./SQLite.swift-bde2929d +mkdir ./swift-algorithms-bf5a01cd +cp -r ../checkouts/swift-algorithms/.git/* ./swift-algorithms-bf5a01cd +mkdir ./swift-argument-parser-54a11a8d +cp -r ../checkouts/swift-argument-parser/.git/* ./swift-argument-parser-54a11a8d +mkdir ./swift-collections-9a58d5cf +cp -r ../checkouts/swift-collections/.git/* ./swift-collections-9a58d5cf +mkdir ./swift-http-types-ddff8b60 +cp -r ../checkouts/swift-http-types/.git/* ./swift-http-types-ddff8b60 +mkdir ./swift-log-ba8887eb +cp -r ../checkouts/swift-log/.git/* ./swift-log-ba8887eb +mkdir ./swift-numerics-d936ec6c +cp -r ../checkouts/swift-numerics/.git/* ./swift-numerics-d936ec6c +mkdir ./swift-openapi-generator-d5abee00 +cp -r ../checkouts/swift-openapi-generator/.git/* ./swift-openapi-generator-d5abee00 +mkdir ./swift-openapi-runtime-c68fe40f +cp -r ../checkouts/swift-openapi-runtime/.git/* ./swift-openapi-runtime-c68fe40f +mkdir ./swift-openapi-urlsession-03c02701 +cp -r ../checkouts/swift-openapi-urlsession/.git/* ./swift-openapi-urlsession-03c02701 +mkdir ./swift-syntax-463e60c9 +cp -r ../checkouts/swift-syntax/.git/* ./swift-syntax-463e60c9 +mkdir ./Yams-fd9f2519 +cp -r ../checkouts/Yams/.git/* ./Yams-fd9f2519 \ No newline at end of file