From e1fd4cbc0f9fdc503e974810a46b96ac06b05854 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Thu, 21 Mar 2024 14:25:28 +0100 Subject: [PATCH] actions: test {upload,download}-artifacts@v4 support If Forgejo version is >= 7.0 and Forgejo runner > 3.3.0 artifacts@v4 are tested to work with a forked modified version that claims to be compatible. --- actions/actions.sh | 17 +++++++ .../.forgejo/workflows/test.yml | 47 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 actions/example-artifacts-v4/.forgejo/workflows/test.yml diff --git a/actions/actions.sh b/actions/actions.sh index fb3c18e..3596139 100755 --- a/actions/actions.sh +++ b/actions/actions.sh @@ -76,6 +76,16 @@ function actions_teardown() { stop_daemon forgejo } +function actions_runner_version() { + local runner_version=$($DIR/forgejo-runner --version | sed -n -e 's/forgejo-runner version v//p') + if test -z "$runner_version" ; then + $DIR/forgejo-runner --version + echo failed to parse version + false + fi + echo $runner_version +} + function test_actions() { local versions="${1:-1.20 1.21 $RELEASE_NUMBERS_AND_DEV}" @@ -84,6 +94,13 @@ function test_actions() { log_info "Testing actions for $version" actions_setup $version + local runner_version=$(actions_runner_version) + + if dpkg --compare-versions $version gt 7.0 && dpkg --compare-versions $runner_version gt 3.3.0 ; then + for example in artifacts-v4 ; 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 diff --git a/actions/example-artifacts-v4/.forgejo/workflows/test.yml b/actions/example-artifacts-v4/.forgejo/workflows/test.yml new file mode 100644 index 0000000..d215354 --- /dev/null +++ b/actions/example-artifacts-v4/.forgejo/workflows/test.yml @@ -0,0 +1,47 @@ +on: [push] +jobs: + upload-many: + runs-on: docker + steps: + - run: mkdir -p artifacts + + - run: touch artifacts/ONE artifacts/TWO + + - uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: many-artifacts + path: artifacts/ + + download-many: + needs: [upload-many] + runs-on: docker + steps: + - uses: https://code.forgejo.org/forgejo/download-artifact@v4 + + - run: | + test -f many-artifacts/ONE + test -f many-artifacts/TWO + + upload-one: + runs-on: docker + steps: + - run: mkdir -p path/to/artifact + + - run: echo hello > path/to/artifact/world.txt + + - uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + with: + name: my-artifact + path: path/to/artifact/world.txt + + download-one: + needs: [upload-one] + runs-on: docker + steps: + - run: "! test -f world.txt" + + - uses: https://code.forgejo.org/forgejo/download-artifact@v4 + with: + name: my-artifact + + - run: "test -f world.txt" -- 2.43.4