diff --git a/.forgejo/workflows/end-to-end.yml b/.forgejo/workflows/end-to-end.yml index cb8fa30..09ca5d4 100644 --- a/.forgejo/workflows/end-to-end.yml +++ b/.forgejo/workflows/end-to-end.yml @@ -54,17 +54,6 @@ jobs: name: forgejo-dev path: /tmp/forgejo-upload - packages: - 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_packages" - - name: full logs - if: always() - run: su forgejo -c "./end-to-end.sh show_logs" - actions: needs: [build] runs-on: lxc-bookworm @@ -75,59 +64,3 @@ jobs: - name: full logs if: always() run: su forgejo -c "./end-to-end.sh show_logs" - - 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 - owner: forgejo-experimental - - version: "1.21" - forgejo: https://codeberg.org - owner: 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 }} ${{ matrix.info.owner }}) - 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@v2.1 - 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] - 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_upgrades" - - run: su forgejo -c "./end-to-end.sh test_storage" - - name: full logs - if: always() - run: su forgejo -c "./end-to-end.sh show_logs" diff --git a/actions/actions.sh b/actions/actions.sh index ee3e128..49a6eb5 100755 --- a/actions/actions.sh +++ b/actions/actions.sh @@ -6,6 +6,7 @@ ACTIONS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function actions_verify_example() { local example=$1 + export HOST_PORT export url=http://${FORGEJO_USER}:${FORGEJO_PASSWORD}@${HOST_PORT} export token=$(cat $DOT_FORGEJO_CURL/token) @@ -87,7 +88,7 @@ function actions_runner_version() { } function test_actions() { - local versions="${1:-1.20 1.21 $RELEASE_NUMBERS_AND_DEV}" + local versions=8.0-dev for version in $versions ; do @@ -96,20 +97,11 @@ function test_actions() { log_info "Testing actions with Forgejo $version & Forgejo runner $runner_version" - if dpkg --compare-versions $version ge 7.0 && dpkg --compare-versions $runner_version gt 3.3.0 ; then - for example in artifacts-v4 ; do + if dpkg --compare-versions $version ge 7.0 ; then + for example in 7-0-schedule ; do run actions_verify_example $example done fi - for example in echo checkout service container expression local-action docker-action if if-fail ; do - run actions_verify_example $example - done - - if dpkg --compare-versions $version gt 1.20 ; then - for example in push tag push-cancel artifacts pull-request context cron ; do - run actions_verify_example $example - done - fi done } diff --git a/actions/example-7-0-schedule/.forgejo/workflows/test.yml b/actions/example-7-0-schedule/.forgejo/workflows/test.yml new file mode 100644 index 0000000..e546741 --- /dev/null +++ b/actions/example-7-0-schedule/.forgejo/workflows/test.yml @@ -0,0 +1,23 @@ +on: + schedule: + - cron: '* * * * *' + +jobs: + test: + runs-on: ${{ vars.TEST_SCHEDULE_RUNSON }} + container: + image: code.forgejo.org/oci/debian:bookworm + options: "--volume /srv/example:/srv/example" + + steps: + - run: | + echo "TEST_SCHEDULE_RUNSON=${{ vars.TEST_SCHEDULE_RUNSON }}" + touch /srv/example/7-0-schedule-volume/DONE + + - name: save context + run: | + d=/srv/example/7-0-schedule/contexts/$GITHUB_EVENT_NAME + mkdir -p $d + cat > $d/github <<'EOF' + ${{ toJSON(github) }} + EOF diff --git a/actions/example-7-0-schedule/run.sh b/actions/example-7-0-schedule/run.sh new file mode 100755 index 0000000..6da29fe --- /dev/null +++ b/actions/example-7-0-schedule/run.sh @@ -0,0 +1,30 @@ +forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token + +forgejo-curl.sh web -X POST http://${HOST_PORT}/admin/actions/variables/1/delete || true +forgejo-curl.sh web --form name=TEST_SCHEDULE_RUNSON --form data=docker http://${HOST_PORT}/admin/actions/variables/new + +# +# Verify that creating a new branch with the same SHA as the default branch +# does not change the ref associated with the schedule +# +# See https://codeberg.org/forgejo/forgejo/pulls/1941 for more information +# +function verify_ref() { + local ref=$(sqlite3 $DIR/forgejo-work-path/forgejo.db 'select ref from action_schedule') + test "${ref##*/}" = "main" +} +verify_ref +api=$url/api/v1 +forgejo-curl.sh api_json --data '{"new_branch_name":"zzzz"}' $api/repos/root/example-7-0-schedule/branches +verify_ref + +# runs once per minute, give it three minutes max before declaring failure +if ! RETRY_DELAYS="30 30 30 30 30 30" forgejo.sh retry test -f /srv/example/7-0-schedule-volume/DONE ; then + cat $FORGEJO_RUNNER_LOGS + false +fi + +c=/srv/example/7-0-schedule/contexts/schedule/github +cat $c +test "schedule" = "$(jq -r .event_name < $c)" +test "schedule" = "$(jq -r .event.action < $c)" diff --git a/actions/example-7-0-schedule/setup.sh b/actions/example-7-0-schedule/setup.sh new file mode 100755 index 0000000..384b70e --- /dev/null +++ b/actions/example-7-0-schedule/setup.sh @@ -0,0 +1 @@ +mkdir -p /srv/example/7-0-schedule-volume diff --git a/forgejo/sources/8.0 b/forgejo/sources/8.0 index 1412273..107a90d 100644 --- a/forgejo/sources/8.0 +++ b/forgejo/sources/8.0 @@ -1 +1 @@ -https://codeberg.org/forgejo/forgejo forgejo 8.0.0+gitea-1.22.0 +https://codeberg.org/thefox/forgejo cron-var-context-fix 8.0.0-dev-162-72993c527e+gitea-1.22.0 diff --git a/last-upgrade b/last-upgrade new file mode 100644 index 0000000..4813557 --- /dev/null +++ b/last-upgrade @@ -0,0 +1 @@ +Sat Apr 6 14:54:39 UTC 2024