[squash] Switch to Forgejo Actions

This commit is contained in:
crystal 2024-04-27 18:55:53 -06:00
parent 371709d631
commit 08f545c366
No known key found for this signature in database
GPG key ID: 1122054731F7CC43
6 changed files with 284 additions and 366 deletions

View file

@ -19,6 +19,40 @@ case "$1" in
make "$@" make "$@"
exit $? exit $?
;; ;;
"actions-prep")
case "$2" in
"build-forgejo-deb")
APREP_APT_EXTRAS="debhelper devscripts sudo"
;;
"installtest")
APREP_APT_EXTRAS="sudo"
;;
"")
APREP_APT_EXTRAS=
;;
*)
echo "Invalid argument: $2"
exit 98
;;
esac
EXIT_TOTAL=0
apt update
EXIT_TOTAL=$(($EXIT_TOTAL+$?))
apt upgrade -y
EXIT_TOTAL=$(($EXIT_TOTAL+$?))
if [ "$APREP_APT_EXTRAS" ] ; then
apt install $APREP_APT_EXTRAS -y
EXIT_TOTAL=$(($EXIT_TOTAL+$?))
fi
ACTIONS_FORGEJOSHA="$(git rev-parse --short=10 HEAD)"
if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
echo "::set-output name=artifactlabel::$GITHUB_REF_NAME-$ACTIONS_FORGEJOSHA"
else
echo "::set-output name=artifactlabel::$ACTIONS_FORGEJOSHA"
fi
echo "::set-output name=forgejosha::$ACTIONS_FORGEJOSHA"
exit $EXIT_TOTAL
;;
"ci-verify") "ci-verify")
RETRY_LOOPS=0 RETRY_LOOPS=0
while [ $RETRY_LOOPS -le $CI_VERIFY_RETRY_COUNT ] ; do while [ $RETRY_LOOPS -le $CI_VERIFY_RETRY_COUNT ] ; do
@ -43,6 +77,26 @@ case "$1" in
exit 255 exit 255
;; ;;
"download-binary") "download-binary")
if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
echo "INFO: Forgejo Actions mode!"
CI_COMMIT_TAG="$GITHUB_REF_NAME"
elif [ "$GITHUB_REF_TYPE" = "branch" ] ; then
echo "WARNING: Not building a tag! Simulating it..."
echo "(forgejo actions mode)"
echo "(this will test the binary packaging without cutting a tag in the package)"
echo "Resolving tag..."
cd forgejo
CI_COMMIT_TAG_RESOLVE=$(git tag --points-at HEAD)
if [ ! $CI_COMMIT_TAG_RESOLVE ] ; then
echo "Failed to resolve exact tag! Getting as close as we can..."
git describe --tags HEAD
CI_COMMIT_TAG_RESOLVE=$(git describe --tags HEAD --abbrev=0)
echo "Closest existing tag: $CI_COMMIT_TAG_RESOLVE"
fi
cd ..
echo "Proceeding with resolved tag: $CI_COMMIT_TAG_RESOLVE"
CI_COMMIT_TAG="$CI_COMMIT_TAG_RESOLVE"
fi
if [ $CI_COMMIT_TAG ] ; then if [ $CI_COMMIT_TAG ] ; then
CI_RELEASE_ASSETS=$(curl $CI_VERIFY_API/api/v1/repos/$CI_VERIFY_REPO/releases/tags/$CI_COMMIT_TAG | jq -c '.assets[]' | grep linux-amd64) CI_RELEASE_ASSETS=$(curl $CI_VERIFY_API/api/v1/repos/$CI_VERIFY_REPO/releases/tags/$CI_COMMIT_TAG | jq -c '.assets[]' | grep linux-amd64)
CI_RELEASE_BINARY_URL=$(echo "$CI_RELEASE_ASSETS" | grep linux-amd64\" | jq -r --jsonargs .browser_download_url) CI_RELEASE_BINARY_URL=$(echo "$CI_RELEASE_ASSETS" | grep linux-amd64\" | jq -r --jsonargs .browser_download_url)
@ -77,9 +131,17 @@ case "$1" in
cat deb/.forgejo-bin.control >> deb/debian/control cat deb/.forgejo-bin.control >> deb/debian/control
fi fi
;; ;;
"package-build-deps")
cd deb
mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" --remove
exit $?
;;
"package-build") "package-build")
cd deb cd deb
dpkg-buildpackage -b if [ "$2" = "actions" ] ; then
PACKAGE_BUILD_EXTRA_ARGS="--no-sign"
fi
dpkg-buildpackage -b $PACKAGE_BUILD_EXTRA_ARGS
exit $? exit $?
;; ;;
"package-clean") "package-clean")

View file

@ -1,360 +0,0 @@
labels:
platform: linux/amd64
when:
event: [ push, tag ]
variables:
- &ci_verify_image 'sc.cryxtal.org/ci-img/git-curl-jq:latest'
- &golang_image 'golang:1.22-bullseye'
- &forgejo_test_image 'docker.io/node:20-bookworm'
- &nodejs_image 'docker.io/node:20-bookworm'
- &bin_dl_image 'sc.cryxtal.org/ci-img/bin-dl:latest'
- &deb_build_image 'sc.cryxtal.org/ci-img/dh:bullseye'
- &deb_test_image_bullseye 'sc.cryxtal.org/ci-img/deb-test:bullseye'
- &deb_test_image_bookworm 'sc.cryxtal.org/ci-img/deb-test:bookworm'
- &deb_test_image_buster 'sc.cryxtal.org/ci-img/deb-test:buster'
- &deb_test_image_sid 'sc.cryxtal.org/ci-img/deb-test:sid'
- &deb_test_image_jammy 'sc.cryxtal.org/ci-img/deb-test-ubuntu:jammy'
- &deb_test_image_focal 'sc.cryxtal.org/ci-img/deb-test-ubuntu:focal'
- &deb_test_image_mantic 'sc.cryxtal.org/ci-img/deb-test-ubuntu:mantic'
- &deb_test_image_lunar 'sc.cryxtal.org/ci-img/deb-test-ubuntu:lunar'
- &forgejo_test_golang_ver '1.22'
- &forgejo_test_golang_nodeb_rev '2'
- &build_submodule 'forgejo'
- &goproxy_override ''
- &goproxy_setup |-
if [ -n "$${GOPROXY_OVERRIDE:-}" ]; then
export GOPROXY="$${GOPROXY_OVERRIDE}";
echo "Using goproxy from goproxy_override \"$${GOPROXY}\"";
elif [ -n "$${GOPROXY_DEFAULT:-}" ]; then
export GOPROXY="$${GOPROXY_DEFAULT}";
echo "Using goproxy from goproxy_default (secret) not displaying";
else
export GOPROXY="https://proxy.golang.org,direct";
echo "No goproxy overrides or defaults given, using \"$${GOPROXY}\"";
fi
workspace:
base: /go
path: src/cryxtal/forgejo-deb
clone:
git:
image: woodpeckerci/plugin-git
settings:
recursive: true
steps:
fetch-tags:
image: *ci_verify_image
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
- git submodule foreach 'git fetch --tags --force'
git-push-codeberg:
image: *ci_verify_image
secrets: [ cb_git_auth ]
commands:
- git remote add codeberg https://$CB_GIT_AUTH@codeberg.org/forgejo-contrib/forgejo-deb
- if ( $(git rev-parse --is-shallow-repository) == "true" );then git fetch --unshallow origin ;fi
- git fetch codeberg
- git push codeberg --tags refs/remotes/origin/*:refs/heads/*
ci-verify:
image: *ci_verify_image
group: deps
environment:
BUILD_SUBMODULE: *build_submodule
commands:
- ./.ci-make.sh ci-verify "$BUILD_SUBMODULE"
deps-frontend:
image: *nodejs_image
group: deps
environment:
BUILD_SUBMODULE: *build_submodule
commands:
- ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" deps-frontend
deps-backend:
image: *golang_image
group: deps
environment:
BUILD_SUBMODULE: *build_submodule
GOPROXY_OVERRIDE: *goproxy_override
commands:
- *goproxy_setup
- ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" deps-backend
tag-pre-condition:
image: *ci_verify_image
environment:
BUILD_SUBMODULE: *build_submodule
commands:
- cd "$BUILD_SUBMODULE"
- git update-ref refs/heads/tag_test $(git rev-parse --verify HEAD)
security-check:
image: *golang_image
group: checks
environment:
BUILD_SUBMODULE: *build_submodule
GOPROXY_OVERRIDE: *goproxy_override
commands:
- *goproxy_setup
- ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" security-check
checks-backend:
image: *forgejo_test_image
group: checks
environment:
GOPROXY_OVERRIDE: *goproxy_override
DEP_GOLANG_VER: *forgejo_test_golang_ver
DEP_GOLANG_NODEB_REV: *forgejo_test_golang_nodeb_rev
commands:
- *goproxy_setup
- ./.ci-make.sh forgejo-test-deps
- su forgejo -c './.ci-make.sh submodule-make forgejo checks-backend'
- chown -R root:root .
build-frontend:
image: *nodejs_image
group: pre-build
environment:
BUILD_SUBMODULE: *build_submodule
commands:
- ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" frontend
download-bin-amd64:
image: *bin_dl_image
group: build-main
commands:
- ./.ci-make.sh download-binary forgejo-bin-dl
when:
event: [ tag ]
build-forgejo-amd64:
image: *golang_image
group: build-main
environment:
BUILD_SUBMODULE: *build_submodule
GOSUMDB: sum.golang.org
TAGS: bindata
GOPROXY_OVERRIDE: *goproxy_override
commands:
- *goproxy_setup
- ./.ci-make.sh submodule-build "$BUILD_SUBMODULE" forgejo-bin
build-forgejo-sqlite-amd64:
image: *golang_image
environment:
BUILD_SUBMODULE: *build_submodule
GOSUMDB: sum.golang.org
TAGS: bindata sqlite sqlite_unlock_notify
GOPROXY_OVERRIDE: *goproxy_override
commands:
- *goproxy_setup
- ./.ci-make.sh submodule-build "$BUILD_SUBMODULE" forgejo-sqlite-bin
package-bullseye:
image: *deb_build_image
group: package
commands:
- ./.ci-make.sh package-prep
- ./.ci-make.sh package-build
- ./.ci-make.sh package-clean
package-repo:
image: *deb_build_image
group: package
commands:
- cd repo-deb
- ./build.sh
gen-sha256:
image: *ci_verify_image
commands:
- ./.ci-make.sh pkg-gen-sha256
- ./.ci-make.sh preview-sha256
test-inst-bookworm:
image: *deb_test_image_bookworm
group: pkg-test-1
commands:
- ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
test-inst-bookworm-user:
image: *deb_test_image_bookworm
group: pkg-test-1
commands:
- ./.ci-make.sh test-userinst-prep
- ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
test-inst-bullseye-sqlite:
image: *deb_test_image_bullseye
group: pkg-test-1
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-bookworm-sqlite:
image: *deb_test_image_bookworm
group: pkg-test-1
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-buster-sqlite:
image: *deb_test_image_buster
group: pkg-test-2
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-sid-sqlite:
image: *deb_test_image_sid
group: pkg-test-2
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-jammy-sqlite:
image: *deb_test_image_jammy
group: pkg-test-2
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-focal-sqlite:
image: *deb_test_image_focal
group: pkg-test-2
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-mantic-sqlite:
image: *deb_test_image_mantic
group: pkg-test-3
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-lunar-sqlite:
image: *deb_test_image_lunar
group: pkg-test-3
commands:
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
test-inst-bullseye-bin:
image: *deb_test_image_bullseye
group: pkg-test-3
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-bookworm-bin:
image: *deb_test_image_bookworm
group: pkg-test-3
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-buster-bin:
image: *deb_test_image_buster
group: pkg-test-4
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-sid-bin:
image: *deb_test_image_sid
group: pkg-test-4
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-jammy-bin:
image: *deb_test_image_jammy
group: pkg-test-4
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-focal-bin:
image: *deb_test_image_focal
group: pkg-test-4
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-mantic-bin:
image: *deb_test_image_mantic
group: pkg-test-5
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-inst-lunar-bin:
image: *deb_test_image_lunar
group: pkg-test-5
commands:
- ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
when:
event: [ tag ]
test-repo-bookworm-sqlite:
image: *deb_test_image_bookworm
group: pkg-test-5
commands:
- ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
- ./.ci-make.sh force-clean-forgejo
- ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- ./.ci-make.sh verify-data-dir-chmod
upload-crystalcommit:
image: woodpeckerci/plugin-gitea-release
group: upload
settings:
base_url: https://sc.cryxtal.org
files:
- "*.deb"
- "*.deb.sha256"
api_key:
from_secret: sc_api_key
prerelease: false
skip_verify: true
when:
event: [ tag ]
upload-codeberg:
image: woodpeckerci/plugin-gitea-release
group: upload
settings:
base_url: https://codeberg.org
files:
- "*.deb"
- "*.deb.sha256"
api_key:
from_secret: cb_api_key
prerelease: false
skip_verify: true
when:
event: [ tag ]
publish-apt-repo:
image: *ci_verify_image
group: upload
environment:
FORGEJO_SITE: https://code.forgejo.org
FORGEJO_OWNER: forgejo-contrib
DEBIAN_DIST: bullseye
DEBIAN_COMPONENT: forgejo-lts
secrets: [ cfo_api_key ]
commands:
- export FORGEJO_KEY=$CFO_API_KEY
- ./.ci-forgejo-apt.sh *.deb
when:
event: [ tag ]

View file

@ -0,0 +1,215 @@
on: [push]
jobs:
build-forgejo-deb:
runs-on: bullseye
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/setup-go@v4
with:
go-version: "1.22"
check-latest: true
- name: "actions prep: build-forgejo-deb"
id: ciprep
run: ./.ci-make.sh actions-prep build-forgejo-deb
- name: fetch tags
run: |
git config --add safe.directory '*'
git fetch --tags --force
git submodule foreach 'git fetch --tags --force'
- uses: crystal/install-jq-action@v2.1.0
- run: ./.ci-make.sh ci-verify forgejo
- run: ./.ci-make.sh submodule-make forgejo deps-frontend
- run: ./.ci-make.sh submodule-make forgejo deps-backend
- name: tag pre-condition
run: |
cd forgejo
git update-ref refs/heads/tag_test $(git rev-parse --verify HEAD)
- run: ./.ci-make.sh submodule-make forgejo security-check
- run: ./.ci-make.sh submodule-make forgejo frontend
- run: ./.ci-make.sh submodule-make forgejo checks-backend
- name: Download Forgejo binary
run: ./.ci-make.sh download-binary forgejo-bin-dl
- name: Build Forgejo for amd64
run: ./.ci-make.sh submodule-build forgejo forgejo-bin
env:
TAGS: bindata
- name: Build Forgejo (with SQLite) for amd64
run: ./.ci-make.sh submodule-build forgejo forgejo-sqlite-bin
env:
TAGS: bindata sqlite sqlite_unlock_notify
- run: ./.ci-make.sh package-prep
- run: ./.ci-make.sh package-build-deps
- run: ./.ci-make.sh package-build actions
- run: ./.ci-make.sh package-clean
- name: build repo package
run: |
cd repo-deb
./build.sh actions
- name: generate sha256
run: |
./.ci-make.sh pkg-gen-sha256
./.ci-make.sh preview-sha256
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- uses: actions/upload-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
path: |
*.deb
*.deb.sha256
repo-deb/*.deb
installtest-bookworm-sqlite:
runs-on: bookworm
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
installtest-bullseye-sqlite:
runs-on: bullseye
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
installtest-buster-sqlite:
runs-on: buster
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
installtest-bookworm-user:
runs-on: bookworm
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh test-userinst-prep
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
testsuite-repo-upgrade-sqlite:
runs-on: bookworm
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh verify-data-dir-chmod
installtest-buster-bin:
runs-on: buster
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
publish-release-repo:
runs-on: bookworm
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: actions prep
id: ciprep
run: ./.ci-make.sh actions-prep
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- uses: crystal/install-jq-action@v2.1.0
- run: mkdir forgejo-release
- run: mv *.deb *.deb.sha256 forgejo-release/
- uses: actions/forgejo-release@v1
with:
direction: upload
url: https://codeberg.org
token: ${{ secrets.codeberg_api_key }}
release-dir: forgejo-release
- name: Debian package registry publish
env:
FORGEJO_SITE: https://code.forgejo.org
FORGEJO_OWNER: forgejo-contrib
DEBIAN_DIST: bullseye
DEBIAN_COMPONENT: forgejo-lts
FORGEJO_KEY: ${{ secrets.cfo_api_key }}
run: |
cd forgejo-release
../.ci-forgejo-apt.sh *.deb
cd ..

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "forgejo"] [submodule "forgejo"]
path = forgejo path = forgejo
url = https://sc.cryxtal.org/forgejo/forgejo url = https://codeberg.org/forgejo/forgejo

View file

@ -1,8 +1,6 @@
# Debian Packages for Forgejo # Debian Packages for Forgejo
Hello! If you want to run Forgejo on Debian/Ubuntu and you're looking for packages to install it to your system, you've come to the right place! Hello! If you want to run Forgejo on Debian/Ubuntu and you're looking for packages to install it to your system, you've come to the right place!
### Build test: [![ci-status](https://ci.cryxtal.org/api/badges/forgejo-contrib/forgejo-deb/status.svg)](https://ci.cryxtal.org/forgejo-contrib/forgejo-deb)
## Download info ## Download info
You can find the latest release downloads in [the releases tab](https://codeberg.org/forgejo-contrib/forgejo-deb/releases). There are currently 3 packages built by this script. You can find the latest release downloads in [the releases tab](https://codeberg.org/forgejo-contrib/forgejo-deb/releases). There are currently 3 packages built by this script.
- `forgejo`: A basic production-ready Forgejo build without SQLite support - `forgejo`: A basic production-ready Forgejo build without SQLite support

View file

@ -4,10 +4,13 @@ cp code-forgejo-org-forgejo-contrib.asc stub/
cp code-forgejo-org-forgejo-contrib.asc main/ cp code-forgejo-org-forgejo-contrib.asc main/
cp forgejo-deb.list stub/ cp forgejo-deb.list stub/
cp forgejo-deb.list main/ cp forgejo-deb.list main/
if [ "$1" = "actions" ] ; then
PACKAGE_BUILD_EXTRA_ARGS="--no-sign"
fi
cd stub cd stub
dpkg-buildpackage -b dpkg-buildpackage -b $PACKAGE_BUILD_EXTRA_ARGS
cd .. cd ..
cd main cd main
dpkg-buildpackage -b dpkg-buildpackage -b $PACKAGE_BUILD_EXTRA_ARGS
cd .. cd ..
exit 0 exit 0