Skip to content

*: fix more tests for exact #2661

*: fix more tests for exact

*: fix more tests for exact #2661

# NOTE:
# Don't use `shell: bash` unless needed, as for macos-fresh that caused an infinite queue for the test step, and for linux bash may not exist yet
#
# NOTE:
# `uses: bevry/dorothy/.github/actions/dorothy-dependencies@master` is used instead of `uses: ./.github/actions/dorothy-deps` as the latter becomes the former, even if on a different branch, as such the eplicit variation is used to make it obvious one must manually specify the branch; using a dynamic variable for the branch does not work and results in a failure; awful design by github, but that is how it is
#
# NOTE:
# You can find details on the avalilable runners here:
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
#
# NOTE:
# Do not use `ubuntu-slim` as its ENV vars are different.
#
# NOTE:
# if you are getting errors like this:
# ! [remote rejected] dev/ci-arm -> dev/ci-arm (refusing to allow an OAuth App to create or update workflow `.github/workflows/dorothy-workflow.yml` without `workflow` scope)
# It is because the HTTPS authentication token doesn't have the `workflow` scope which is writable
# Instead, push via SSH instead, so setup your SSH keys, `setup-git`, `git-helper url --apply --protocol=ssh`, then push, and it will work
#
# SUPPORTED CONTAINERS::
# Sorted by docker pulls then by docker stars
# https://hub.docker.com/search?badges=official
# - "ubuntu:latest" # https://hub.docker.com/_/ubuntu 1B+ pulls 10K+ stars
# - "debian:latest" # https://hub.docker.com/_/debian 1B+ pulls 5.3K stars
# - "fedora:latest" # https://hub.docker.com/_/fedora 100M+ pulls 1.3K stars
# - "archlinux:latest" # https://hub.docker.com/_/archlinux 10M+ pulls 644 stars
# - "almalinux:latest" # https://hub.docker.com/_/almalinux 10M+ pulls 201 stars
# - "opensuse/leap:latest" # https://hub.docker.com/r/opensuse/leap 10M+ pulls 105 stars <-- has outdated bash, so is good to test
# - "opensuse/tumbleweed:latest" # https://hub.docker.com/r/opensuse/tumbleweed 10M+ pulls 85 stars
# - "kalilinux/kali-rolling:latest" # https://hub.docker.com/r/kalilinux/kali-rolling 5M+ pulls 985 stars
# - "openeuler/openeuler:latest" # https://hub.docker.com/r/openeuler/openeuler 500K+ pulls 45 stars
# - "ghcr.io/vanilla-os/pico:main" # https://github.com/vanilla-os/pico-image/pkgs/container/pico 13.6K pulls 8 stars <-- there is also `ghcr.io/vanilla-os/core:latest` from https://github.com/Vanilla-OS/core-image/pkgs/container/core/544319268?tag=latest however it is too heavy for github actions, `failed to register layer: max depth exceeded`
# - "devuan/devuan:latest" # https://hub.docker.com/r/devuan/devuan 10K+ pulls 2 stars
# - "cachyos/cachyos:latest" # https://hub.docker.com/r/cachyos/cachyos 8.4K pulls 3 stars
# - "openmandriva/minimal:rock" # https://hub.docker.com/r/openmandriva/minimal 644 pulls 0 stars
# - "openmandriva/minimal:rolling" # https://hub.docker.com/r/openmandriva/minimal 644 pulls 0 stars
# - "ghcr.io/elementary/docker:stable" # https://github.com/elementary/docker/pkgs/container/docker 19 pulls 28 stars, https://github.com/elementary/docker (outdated) 100K+ pulls 11 stars, https://github.com/elementary/docker/issues/42
#
# UNSUPPORTED CONTAINERS:
# - "adelielinux/adelie:latest" # https://hub.docker.com/r/adelielinux/adelie <-- alpine alternative, permission denied, doesn't have gawk
# - "alpine:latest" # https://hub.docker.com/_/alpine <-- official deno is broken on alpine https://github.com/denoland/deno_install/issues/311 https://github.com/denoland/deno/issues/3711 but `setup-util-deno` supports a third party deno that gets updated every few months however its broken for some reason https://github.com/bevry/dorothy/actions/runs/18792197623/job/53624940079#step:4:71
# - "gentoo/stage3" # https://hub.docker.com/r/gentoo/stage3 <-- couldn't get to work due to home misconfigure error
# - "mageia:cauldron" # https://hub.docker.com/_/mageia <-- cauldron is where moreutils is, disabled as couldn't get working
# - "manjarolinux/base" # https://hub.docker.com/r/manjarolinux/base 100K+ pulls 39 stars <-- was broken due to https://gitlab.manjaro.org/packages/core/bash/-/issues/8 see https://github.com/bevry/dorothy/actions/runs/7999660175/job/21847844816#step:3:84 however tested locally and seems fine, however CI is still failing for weeks: https://github.com/bevry/dorothy/actions/runs/20658510382/job/59315968595
# - "nixos/nix" # https://hub.docker.com/r/nixos/nix <-- doesn't make bash available to env, also locale failure
# - "rockylinux:latest" # https://hub.docker.com/_/rockylinux <-- despite being listed, github fails to pull it
# - "voidlinux/voidlinux" # https://hub.docker.com/r/voidlinux/voidlinux <-- permission failure, locale failure, remote failure: https://github.com/bevry/dorothy/actions/runs/6622814794/job/17988863384
name: "Dorothy's Workflow"
on:
- push
- pull_request
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
if: github.event_name == 'push' || ( github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) == 'false' && toJson(github.event.pull_request.state) == '"open"' && toJson(github.event.pull_request.assignees) != '[]' )
runs-on: ubuntu-slim
outputs:
SLUG: ${{ github.event.pull_request.head.repo.full_name || github.repository}}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: "Setup Environment"
shell: bash -leo pipefail {0}
run: |
# output github context
cat <<-EGITHUB
run?
${{ toJson( github.event_name == 'push' || ( github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) == 'false' && toJson(github.event.pull_request.state) == '"open"' && toJson(github.event.pull_request.assignees) != '[]' ) ) }}
github.event_name:
${{ toJson(github.event_name) }}
github.event.pull_request.draft:
${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) }}
github.event.pull_request.state:
${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.state) }}
github.event.pull_request.assignees:
${{ github.event_name == 'pull_request' && toJson( toJson(github.event.pull_request.assignees) != '[]' ) }}
github.repository:
${{ toJson(github.repository) }}
github.event.pull_request.head.repo.full_name:
${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.head.repo.full_name) }}
github.event.pull_request.head.sha:
${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.head.sha) }}
github.sha:
${{ toJson(github.sha) }}
github.ref
${{ toJson(github.ref) }}
github.job
${{ toJson(github.job) }}
job.check_run_id
${{ job.check_run_id }}
resolved slug:
${{ toJson(github.event.pull_request.head.repo.full_name || github.repository) }}
resolved sha:
${{ toJson(github.event.pull_request.head.sha || github.sha) }}
github:
${{ false && toJson(github) }}
env:
$(env | sort)
EGITHUB
login-shells:
needs: setup
# if: false
runs-on: ubuntu-latest
steps:
- name: "Dorothy Install"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: install
ARGUMENTS: -- --shells=bash,zsh,fish,nu,xonsh,elvish,dash,ksh --utils=carapace
- name: "Dorothy Login Shell: bash"
shell: bash -leo pipefail {0}
run: |
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: zsh"
shell: zsh -le --pipefail {0}
run: |
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: fish"
shell: fish -l {0}
run: |
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: nu"
shell: nu -l {0}
run: |
# when given a file, nushell no longer loads login files, so load Dorothy ourself: https://discord.com/channels/601130461678272522/1147584426121896067 https://github.com/nushell/nushell/issues/9833 https://github.com/nushell/nushell/pull/10253#issuecomment-1709955004
source '/home/runner/.config/nushell/login.nu'
# continue as normal
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: xonsh"
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -DXONSH_TRACEBACK_LOGFILE=xonsh.log -l {0}
run: |
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: elvish"
shell: elvish {0}
run: |
# when given a file, elvish no longer loads its rc file (which is intended for a TTY), so load Dorothy ourself: https://github.com/elves/elvish/issues/1726
eval (cat -- '/home/runner/.local/share/dorothy/init.elv' | slurp)
# continue as normal
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: dash"
shell: dash -le {0}
run: |
# when given a file, $0 becaomes that file, yet $0 is the only way to detect login shell, so load Dorothy ourself
DOROTHY_FORCE_LOAD=yes
. '/home/runner/.local/share/dorothy/init.sh'
# continue as normal
command-exists -- dorothy
echo-style --success='ok'
- name: "Dorothy Login Shell: ksh"
shell: ksh -leo pipefail {0}
run: |
# when given a file, $0 becaomes that file, yet $0 is the only way to detect login shell, so load Dorothy ourself
DOROTHY_FORCE_LOAD=yes
. '/home/runner/.local/share/dorothy/init.sh'
# continue as normal
command-exists -- dorothy
echo-style --success='ok'
check:
needs: setup
# if: false
runs-on: ubuntu-latest
steps:
- name: "Dorothy Check"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: check
format:
needs: setup
# if: false
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: "Dorothy Format"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: format
- name: "Commit Changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # writable
run: |
cd '/home/runner/.local/share/dorothy' || exit $?
if git diff --quiet &>/dev/null; then
printf '%s\n' 'Already formatted.' || exit $?
else
git config --global user.name 'Continuous Integration' || exit $?
git config --global user.email 'bot@bevry.me' || exit $?
git remote set-url origin 'https://x-access-token:${{ secrets.READONLY_GITHUB_TOKEN }}@github.com/${{ github.repository }}' || exit $?
git commit -a -m 'ci: adjustments' || exit $?
git push origin HEAD:${{ github.ref }} || exit $?
fi
macos-test:
needs: setup
# if: false
strategy:
fail-fast: false
matrix:
runner:
- macos-26
- macos-15
- macos-14
bash:
- bash
- /bin/bash # this Bash 3.2 version actually behaves differently to GNU Bash 3.2 version
mode:
- homebrew
- fresh
runs-on: ${{ matrix.runner }}
steps:
- name: "Uninstall Homebrew"
if: matrix.mode == 'fresh'
run: bash -c "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
- name: "Dorothy Upgrade Bash Version"
if: matrix.bash == 'bash'
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: run
ARGUMENTS: -- setup-util-bash
- name: "Dorothy Test Bash Version: ${{ matrix.bash }}"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: test
ARGUMENTS: -- --bash=${{ matrix.bash }}
windows-wsl-test:
needs: setup
# if: false
runs-on: windows-2025
steps:
- name: "WSL Install"
shell: powershell
env:
WSL_DISTRO: Debian # __evict on msys is 2255 secnds, on WSL Debian is 365 seconds, on WSL kali-linux is 367 seconds
run: |
$ErrorActionPreference = "Stop"
wsl.exe --set-default-version 2
wsl.exe --install --no-launch --web-download $Env:WSL_DISTRO
wsl.exe --set-default $Env:WSL_DISTRO
wsl.exe --list --verbose
wsl.exe -- sudo apt-get update
wsl.exe -- sudo apt-get -y install git curl
- name: "Dorothy Test"
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
WSL_SCRIPT: |
#!/usr/bin/env bash
bash -c "$(curl -fsSL "https://dorothy.bevry.me/test?slug=${{ needs.setup.outputs.SLUG }}&commit=${{ needs.setup.outputs.COMMIT }}")"
shell: powershell
run: |
# `GITHUB_STEP_SUMMARY` is on a different partition, that WSL cannot access, so proxy it
$summaryHost = $Env:GITHUB_STEP_SUMMARY
$summaryFile = "summary.txt"
$summaryWSL = wsl.exe -- wslpath -au $summaryFile
# Write the script
$scriptPath = './script'
Set-Content -Path $scriptPath -NoNewline -Value $Env:WSL_SCRIPT
# Execute the script, with appropriate ENV varrs, and with some `setsid` magic so that WSL isn't interactive and TTY attached
wsl.exe -- env GITHUB_TOKEN=$Env:GITHUB_TOKEN CI=true GITHUB_ACTIONS=$Env:GITHUB_ACTIONS GITHUB_STEP_SUMMARY=$summaryWSL bash -eo pipefail -c "(setsid $scriptPath) </dev/null |& cat"
$scriptExitStatus = $LastExitCode
# If the `wsl.exe` summary (`$summaryFile`) exists, then append to `GITHUB_STEP_SUMMARY` (`$summaryHost`)
if (Test-Path -Path $summaryFile) { Add-Content -Path $summaryHost -Value (Get-Content -Path $summaryFile) }
# Report and exit with the script's exit status
$Host.SetShouldExit($scriptExitStatus) # This works around https://github.com/actions/runner/issues/351 and has GitHub Actions report the correct exit status
Exit($scriptExitStatus)
bash-versions-test:
needs: setup
# if: false
strategy:
fail-fast: false
matrix:
bash:
- "3.2.57"
- "4.0"
# - '4.1' <-- see notes in `bash.bash`
# - '4.2.53' <-- see notes in `bash.bash`
# - '4.3.30' <-- see notes in `bash.bash`
- "4.4.18"
- "5.0"
- "5.1.16"
- "5.2.37"
- "5.3"
# This should match all versions known in `bash.bash` and include in `continue-on-error` the unsupported versions
runs-on: ubuntu-latest
# continue-on-error: ${{ matrix.bash == '4.1' || matrix.bash == '4.2.53' || matrix.bash == '4.3.30' }}
steps:
- name: "Dorothy Test Bash Version: ${{ matrix.bash }}"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: test
ARGUMENTS: -- --bash=${{ matrix.bash }}
containers-x86-test:
needs: setup
# if: false
strategy:
fail-fast: false
matrix:
container:
- "almalinux:latest"
- "archlinux:latest"
- "cachyos/cachyos:latest"
- "debian:latest"
- "devuan/devuan:latest"
- "fedora:latest"
- "ghcr.io/elementary/docker:stable"
- "ghcr.io/vanilla-os/pico:main"
- "kalilinux/kali-rolling:latest"
- "openeuler/openeuler:latest"
- "openmandriva/minimal:rock"
- "openmandriva/minimal:rolling"
- "opensuse/leap:latest"
- "opensuse/tumbleweed:latest"
- "ubuntu:latest"
runs-on: ubuntu-24.04
container:
image: ${{ matrix.container }}
steps:
- name: "Dorothy Dependencies"
uses: bevry/dorothy/.github/actions/dorothy-dependencies@master
- name: "Dorothy Test"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: test
containers-arm-test:
needs: setup
# if: false
strategy:
fail-fast: false
matrix:
container:
- "almalinux:latest"
# - "archlinux:latest"
# - "cachyos/cachyos:latest"
- "debian:latest"
# - "devuan/devuan:latest"
- "dtcooper/raspberrypi-os:latest" # arm only, https://github.com/dtcooper/raspberrypi-os-docker
- "fedora:latest"
# - "ghcr.io/elementary/docker:stable" # despite arm support, container crashes: https://github.com/bevry/dorothy/actions/runs/20582118907/job/59113985110
# - "ghcr.io/vanilla-os/pico:main"
- "kalilinux/kali-rolling:latest"
- "openeuler/openeuler:latest"
# - "openmandriva/minimal:rock" # this works, however openmandriva does not officially support arm
# - "openmandriva/minimal:rolling" # this works, however openmandriva does not officially support arm
- "opensuse/leap:latest"
- "opensuse/tumbleweed:latest"
- "ubuntu:latest"
runs-on: ubuntu-24.04-arm
container:
image: ${{ matrix.container }}
steps:
- name: "Dorothy Dependencies"
uses: bevry/dorothy/.github/actions/dorothy-dependencies@master
- name: "Dorothy Test"
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
with:
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
SLUG: ${{ needs.setup.outputs.SLUG }}
COMMIT: ${{ needs.setup.outputs.COMMIT }}
ACTION: test