merge actions test into end-to-end.sh

* replace the high level test running actions tests with end-to-end.sh
* set DOMAIN to the IP instead of 127.0.0.1 for runner <-> forgejo communications
* move forgejo_cli from a function to a file so that it can be used by forgejo-runner.sh
* keep the documentation updates workflows separate because they need to open one PR per version
This commit is contained in:
Twenty Panda 2024-03-20 11:51:46 +01:00
parent 5bb5e037ce
commit 96f91063c9
21 changed files with 235 additions and 269 deletions

View file

@ -1,82 +0,0 @@
#
#
# https://code.forgejo.org/forgejo/end-to-end/settings/actions
#
# secrets.CASCADE_DOCS_ORIGIN_TOKEN
# https://code.forgejo.org/forgejo-ci scope write:issue, read:repository, read:user
# vars.CASCADE_DOCS_DESTINATION_DOER
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
# vars.CASCADE_DOCS_FORCE_VERSION
# replace the generated documentation for a given version even if it has already
# been generated (e.g. v7.0.0-test)
#
on:
pull_request:
push:
branches:
- 'main'
jobs:
actions:
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 }}
- version: v1.20
forgejo: https://codeberg.org
repo: forgejo/forgejo
tests: ${{ vars.V1_20_TESTS }}
steps:
- uses: actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-forgejo@v2
with:
install-only: true
- name: run
id: 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
su -c "actions/run.sh $binary $full_version ${{ matrix.info.version }} ${{ matrix.info.tests }}" forgejo
echo full_version="$full_version" >> $GITHUB_OUTPUT
- name: update documentation
if: matrix.info.tests != 'none' && github.ref == 'refs/heads/main'
uses: https://code.forgejo.org/actions/cascading-pr@v1
with:
origin-url: ${{ env.GITHUB_SERVER_URL }}
origin-repo: ${{ github.repository }}
origin-token: ${{ secrets.CASCADE_DOCS_ORIGIN_TOKEN }}
origin-ref: refs/heads/main
destination-url: https://codeberg.org
destination-fork-repo: ${{ vars.CASCADE_DOCS_DESTINATION_DOER }}/docs
destination-repo: forgejo/docs
destination-branch: ${{ matrix.info.branch || matrix.info.version }}
destination-token: ${{ secrets.CASCADE_DOCS_DESTINATION_TOKEN }}
prefix: ${{ env.GITHUB_REPOSITORY }}-${{ matrix.info.version }}
update: .forgejo/cascading-docs
env:
FORCE_VERSION: "${{ vars.CASCADE_DOCS_FORCE_VERSION }}"
VERSION: "${{ steps.run.outputs.full_version }}"

View file

@ -1,3 +1,18 @@
#
#
# https://code.forgejo.org/forgejo/end-to-end/settings/actions
#
# secrets.CASCADE_DOCS_ORIGIN_TOKEN
# https://code.forgejo.org/forgejo-ci scope write:issue, read:repository, read:user
# vars.CASCADE_DOCS_DESTINATION_DOER
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
# vars.CASCADE_DOCS_FORCE_VERSION
# replace the generated documentation for a given version even if it has already
# been generated (e.g. v7.0.0-test)
#
on:
pull_request:
push:
@ -47,6 +62,57 @@ jobs:
- uses: ./.forgejo/prepare-end-to-end
- run: su forgejo -c "./end-to-end.sh test_packages"
actions:
needs: [build]
runs-on: lxc-bookworm
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- run: su forgejo -c "./end-to-end.sh test_actions"
actions-docs:
needs: [build]
runs-on: lxc-bookworm
if: github.ref == 'refs/heads/main'
strategy:
matrix:
info:
- version: 7.0
branch: next
forgejo: https://codeberg.org
repo: forgejo-experimental/forgejo
- version: 1.21
forgejo: https://codeberg.org
repo: forgejo/forgejo
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: ./.forgejo/prepare-end-to-end
- name: set full-version
id: full-version
shell: bash
run: |
set -x
full_version=$(./end-to-end.sh full_version ${{ matrix.info.version }})
echo value="$full_version" >> $GITHUB_OUTPUT
- run: su forgejo -c "./end-to-end.sh test_actions ${{ matrix.info.version }}"
- name: update documentation
uses: https://code.forgejo.org/actions/cascading-pr@v1
with:
origin-url: ${{ env.GITHUB_SERVER_URL }}
origin-repo: ${{ github.repository }}
origin-token: ${{ secrets.CASCADE_DOCS_ORIGIN_TOKEN }}
origin-ref: refs/heads/main
destination-url: https://codeberg.org
destination-fork-repo: ${{ vars.CASCADE_DOCS_DESTINATION_DOER }}/docs
destination-repo: forgejo/docs
destination-branch: ${{ matrix.info.branch || format('v{0}', matrix.info.version) }}
destination-token: ${{ secrets.CASCADE_DOCS_DESTINATION_TOKEN }}
prefix: ${{ env.GITHUB_REPOSITORY }}-${{ matrix.info.version }}
update: .forgejo/cascading-docs
env:
FORCE_VERSION: "${{ vars.CASCADE_DOCS_FORCE_VERSION }}"
VERSION: "${{ steps.full-version.outputs.value }}"
upgrade:
name: upgrade and storage
needs: [build]