From 3e74ef78277196f2e3ae91a9a51a3c57556f6027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Mi=C5=9Btal?= <37044072+szymmis@users.noreply.github.com> Date: Fri, 11 Aug 2023 11:18:31 +0200 Subject: [PATCH 1/2] Add support for installing nightlies --- lib/utils.bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index c79d5f7..4a159c8 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -3,6 +3,7 @@ set -euo pipefail GH_REPO="https://github.com/software-mansion/scarb" +GH_NIGHTLIES_REPO="https://github.com/software-mansion/scarb-nightlies" TOOL_NAME="scarb" TOOL_TEST="scarb --version" @@ -42,8 +43,18 @@ download_release() { get_architecture || fail "Could not determine system architecture." local _arch="$RETVAL" - local _tarball="scarb-v${version}-${_arch}.tar.gz" - url="$GH_REPO/releases/download/v${version}/${_tarball}" + local repository tag + + if grep -q "nightly" <<<"$version"; then + repository=$GH_NIGHTLIES_REPO + tag=$version + else + repository=$GH_REPO + tag="v$version" + fi + + local _tarball="scarb-${tag}-${_arch}.tar.gz" + url="${repository}/releases/download/${tag}/${_tarball}" echo "* Downloading $TOOL_NAME release $version..." curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" From 97cf3690f30636db08ee137b0981442d24f0ba59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Mi=C5=9Btal?= <37044072+szymmis@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:33:26 +0200 Subject: [PATCH 2/2] Add multiple Scarb versions tests to CI workflow --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f88368..cbc070a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,33 @@ jobs: - macos-latest runs-on: ${{ matrix.os }} steps: - - uses: asdf-vm/actions/plugin-test@v2 + - name: "Fetch latest Scarb version from GitHub releases" + id: version + shell: pwsh + run: | + $location = (Invoke-WebRequest -Uri "https://github.com/software-mansion/scarb/releases/latest" -Method Head -MaximumRedirection 0 -SkipHttpErrorCheck -ErrorAction Ignore).Headers.Location + $latest_version = ($location -replace '^.*/v','') + echo "Latest Scarb version found is $latest_version" + echo "LATEST_VERSION=$latest_version" >> $env:GITHUB_OUTPUT + + - name: "Check Scarb latest" + uses: asdf-vm/actions/plugin-test@v2 + with: + command: scarb --version | grep "scarb ${{ steps.version.outputs.LATEST_VERSION }}" + + - name: "Check Scarb v0.5.2" + uses: asdf-vm/actions/plugin-test@v2 + with: + skip_install: true + version: 0.5.2 + command: scarb --version | grep "scarb 0.5.2" + + - name: "Check Scarb nightly-2023-08-10" + uses: asdf-vm/actions/plugin-test@v2 with: - command: scarb --version + skip_install: true + version: nightly-2023-08-10 + command: scarb --version | grep "scarb 0.6.0+nightly-2023-08-10" shellcheck: runs-on: ubuntu-latest