ci: run Forgejo Actions & Packages test w/ dynamic matrix (#1367)
Incorporates these changes: - When `forgejo/build-from-sources` is present, Actions & Packages tests are run only against the built versions. Otherwise, they are run against the versions defined in `$RELEASE_NUMBERS` - Updates Packages tests which are testing Alpine publishing to use currently supported Alpine releases - Actions & Packages tests are run in a matrix, allowing parallel execution Only the Actions & Packages tests take a significant amount of time (>10 minutes), so changes have been limited to those test suites -- every test suite that is moved into a matrix adds additional overhead in the 1 minute `prepare-end-to-end` step. Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1367 Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
This commit is contained in:
parent
6e89c972c3
commit
1064337c89
13 changed files with 24 additions and 7 deletions
|
|
@ -18,6 +18,7 @@ jobs:
|
|||
image: 'data.forgejo.org/oci/node:20-bookworm'
|
||||
outputs:
|
||||
built: "${{ steps.build.outputs.built }}"
|
||||
forgejo_versions_json: "${{ steps.build.outputs.forgejo_versions_json }}"
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
- uses: https://data.forgejo.org/actions/setup-go@v5
|
||||
|
|
@ -31,6 +32,8 @@ jobs:
|
|||
|
||||
if ! test -f forgejo/build-from-sources; then
|
||||
echo forgejo/build-from-sources is not present, do not build any version from source
|
||||
source lib/lib.sh
|
||||
echo "forgejo_versions_json=$(node -p "JSON.stringify(process.argv[1].split(' '))" "$RELEASE_NUMBERS")" >> $FORGEJO_OUTPUT
|
||||
echo "built=no" >> $FORGEJO_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -52,6 +55,7 @@ jobs:
|
|||
mv $forgejo /tmp/forgejo-upload/forgejo-$version
|
||||
done
|
||||
|
||||
echo "forgejo_versions_json=$(node -p "JSON.stringify(process.argv[1].split(' '))" "$(cat forgejo/build-from-sources)")" >> $FORGEJO_OUTPUT
|
||||
echo "built=yes" >> $FORGEJO_OUTPUT
|
||||
|
||||
- name: steps context dump for debug
|
||||
|
|
@ -70,12 +74,15 @@ jobs:
|
|||
packages:
|
||||
needs: [build]
|
||||
runs-on: lxc-trixie
|
||||
strategy:
|
||||
matrix:
|
||||
forgejo_version: ${{ fromJSON(needs.build.outputs.forgejo_versions_json) }}
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
with:
|
||||
built: ${{ needs.build.outputs.built }}
|
||||
- run: su forgejo -c "./end-to-end.sh test_packages"
|
||||
- run: su forgejo -c "./end-to-end.sh test_packages ${{ matrix.forgejo_version }}"
|
||||
- if: ${{ needs.build.outputs.built == 'yes' }}
|
||||
uses: ./.forgejo/upload-coverage
|
||||
with:
|
||||
|
|
@ -87,13 +94,16 @@ jobs:
|
|||
actions:
|
||||
needs: [build]
|
||||
runs-on: lxc-trixie
|
||||
strategy:
|
||||
matrix:
|
||||
forgejo_version: ${{ fromJSON(needs.build.outputs.forgejo_versions_json) }}
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/prepare-end-to-end
|
||||
with:
|
||||
built: ${{ needs.build.outputs.built }}
|
||||
- run: ./end-to-end.sh prepare_dockerd
|
||||
- run: su forgejo -c "./end-to-end.sh test_actions"
|
||||
- run: su forgejo -c "./end-to-end.sh test_actions ${{ matrix.forgejo_version }}"
|
||||
- if: ${{ needs.build.outputs.built == 'yes' }}
|
||||
uses: ./.forgejo/upload-coverage
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ jobs:
|
|||
- name: determine if the PR is from a fork
|
||||
id: forked
|
||||
run: |
|
||||
set -x
|
||||
if test ${{ forge.event.pull_request.base.repo.full_name }} = ${{ forge.event.pull_request.head.repo.full_name }} ; then
|
||||
echo value=false >> $FORGEJO_OUTPUT
|
||||
else
|
||||
|
|
@ -87,6 +88,7 @@ jobs:
|
|||
|
||||
- name: save event
|
||||
run: |
|
||||
set -x
|
||||
d=/srv/example/cache-pull-request/contexts/${{ forgejo.event.pull_request.head.repo.owner.username }}/$FORGEJO_EVENT_NAME
|
||||
mkdir -p $d
|
||||
cat > $d/forgejo-${{ forgejo.event.action }} <<'EOF'
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ function main() {
|
|||
# wait for the opened event to succeed using the cache on all pull requests
|
||||
#
|
||||
if ! forgejo.sh retry $EXAMPLE_DIR/assert-contexts-opened.sh; then
|
||||
echo "assert-contexts-opened.sh failed; printing related logs and information:"
|
||||
find $d
|
||||
sed -e 's/^/[RUNNER LOGS]/' <$FORGEJO_RUNNER_LOGS
|
||||
return 1
|
||||
|
|
@ -69,6 +70,7 @@ function main() {
|
|||
# wait for the closed event to succeed using the cache on all pull requests
|
||||
#
|
||||
if ! forgejo.sh retry $EXAMPLE_DIR/assert-contexts-closed.sh; then
|
||||
echo "assert-contexts-closed.sh failed; printing related logs and information:"
|
||||
find $d
|
||||
sed -e 's/^/[RUNNER LOGS]/' <$FORGEJO_RUNNER_LOGS
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
alpine-7.0
|
||||
|
|
@ -7,7 +7,7 @@ function test_packages_alpine_version() {
|
|||
reset_forgejo $PACKAGES_DIR/alpine-app.ini
|
||||
start_forgejo $forgejo_version
|
||||
|
||||
local d=$PACKAGES_DIR/alpine-$forgejo_version
|
||||
local d=$PACKAGES_DIR/alpine
|
||||
local token=$(cat $DIR/forgejo-curl/token)
|
||||
local url=http://${HOST_PORT}
|
||||
|
||||
|
|
@ -16,8 +16,10 @@ function test_packages_alpine_version() {
|
|||
}
|
||||
|
||||
function test_packages_alpine() {
|
||||
for alpine_version in 3.20 3.21; do
|
||||
for forgejo_version in 7.0 10.0; do
|
||||
local forgejo_versions="${1:-$RELEASE_NUMBERS}"
|
||||
|
||||
for alpine_version in 3.22 3.23; do
|
||||
for forgejo_version in $forgejo_versions; do
|
||||
test_packages_alpine_version $alpine_version $forgejo_version
|
||||
done
|
||||
done
|
||||
|
|
|
|||
|
|
@ -7,5 +7,7 @@ PACKAGES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
source $PACKAGES_DIR/alpine.sh
|
||||
|
||||
function test_packages() {
|
||||
run test_packages_alpine
|
||||
local forgejo_versions="${1:-$RELEASE_NUMBERS}"
|
||||
|
||||
run test_packages_alpine $forgejo_versions
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue