actions: shell: assert sh fallback (#790)

Refs forgejo/runner#150

Local testing [following instructions](https://code.forgejo.org/forgejo/end-to-end/src/branch/main/README.md#running-from-locally-built-binary) and [the matching ACT PR](https://code.forgejo.org/forgejo/act/pulls/177).

Once merged this will be a noop and actually remove coverage for shell test that was added earlier today. It will reactivate once the runner v8.0.0 is published.

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/790
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-12 09:59:00 +00:00 committed by earl-warren
parent b2d99f4c4a
commit 0b826217a9
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
2 changed files with 27 additions and 14 deletions

View file

@ -143,7 +143,7 @@ function test_actions() {
done done
fi fi
for example in shell echo lxc config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do for example in echo lxc config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do
run actions_verify_example $example run actions_verify_example $example
done done
@ -151,6 +151,10 @@ function test_actions() {
run actions_verify_example cache-proxy run actions_verify_example cache-proxy
fi fi
if dpkg --compare-versions $runner_version ge 8.0.0; then
run actions_verify_example shell
fi
if dpkg --compare-versions $version lt 7.1; then if dpkg --compare-versions $version lt 7.1; then
for example in cron; do for example in cron; do
run actions_verify_example $example run actions_verify_example $example

View file

@ -12,10 +12,29 @@ jobs:
run: | run: |
${{ env.ASSERT_SHELL }} /bash ${{ env.ASSERT_SHELL }} /bash
defaults-run: sh-fallback:
needs: [default] needs: [default]
# alpine:docker://code.forgejo.org/oci/alpine:latest # alpine:docker://code.forgejo.org/oci/alpine:latest
runs-on: alpine runs-on: alpine
steps:
- name: default is bash but with a fallback to sh in case it does not exist
run: |
${{ env.ASSERT_SHELL }} /busybox
sh-fallback-with-container:
needs: [sh-fallback]
runs-on: docker
container:
image: code.forgejo.org/oci/alpine:latest
steps:
- name: default is bash but with a fallback to sh in case it does not exist
run: |
${{ env.ASSERT_SHELL }} /busybox
defaults-run:
needs: [sh-fallback-with-container]
# alpine:docker://code.forgejo.org/oci/alpine:latest
runs-on: alpine
defaults: defaults:
run: run:
shell: sh shell: sh
@ -24,16 +43,6 @@ jobs:
run: | run: |
${{ env.ASSERT_SHELL }} /busybox ${{ env.ASSERT_SHELL }} /busybox
alpine:
needs: [defaults-run]
runs-on: docker
container:
image: code.forgejo.org/oci/alpine:latest
steps:
- name: default is sh which is an alias for busybox in alpine
run: |
${{ env.ASSERT_SHELL }} /busybox
python: python:
needs: [alpine] needs: [alpine]
runs-on: docker runs-on: docker
@ -51,9 +60,9 @@ jobs:
container: container:
image: code.forgejo.org/oci/node:22-bookworm image: code.forgejo.org/oci/node:22-bookworm
steps: steps:
- name: default is sh which is an alias for dash in bookworm - name: default is bash
run: | run: |
${{ env.ASSERT_SHELL }} /dash ${{ env.ASSERT_SHELL }} /bash
- name: bash => bash --noprofile --norc -e -o pipefail {0} - name: bash => bash --noprofile --norc -e -o pipefail {0}
shell: bash shell: bash