From f51a9f6a9358fecb676404d923c5be7467a95cf4 Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 11:20:50 +0100 Subject: [PATCH 1/7] fix: allow version provided to contain a v (old behaviour) --- bin/download | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/download b/bin/download index 9b7a479..67aaf3f 100755 --- a/bin/download +++ b/bin/download @@ -17,6 +17,8 @@ download_bats() { local download_path=$2 local repo_url=$3 + version=$(echo "$version" | sed 's/^v\(.*\)/\1/') + ( echo "* Downloading Bats-core(version:$version) to $download_path" git clone --depth=1 -b "v$version" "$repo_url" "$download_path" >/dev/null @@ -29,17 +31,17 @@ download_bats() { } version=${1:-"$ASDF_INSTALL_VERSION"} -if [[ -z "$version" ]] ; then +if [[ -z "$version" ]]; then fail "Version is missing - specify 1st param or set \$ASDF_INSTALL_VERSION" fi download_path=${2:-"$ASDF_DOWNLOAD_PATH"} -if [[ -z "$download_path" ]] ; then +if [[ -z "$download_path" ]]; then fail "Download path is missing - specify 2nd param or set \$ASDF_DOWNLOAD_PATH" fi repo_url=${3:-"$DEFAULT_BATS_REPO"} -if [[ -z "$repo_url" ]] ; then +if [[ -z "$repo_url" ]]; then fail "repo_url is missing - specify 3rd param" fi From 9ebaa1f2600e1421dbc28c8690bb94d8f40cfc0f Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 11:21:10 +0100 Subject: [PATCH 2/7] fix(ci): really play the test suite --- .github/workflows/asdf_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/asdf_test.yml b/.github/workflows/asdf_test.yml index c535258..0c7341e 100644 --- a/.github/workflows/asdf_test.yml +++ b/.github/workflows/asdf_test.yml @@ -24,7 +24,8 @@ jobs: run: git clone https://github.com/asdf-vm/asdf.git $HOME/asdf - name: install bats and run test - run: . $HOME/asdf/asdf.sh + run: | + . $HOME/asdf/asdf.sh asdf plugin add bats $GITHUB_WORKSPACE asdf list all bats asdf install bats latest From 569f549873faec877aab8c883ca062244cb9dadf Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 11:25:17 +0100 Subject: [PATCH 3/7] fix(ci): setup global bats version --- .github/workflows/asdf_test.yml | 1 + bin/download | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/asdf_test.yml b/.github/workflows/asdf_test.yml index 0c7341e..b455e1d 100644 --- a/.github/workflows/asdf_test.yml +++ b/.github/workflows/asdf_test.yml @@ -29,5 +29,6 @@ jobs: asdf plugin add bats $GITHUB_WORKSPACE asdf list all bats asdf install bats latest + asdf global bats latest bats --version bats test/ diff --git a/bin/download b/bin/download index 67aaf3f..8c17e33 100755 --- a/bin/download +++ b/bin/download @@ -3,7 +3,6 @@ set -e set -o pipefail -export LATEST_BATS_VERSION="v1.2.0" export DEFAULT_BATS_REPO="https://github.com/bats-core/bats-core.git" fail() { From 965b284ca42e90a847bd96e59cfcce100d3a1383 Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 11:26:10 +0100 Subject: [PATCH 4/7] fix(ci): change tests dir --- .github/workflows/asdf_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/asdf_test.yml b/.github/workflows/asdf_test.yml index b455e1d..9ff1274 100644 --- a/.github/workflows/asdf_test.yml +++ b/.github/workflows/asdf_test.yml @@ -31,4 +31,4 @@ jobs: asdf install bats latest asdf global bats latest bats --version - bats test/ + bats tests/ From b0dff44dcabb43f5da596dbf53821690a4bda3b3 Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 11:27:22 +0100 Subject: [PATCH 5/7] fix(ci): fix tests --- tests/list-all.bats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/list-all.bats b/tests/list-all.bats index 690c7ad..a9d02f6 100755 --- a/tests/list-all.bats +++ b/tests/list-all.bats @@ -17,11 +17,11 @@ main() { # check versions echo "$output" - [[ "$output" =~ "v0.1.0" ]] - [[ "$output" =~ "v0.2.0" ]] + [[ "$output" =~ "0.1.0" ]] + [[ "$output" =~ "0.2.0" ]] # check that versions are on same line - [[ "$output" =~ "v0.1.0 v0.2.0" ]] + [[ "$output" =~ "0.1.0 0.2.0" ]] } @test 'success if called with param' { From e55acb0da527d94d2298edf7d5df7b2abce28803 Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 14:30:39 +0100 Subject: [PATCH 6/7] fix(ci): replace readlink --- tests/download.bats | 2 +- tests/list-all.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/download.bats b/tests/download.bats index 141293b..0a599c9 100755 --- a/tests/download.bats +++ b/tests/download.bats @@ -2,7 +2,7 @@ setup() { export bin_path - bin_path=$(readlink -e "$BATS_TEST_DIRNAME/../bin") + bin_path=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$BATS_TEST_DIRNAME/../bin") export cmd="download" export test_version="v1.2.0" diff --git a/tests/list-all.bats b/tests/list-all.bats index a9d02f6..e0d1087 100755 --- a/tests/list-all.bats +++ b/tests/list-all.bats @@ -1,7 +1,7 @@ #!/usr/bin/env bats setup() { - export bin_path=$(readlink -e "$BATS_TEST_DIRNAME/../bin") + export bin_path=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$BATS_TEST_DIRNAME/../bin") export cmd="list-all" } From aaf378036c55ea3a8dc6c881f8a2ef2553a27701 Mon Sep 17 00:00:00 2001 From: Christophe Furmaniak Date: Mon, 21 Mar 2022 14:37:26 +0100 Subject: [PATCH 7/7] chore(ci): use latest gha base --- .github/workflows/asdf_test.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/asdf_test.yml b/.github/workflows/asdf_test.yml index 9ff1274..39cb2f5 100644 --- a/.github/workflows/asdf_test.yml +++ b/.github/workflows/asdf_test.yml @@ -9,23 +9,26 @@ on: - "**.md" jobs: - build: + plugin_test: + name: asdf plugin test strategy: matrix: - os: [ubuntu-latest, macOS-latest] - + os: + - ubuntu-latest + - macos-11 runs-on: ${{ matrix.os }} - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: install asdf-vm - run: git clone https://github.com/asdf-vm/asdf.git $HOME/asdf - - - name: install bats and run test + - name: Test OS + run: | + uname + uname -a + uname -s + - name: asdf_plugin_test + uses: asdf-vm/actions/plugin-test@v1 + with: + command: bats --version + - name: Run tests run: | - . $HOME/asdf/asdf.sh asdf plugin add bats $GITHUB_WORKSPACE asdf list all bats asdf install bats latest