Skip to content

Commit

Permalink
fix install for macos, add bats lib path as output
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpip3 committed Sep 15, 2024
1 parent d112450 commit f2f2dba
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/test-local-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bats and Bats libs
id: setup-bats
uses: ./
with:
bats-version: ${{ matrix.version }}
Expand All @@ -32,23 +33,35 @@ jobs:
detik-clean: "false"
file-clean: "false"
- name: Execute test to check Bats-support
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.bats-lib-path }}
TMP_PATH: ${{ steps.setup-bats.outputs.tmp-path }}
run: |
cd /tmp/bats-support/
cd ${TMP_PATH}/bats-support/
bats test
- name: Execute test to check Bats-assert
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.bats-lib-path }}
TMP_PATH: ${{ steps.setup-bats.outputs.tmp-path }}
run: |
cd /tmp/bats-assert/
cd ${TMP_PATH}/bats-assert/
bats test
- name: Execute test to check Bats-detik
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.bats-lib-path }}
TMP_PATH: ${{ steps.setup-bats.outputs.tmp-path }}
run: |
cd /tmp/bats-detik/
cd ${TMP_PATH}/bats-detik/
bats tests
- name: Execute test to check Bats-file
# Currently the bats-file tests are broken
# in gh runner env
continue-on-error: true
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.bats-lib-path }}
TMP_PATH: ${{ steps.setup-bats.outputs.tmp-path }}
run: |
cd /tmp/bats-file/
cd ${TMP_PATH}/bats-file/
bats test
- name: Execute example tests
run:
Expand Down
26 changes: 18 additions & 8 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ outputs:
file-installed:
description: "True/False if bats-file has been installed"
value: ${{ (steps.file-install.outputs.file-installed != '') }}
bats-lib-path:
description: "Bats lib path to use to load the libraries"
value: ${{ steps.set-paths.outputs.bats-lib-path }}
tmp-path:
description: "Bats lib path to use to load the libraries"
value: ${{ steps.set-paths.outputs.tmp-path }}

runs:
using: composite
Expand Down Expand Up @@ -169,6 +175,8 @@ runs:
echo "DEFAULT_BASE_DIR=$DEFAULT_BASE_DIR" >> $GITHUB_ENV
echo "CMD=$CMD" >> $GITHUB_ENV
echo "TEMPDIR=$TEMPDIR" >> $GITHUB_ENV
echo "bats-lib-path=$DEFAULT_BASE_DIR" >> $GITHUB_OUTPUT
echo "tmp-path=$TEMPDIR" >> $GITHUB_OUTPUT
- name: "Calculate DESTDIR for Bats-support"
if: inputs.support-install == 'true'
Expand Down Expand Up @@ -202,9 +210,9 @@ runs:
mkdir -p ${TEMPDIR}
${CMD} mkdir -p ${DESTDIR}/src/
curl -sL --retry 2 --retry-all-errors ${url} | tar xz -C ${TEMPDIR} --strip-components 1 && cd ${TEMPDIR}
${CMD} install -Dm755 load.bash ${DESTDIR}/load.bash
${CMD} install -m755 load.bash ${DESTDIR}/load.bash
for fn in src/*.bash; do
${CMD} install -Dm755 $fn \
${CMD} install -m755 $fn \
${DESTDIR}/src/$(basename $fn)
done
echo "Bats Support v$VERSION installed in $DESTDIR"
Expand Down Expand Up @@ -243,9 +251,9 @@ runs:
mkdir -p ${TEMPDIR}
${CMD} mkdir -p ${DESTDIR}/src/
curl -sL --retry 2 --retry-all-errors ${url} | tar xz -C ${TEMPDIR} --strip-components 1 && cd ${TEMPDIR}
${CMD} install -Dm755 load.bash ${DESTDIR}/load.bash
${CMD} install -m755 load.bash ${DESTDIR}/load.bash
for fn in src/*.bash; do
${CMD} install -Dm755 $fn \
${CMD} install -m755 $fn \
${DESTDIR}/src/$(basename $fn)
done
echo "Bats Assert v$VERSION installed in $DESTDIR"
Expand Down Expand Up @@ -285,7 +293,7 @@ runs:
${CMD} mkdir -p ${DESTDIR}/src/
curl -sL --retry 2 --retry-all-errors ${url} | tar xz -C ${TEMPDIR} --strip-components 1 && cd ${TEMPDIR}
for fn in lib/*.bash; do
${CMD} install -Dm755 $fn \
${CMD} install -m755 $fn \
${DESTDIR}/$(basename $fn)
done
echo "Bats Detik v$VERSION installed in $DESTDIR"
Expand Down Expand Up @@ -324,20 +332,22 @@ runs:
mkdir -p ${TEMPDIR}
${CMD} mkdir -p ${DESTDIR}/src/
curl -sL --retry 2 --retry-all-errors ${url} | tar xz -C ${TEMPDIR} --strip-components 1 && cd ${TEMPDIR}
${CMD} install -Dm755 load.bash ${DESTDIR}/load.bash
${CMD} install -m755 load.bash ${DESTDIR}/load.bash
for fn in src/*.bash; do
${CMD} install -Dm755 $fn \
${CMD} install -m755 $fn \
${DESTDIR}/src/$(basename $fn)
done
echo "Bats File v$VERSION installed in $DESTDIR"
echo "file-installed=true" >> $GITHUB_OUTPUT
[[ "${{ inputs.file-clean }}" == "true" ]] && rm -rf ${TEMPDIR} || exit 0
- name: "Debug print if installed"
- name: "Print info"
shell: bash
run: |
echo "Bats installed: ${{ (steps.bats-install.outputs.bats-installed != '') }}"
echo "Support installed: ${{ (steps.support-install.outputs.support-installed != '') }}"
echo "Assert installed: ${{ (steps.assert-install.outputs.assert-installed != '') }}"
echo "Detik installed: ${{ (steps.detik-install.outputs.detik-installed != '') }}"
echo "File installed: ${{ (steps.file-install.outputs.file-installed != '') }}"
echo "Bats lib to use in BATS_LIB_PATH env ${{ steps.set-paths.outputs.bats-lib-path }}"
echo "Tmp path: ${{ steps.set-paths.outputs.tmp-path }}"

0 comments on commit f2f2dba

Please sign in to comment.