Skip to content

expand-path: check if echo-wait will fix no output failure #206

expand-path: check if echo-wait will fix no output failure

expand-path: check if echo-wait will fix no output failure #206

name: dorothy-workflow
'on':
- push
- pull_request
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
homebrew-macos-test-and-lint:
runs-on: macos-latest
env: # HOME is [/home/runner] however checkout must be inside workspace, which is [/home/runner/work/dorothy/dorothy], so override and set defaults
HOME: ${{ github.workspace }}
XDG_CONFIG_HOME: ${{ github.workspace }}.config
XDG_CACHE_HOME: ${{ github.workspace }}.cache
XDG_BIN_HOME: ${{ github.workspace }}.local/bin
XDG_DATA_HOME: ${{ github.workspace }}.local/share
XDG_STATE_HOME: ${{ github.workspace }}.local/state
DOROTHY: ${{ github.workspace }}/.local/share/dorothy
CI_COMMIT_MESSAGE: 'ci: adjustments'
CI_COMMIT_NAME: 'Continuous Integration'
CI_COMMIT_EMAIL: 'bot@bevry.me'
steps:
- name: 'Cache XDG'
id: cache-xdg
uses: actions/cache@v3
with:
path: ~/.local
key: ${{ runner.os }}
- name: 'Checkout'
uses: actions/checkout@v2
with:
path: ${{ env.DOROTHY }}
- name: 'Dorothy Development'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# ensure clone set correct permissions
chmod +x "$DOROTHY/commands/"*
# source dorothy
DOROTHY_LOAD=yes
DOROTHY_LOADED=no
source "$DOROTHY/init.sh"
# let dorothy set itself up for development
dorothy dev
- name: 'Dorothy Test'
shell: bash
run: |
# source dorothy
DOROTHY_LOAD=yes
DOROTHY_LOADED=no
source "$DOROTHY/init.sh"
# run dorothy tests
dorothy test
- name: 'Trunk Format'
if: github.event_name == 'push'
shell: bash
run: |
# source dorothy
DOROTHY_LOAD=yes
DOROTHY_LOADED=no
source "$DOROTHY/init.sh"
# run formatting tests
dorothy format || :
# detect and push formatting changes if any
cd "$DOROTHY"
if git diff --quiet &>/dev/null; then
echo 'Already formatted.'
else
git config --global user.name "${{ env.CI_COMMIT_NAME }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
fi
- name: 'Trunk Check'
shell: bash
run: |
# source dorothy
DOROTHY_LOAD=yes
DOROTHY_LOADED=no
source "$DOROTHY/init.sh"
# run linting tests
dorothy check
homebrew-macos-test:
runs-on: macos-latest
steps:
- name: 'Dorothy Test'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# clone dorothy and run tests
bash -ic "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test
fresh-macos-test:
runs-on: macos-latest
steps:
- name: 'Uninstall Homebrew'
shell: bash
run: |
# run homebrew uninstaller
bash -ic "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
- name: 'Dorothy Test'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# clone dorothy and run tests
bash -ic "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test
distro-test:
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
container:
- 'ubuntu:latest' # https://hub.docker.com/_/ubuntu
- 'fedora:latest' # https://hub.docker.com/_/fedora
- 'debian:latest' # https://hub.docker.com/_/debian
- 'alpine:latest' # https://hub.docker.com/_/alpine <-- script -qec workaround for TTY does not work on alpine
- 'manjarolinux/base' # https://hub.docker.com/r/manjarolinux/base
- 'opensuse/leap' # https://hub.docker.com/r/opensuse/leap <-- has outdated bash, so is good to test
- 'opensuse/tumbleweed' # https://hub.docker.com/r/opensuse/tumbleweed
- 'kalilinux/kali-rolling' # https://hub.docker.com/r/kalilinux/kali-rolling <-- apt based
- 'voidlinux/voidlinux' # https://hub.docker.com/r/voidlinux/voidlinux <-- locale failure
# - 'mageia:cauldron' # https://hub.docker.com/_/mageia <-- cauldron is were moreutils is, disabled as couldn't get working
# - 'nixos/nix' # https://hub.docker.com/r/nixos/nix <-- doesn't make bash available to env, also locale failure
# - 'gentoo/stage3' # https://hub.docker.com/r/gentoo/stage3 <-- couldn't get to work due to home misconfigure error
container:
image: ${{ matrix.container }}
steps:
- name: 'Dorothy Dependencies'
# don't use [shell: bash] here yet for linux distros, as may not exist yet
run: |
# this should somewhat coincide with [commands/dorothy:ensure_prereq_dependencies]
if command -v apt-get; then
# for ubuntu/debian/kali
apt-get update
apt-get install -y bash curl git
elif command -v zypper; then
# for opensuse
zypper --non-interactive --gpg-auto-import-keys refresh
zypper --non-interactive install bash curl
elif command -v apk; then
# for alpine
apk update
apk add bash curl git grep
elif command -v pamac; then
# for manjaro, prefer over arch as majaro also contains pacman
pamac install --no-confirm bash curl
elif command -v pacman; then
# for arch
pacman-key --init
pacman --refresh --sync --needed --noconfirm bash curl
elif command -v urpmi; then
# for mageia, prefer over fedora as mageia also contains dnf
# https://wiki.mageia.org/en/Cauldron
# --allowerasing needed due to: https://github.com/bevry/dorothy/actions/runs/6033044029/job/16369147940
# urpmi --auto-update --auto
# dnf check-update --assumeyes
# dnf upgrade --assumeyes --refresh --best --allowerasing
# ^ disabled as always fails
urpmi.update -a
# ^ this fails too: https://github.com/bevry/dorothy/actions/runs/6033557632/job/16370418074
urpmi --auto bash curl
elif command -v dnf; then
# for fedora
dnf --assumeyes --refresh --best --allowerasing install bash curl
elif command -v xbps-install; then
# for void linux
xbps-install --sync --update --yes xbps
xbps-install --sync --yes bash curl
elif command -v nix-env; then
# for nix
nix-env --install --attr nixpkgs.bash nixpkgs.curl
elif command -v emerge; then
# for gentoo
emerge app-shells/bash net-misc/curl
fi
- name: 'Dorothy Remote Tests'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# clone dorothy and run tests
bash -ic "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test