actions: shell: assert shell behavior (#788)

Refs https://code.forgejo.org/forgejo/runner/issues/150

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/788
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 08:08:25 +00:00 committed by earl-warren
parent b67f9e1a70
commit b2d99f4c4a
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201
5 changed files with 113 additions and 1 deletions

View file

@ -0,0 +1,78 @@
on: [push]
env:
ASSERT_SHELL: 'set -x ; readlink /proc/$$/exe ; readlink /proc/$$/exe | grep '
jobs:
default:
# docker:docker://code.forgejo.org/oci/node:22-bookworm
runs-on: docker
steps:
- name: default is bash
run: |
${{ env.ASSERT_SHELL }} /bash
defaults-run:
needs: [default]
# alpine:docker://code.forgejo.org/oci/alpine:latest
runs-on: alpine
defaults:
run:
shell: sh
steps:
- name: default is sh which is an alias for busybox in alpine
run: |
${{ 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:
needs: [alpine]
runs-on: docker
container:
image: code.forgejo.org/oci/python:slim
steps:
- name: python => python {0}
shell: python
run: |
print("something")
other:
needs: [python]
runs-on: docker
container:
image: code.forgejo.org/oci/node:22-bookworm
steps:
- name: default is sh which is an alias for dash in bookworm
run: |
${{ env.ASSERT_SHELL }} /dash
- name: bash => bash --noprofile --norc -e -o pipefail {0}
shell: bash
run: |
${{ env.ASSERT_SHELL }} /bash
shopt -o
shopt -o | grep --quiet 'pipefail.*on'
- name: sh => sh -e {0}
shell: sh
run: |
${{ env.ASSERT_SHELL }} /dash
- name: node => node {0}
shell: node
run: |
console.log("something")
- name: dash -e {0}
shell: dash -e {0}
run: |
${{ env.ASSERT_SHELL }} /dash