Skip to content

Commit 07d5d80

Browse files
committed
ci: debug xonsh
ci: fix the underlying failure with xonsh var failures it cannot delete unset variables, so check them first: - https://github.com/bevry/dorothy/actions/runs/13228345318/job/36922092005#step:9:82
1 parent d3cacc2 commit 07d5d80

File tree

2 files changed

+31
-137
lines changed

2 files changed

+31
-137
lines changed

.github/workflows/dorothy-workflow.yml

+8-122
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ jobs:
109109
command-exists -- dorothy
110110
echo-style --success='ok'
111111
- name: 'Dorothy Login Shell: xonsh'
112-
env:
113-
PKG_CONFIG_PATH: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349881708/job/17248752072#step:8:8
114-
LDFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349927188/job/17248892389#step:8:9
115-
CPPFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349956372/job/17248986621#step:8:10
116-
CXX: '' # fix: https://github.com/bevry/dorothy/actions/runs/7538723888/job/20519802798#step:8:12
117-
CC: '' #fix: https://github.com/bevry/dorothy/actions/runs/7538922544/job/20520381661#step:8:13
118-
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -l {0}
112+
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -DXONSH_TRACEBACK_LOGFILE=xonsh.log -l {0}
119113
run: |
120114
command-exists -- dorothy
121115
echo-style --success='ok'
116+
- name: 'Debug Login Shell: xonsh'
117+
shell: bash -leo pipefail {0}
118+
run: |
119+
echo-file -- '/home/runner/.config/xonsh/rc.xsh'
120+
echo-file -- xonsh.log
121+
setup-environment-commands xonsh --refresh
122122
- name: 'Dorothy Login Shell: elvish'
123123
shell: elvish {0}
124124
run: |
@@ -156,118 +156,4 @@ jobs:
156156
fi
157157
- name: 'Trunk Check'
158158
shell: bash -leo pipefail {0}
159-
run: dorothy check
160-
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
161-
runner-test:
162-
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) != '[]' )
163-
strategy:
164-
fail-fast: false
165-
matrix:
166-
runner:
167-
- ubuntu-24.04
168-
- ubuntu-22.04
169-
- ubuntu-24.04-arm
170-
- ubuntu-22.04-arm
171-
- macos-15
172-
- macos-14
173-
- macos-13
174-
runs-on: ${{ matrix.runner }}
175-
steps:
176-
- name: 'Dorothy Test'
177-
env:
178-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
179-
run: |
180-
# ensure dorothy is cloned, and run command
181-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test
182-
fresh-macos-test:
183-
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) != '[]' )
184-
strategy:
185-
fail-fast: false
186-
matrix:
187-
runner:
188-
- macos-15
189-
- macos-14
190-
- macos-13
191-
runs-on: ${{ matrix.runner }}
192-
steps:
193-
- name: 'Uninstall Homebrew'
194-
run: |
195-
# run homebrew uninstaller
196-
bash -c "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
197-
- name: 'Dorothy Test'
198-
env:
199-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
200-
run: |
201-
# ensure dorothy is cloned, and run command
202-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test
203-
container-test:
204-
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) != '[]' )
205-
runs-on: ubuntu-latest
206-
strategy:
207-
fail-fast: false
208-
matrix:
209-
container:
210-
- 'ubuntu:latest' # https://hub.docker.com/_/ubuntu
211-
- 'fedora:latest' # https://hub.docker.com/_/fedora
212-
- 'debian:latest' # https://hub.docker.com/_/debian
213-
- 'alpine:latest' # https://hub.docker.com/_/alpine <-- script -qec workaround for TTY does not work on alpine
214-
- 'opensuse/leap' # https://hub.docker.com/r/opensuse/leap <-- has outdated bash, so is good to test
215-
- 'opensuse/tumbleweed' # https://hub.docker.com/r/opensuse/tumbleweed
216-
- 'kalilinux/kali-rolling' # https://hub.docker.com/r/kalilinux/kali-rolling <-- apt based
217-
# - 'manjarolinux/base' # https://hub.docker.com/r/manjarolinux/base <-- broken due to https://gitlab.manjaro.org/packages/core/bash/-/issues/8 trying to remove it, trying to sync/refresh it, trying everything fails, as such disabled test, see all the failed CI attempts sinc: https://github.com/bevry/dorothy/actions/runs/7999660175/job/21847844816#step:3:84
218-
# - 'voidlinux/voidlinux' # https://hub.docker.com/r/voidlinux/voidlinux <-- locale failure, remote failure: https://github.com/bevry/dorothy/actions/runs/6622814794/job/17988863384
219-
# - 'mageia:cauldron' # https://hub.docker.com/_/mageia <-- cauldron is were moreutils is, disabled as couldn't get working
220-
# - 'nixos/nix' # https://hub.docker.com/r/nixos/nix <-- doesn't make bash available to env, also locale failure
221-
# - 'gentoo/stage3' # https://hub.docker.com/r/gentoo/stage3 <-- couldn't get to work due to home misconfigure error
222-
container:
223-
image: ${{ matrix.container }}
224-
steps:
225-
- name: 'Dorothy Dependencies'
226-
run: |
227-
# this should somewhat coincide with [commands/dorothy:ensure_prereq_dependencies]
228-
if command -v apt-get; then
229-
# for ubuntu/debian/kali
230-
apt-get update
231-
apt-get install -y bash curl
232-
elif command -v zypper; then
233-
# for opensuse
234-
zypper --non-interactive --gpg-auto-import-keys refresh
235-
zypper --non-interactive install bash curl
236-
elif command -v apk; then
237-
# for alpine
238-
apk update
239-
apk add bash curl
240-
elif command -v pacman; then
241-
# for manjaro (manjaro CI image doesn't have pamac installed) and arch
242-
pacman-key --init
243-
pacman --noconfirm --refresh --sync --needed bash curl
244-
elif command -v urpmi; then
245-
# for mageia, prefer over fedora as mageia also contains dnf
246-
# https://wiki.mageia.org/en/Cauldron
247-
# https://github.com/bevry/dorothy/actions/runs/6033044029/job/16369147940
248-
# https://github.com/bevry/dorothy/actions/runs/6033557632/job/16370418074
249-
# urpmi --auto-update --auto
250-
urpmi.update -a
251-
urpmi --auto bash curl
252-
elif command -v dnf; then
253-
# for fedora
254-
# dnf check-update --assumeyes
255-
# dnf upgrade --assumeyes --refresh --best --allowerasing
256-
dnf install --assumeyes --refresh --best --allowerasing bash curl
257-
elif command -v xbps-install; then
258-
# for void linux
259-
xbps-install --sync --update --yes xbps
260-
xbps-install --sync --yes bash curl
261-
elif command -v nix-env; then
262-
# for nix
263-
nix-env --install --attr nixpkgs.bash nixpkgs.curl
264-
elif command -v emerge; then
265-
# for gentoo
266-
emerge app-shells/bash net-misc/curl
267-
fi
268-
- name: 'Dorothy Remote Tests'
269-
env:
270-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting
271-
run: |
272-
# ensure dorothy is cloned, and run command
273-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test
159+
run: dorothy check

sources/env.bash

+23-15
Original file line numberDiff line numberDiff line change
@@ -112,46 +112,54 @@ function on_env_finish {
112112
if [[ -z $value ]]; then
113113
# echo var action: delete
114114
if [[ $shell == 'fish' ]]; then
115-
echo "set --universal --erase $name;"
115+
printf '%s\n' "set --universal --erase $name;"
116116
elif [[ $shell == 'nu' ]]; then
117-
echo "setenv $name"
117+
printf '%s\n' "setenv $name"
118118
elif [[ $shell == 'xonsh' ]]; then
119-
echo 'del $'"$name"
119+
printf '%s\n' "if \${...}.get('$name') != None:"$'\n\t'"del \$$name"
120120
elif [[ $shell == 'elvish' ]]; then
121121
# https://elv.sh/ref/builtin.html#unset-env
122-
echo "unset-env $name"
122+
printf '%s\n' "unset-env $name"
123123
else
124-
echo "unset -v $name;"
124+
printf '%s\n' "unset -v $name;"
125125
fi
126126
elif [[ $is_path == 'yes' ]]; then
127127
# echo var action: set path
128128
if [[ $shell == 'fish' ]]; then
129-
echo "set --export --path $name '$value';"
129+
printf '%s\n' "set --export --path $name '$value';"
130130
elif [[ $shell == 'nu' ]]; then
131-
echo "setenv $name $value"
131+
printf '%s\n' "setenv $name $value"
132132
elif [[ $shell == 'xonsh' ]]; then
133-
echo '$'"$name = '$value'.split(':')"
133+
printf '%s\n' '$'"$name = '$value'.split(':')"
134134
elif [[ $shell == 'elvish' ]]; then
135135
# https://elv.sh/ref/builtin.html#set-env
136-
echo "set-env $name '$value'"
136+
printf '%s\n' "set-env $name '$value'"
137137
else
138-
echo "export $name='$value';"
138+
printf '%s\n' "export $name='$value';"
139139
fi
140140
else
141141
# echo var action: set
142142
if [[ $shell == 'fish' ]]; then
143-
echo "set --export $name '$value';"
143+
printf '%s\n' "set --export $name '$value';"
144144
elif [[ $shell == 'nu' ]]; then
145-
echo "setenv $name $value"
145+
printf '%s\n' "setenv $name $value"
146146
elif [[ $shell == 'xonsh' ]]; then
147-
echo '$'"$name = '$value'"
147+
printf '%s\n' '$'"$name = '$value'"
148148
elif [[ $shell == 'elvish' ]]; then
149149
# https://elv.sh/ref/builtin.html#set-env
150-
echo "set-env $name '$value'"
150+
printf '%s\n' "set-env $name '$value'"
151151
else
152-
echo "export $name='$value';"
152+
printf '%s\n' "export $name='$value';"
153153
fi
154154
fi
155155
done < <(env)
156+
# xonsh needs a trailing newline, because xonsh, fixes:
157+
# > xonsh
158+
# xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
159+
# SyntaxError: None: no further code
160+
# syntax error in xonsh run control file '/Users/balupton/.config/xonsh/rc.xsh': None: no further code
161+
if [[ $shell == 'xonsh' ]]; then
162+
printf '\n'
163+
fi
156164
}
157165
trap on_env_finish EXIT

0 commit comments

Comments
 (0)