Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit 2f2a54f

Browse files
authored
Test to run shellcheck on generated bash config (#20)
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
1 parent 0e95b1e commit 2f2a54f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,19 @@ jobs:
4141
sudo apt-get install -y shellcheck
4242
- name: "Run shellcheck on all shell scripts"
4343
run: shellcheck *.sh
44+
45+
shellcheck-on-generated-bash:
46+
name: "Run shellcheck on the generated shell config for bash"
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: "Install shellcheck"
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y shellcheck
54+
- name: "Initialize shell config with shebang so shellcheck knows it's bash"
55+
run: echo '#!/usr/bin/env bash' > ~/.profile
56+
- name: "Generated a shell config by installing the binary distro"
57+
run: ./install.sh 3.19.1 --install-root ~/.local --update-shell-config --shell bash --shell-config ~/.profile
58+
- name: "Run shellcheck on the generated shell config"
59+
run: shellcheck --exclude=SC1091 ~/.profile

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ main () {
438438
echo
439439
fi
440440

441-
dune_env_call="__dune_env $(unsubst_home "$install_root")"
441+
dune_env_call="__dune_env \"$(unsubst_home "$install_root")\""
442442
shell_config_code() {
443443
echo
444444
echo "# BEGIN configuration from Dune installer"
@@ -447,7 +447,7 @@ main () {
447447
echo "# - makes sure the dune executable is available in your \$PATH"
448448
echo "# - registers shell completions for dune if completions are available for your shell"
449449
echo "# - removes opam's pre-command hook because it would override Dune's shell configuration"
450-
echo "source $(unsubst_home "$env_file")"
450+
echo "source \"$(unsubst_home "$env_file")\""
451451
echo "$dune_env_call"
452452
echo "$remove_opam_precmd_hook # remove opam's pre-command hook"
453453
echo "# END configuration from Dune installer"

0 commit comments

Comments
 (0)