packages: simplify the setup to use the same as upgrades

the packages tests control which Forgejo version they run against so
they can test a feature on version X+1 and not on version X
This commit is contained in:
Twenty Panda 2024-03-15 14:34:55 +07:00 committed by p
parent dd35a9f1a8
commit 9ff495254a
8 changed files with 64 additions and 153 deletions

View file

@ -1,43 +0,0 @@
on:
pull_request:
push:
branches:
- 'main'
jobs:
packages:
runs-on: self-hosted
strategy:
matrix:
info:
- version: v7.0
branch: next
forgejo: https://codeberg.org
repo: forgejo-experimental/forgejo
tests: ${{ vars.V7_0_TESTS }}
- version: v1.21
forgejo: https://codeberg.org
repo: forgejo/forgejo
tests: ${{ vars.V1_21_TESTS }}
steps:
- uses: actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-forgejo@v2
with:
install-only: true
- name: run
if: matrix.info.tests != 'none'
shell: bash
run: |
set -x
forgejo-binary.sh ensure_user forgejo
full_version=$(curl -sS ${{ matrix.info.forgejo }}/api/v1/repos/${{ matrix.info.repo }}/releases | jq -r '.[] | .tag_name | select(startswith("${{ matrix.info.version }}"))' | sort -r | head -1)
binary=${{ matrix.info.forgejo }}/${{ matrix.info.repo }}/releases/download/${full_version}/forgejo-${full_version#v}-linux-amd64
export DIR=$(mktemp -d)
chown forgejo $DIR /srv
export VERBOSE="${{ vars.VERBOSE || false }}"
su -c "packages/run.sh $binary $full_version ${{ matrix.info.version }} ${{ matrix.info.tests }}" forgejo

View file

@ -31,8 +31,11 @@ jobs:
with:
go-version: "1.21"
- run: |
apt-get update -qq
apt-get -q install -qq -y docker.io
git config --add safe.directory '*'
adduser --quiet --comment forgejo --disabled-password forgejo
adduser forgejo docker
chown -R forgejo:forgejo .
- run: |
script=$(pwd)/forgejo/upgrades/test-upgrade.sh