Skip to content

ensure errors are written to stderr #41

ensure errors are written to stderr

ensure errors are written to stderr #41

name: dorothy-workflow
'on':
- push
- pull_request
jobs:
test:
runs-on: ubuntu-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
VERBOSE: yes
CI_COMMIT_MESSAGE: 'ci: adjustments'
CI_COMMIT_NAME: 'Continuous Integration'
CI_COMMIT_EMAIL: '[email protected]'
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
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: '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
- name: 'Dorothy Test'
shell: 'script -q -e -c "bash {0}"'
run: |
# source dorothy
DOROTHY_LOAD=yes
DOROTHY_LOADED=no
source "$DOROTHY/init.sh"
# run dorothy tests
dorothy test
distros:
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
- '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
container:
image: ${{ matrix.container }}
env:
VERBOSE: 'yes'
steps:
- name: 'Dorothy Dependencies'
run: |
if command -v apt-get; then
# for ubuntu
apt-get update
apt-get install -y bash curl util-linux
elif command -v apk; then
# for alpine
apk add bash curl util-linux
elif command -v zypper; then
# for opensuse
zypper install -y --no-recommends bash curl util-linux
elif command -v pamac; then
# for manjaro
pamac install --no-confirm bash curl util-linux
elif command -v pacman; then
# for arch besides manjaro
pacman --sync --refresh --needed --noconfirm bash curl util-linux # -Sy
elif command -v yum; then
# for fedora
yum install -y bash curl util-linux
fi
- name: 'Dorothy Remote Tests'
shell: 'script -q -e -c "bash {0}"'
run: |
bash -ic "$(curl -fsSL https://dorothy.bevry.me/commands/dorothy)" -- test