Skip to content

Commit

Permalink
Automatically find where shunit2 is installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Feb 4, 2025
1 parent 42526d4 commit 6f68867
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/shunit2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update -qq -y && sudo apt-get install -qq -y wget curl shunit2
- name: Configure env
run: echo "SHUNIT2=$(command -v shunit2 2>/dev/null)" >> $GITHUB_ENV
- name: Run tests
run: make test

Expand All @@ -23,8 +21,6 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: dnf update -q -y && dnf install -q -y make patch wget curl shunit2
- name: Configure env
run: echo "SHUNIT2=$(command -v shunit2 2>/dev/null)" >> $GITHUB_ENV
- name: Run tests
run: make test

Expand All @@ -36,8 +32,6 @@ jobs:
- name: Install dependencies
run: zypper ref && zypper --non-interactive in tar gzip findutils make patch wget shunit2
- uses: actions/checkout@v4
- name: Configure env
run: echo "SHUNIT2=$(command -v shunit2 2>/dev/null)" >> $GITHUB_ENV
- name: Run tests
run: make test

Expand All @@ -57,8 +51,6 @@ jobs:
chown -R makepkg:users /home/makepkg && \
sudo -u makepkg /bin/bash -c "cd /home/makepkg && git clone --quiet --depth 1 https://aur.archlinux.org/shunit2.git && cd shunit2/ && makepkg" && \
pacman -U --noconfirm /home/makepkg/shunit2/shunit2-*.pkg.tar.zst
- name: Configure env
run: echo "SHUNIT2=$(command -v shunit2 2>/dev/null)" >> $GITHUB_ENV
- name: Run tests
run: make test

Expand All @@ -69,8 +61,6 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install wget shunit2
- name: Configure env
run: echo "SHUNIT2=$(command -v shunit2 2>/dev/null)" >> $GITHUB_ENV
- name: Run tests
run: make test

Expand All @@ -88,5 +78,4 @@ jobs:
prepare: |
pkg install -y wget curl shunit2
run: |
export SHUNIT2="$(command -v shunit2 2>/dev/null)"
make test
11 changes: 10 additions & 1 deletion test/helper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[[ -z "$SHUNIT2" ]] && SHUNIT2=/usr/share/shunit2/shunit2
if [[ -z "$SHUNIT2" ]]; then
if [[ -f /usr/share/shunit2/shunit2 ]]; then
SHUNIT2=/usr/share/shunit2/shunit2
elif [[ -f /usr/bin/shunit2 ]]; then
SHUNIT2=/usr/bin/shunit2
else
echo "$0: shunit2 is not installed." >&2
exit 1
fi
fi

test_fixtures_dir="$PWD/test/fixtures"

Expand Down

0 comments on commit 6f68867

Please sign in to comment.