-
-
Notifications
You must be signed in to change notification settings - Fork 23
executable file
Β·174 lines (174 loc) Β· 7.35 KB
/
dorothy-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# 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
name: dorothy-workflow
'on':
- push
- pull_request
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
login-shells-and-linting:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: 'ci: adjustments'
CI_COMMIT_NAME: 'Continuous Integration'
CI_COMMIT_EMAIL: 'bot@bevry.me'
steps:
- name: 'Dorothy Install'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# ensure dorothy is cloned, and run command
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?branch=${{ github.ref_name }}&commit=${{ github.sha }}')"
- name: 'Dorothy Configure'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
shell: bash -leo pipefail {0}
run: |
# prep linting
dorothy dev
# prep login shells
setup-util-bash
setup-util-zsh
setup-util-fish
setup-util-nu
dorothy install
# nu -c 'echo $nu.loginshell-path'
- 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 -l {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: |
# source ... is a workaround for: https://discord.com/channels/601130461678272522/1147584426121896067
# source '/Users/runner/Library/Application Support/nushell/login.nu' # macos
source '/home/runner/.config/nushell/login.nu' # linux
# continue as normal
command-exists dorothy
echo-style --success='ok'
- name: 'Trunk Format'
if: github.event_name == 'push'
shell: bash -leo pipefail {0}
run: |
dorothy format
# commit 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 -leo pipefail {0}
run: dorothy check
homebrew-macos-test:
runs-on: macos-latest
steps:
- name: 'Dorothy Test'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# ensure dorothy is cloned, and run command
bash -c "$(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'
run: |
# run homebrew uninstaller
bash -c "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
- name: 'Dorothy Test'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# ensure dorothy is cloned, and run command
bash -c "$(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'
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'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
run: |
# ensure dorothy is cloned, and run command
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?branch=${{ github.ref_name }}&commit=${{ github.sha }}')" -- dorothy test