From 6dfc31b62f5de6471b1d5917fc8c1473b3f9627a Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Thu, 14 Dec 2023 01:34:05 -0600 Subject: [PATCH] CI: added e2e test for install.sh Fixes #1132 --- .github/workflows/rtx.yml | 1 + packaging/standalone/install.envsubst | 14 +++++++------- scripts/release.sh | 3 +++ scripts/render-install.sh | 2 +- scripts/test-standalone.sh | 18 ++++++++++++++++++ 5 files changed, 30 insertions(+), 8 deletions(-) create mode 100755 scripts/test-standalone.sh diff --git a/.github/workflows/rtx.yml b/.github/workflows/rtx.yml index 0a215acda0..ad0858f944 100644 --- a/.github/workflows/rtx.yml +++ b/.github/workflows/rtx.yml @@ -43,6 +43,7 @@ jobs: - run: cargo deny check - run: cargo msrv verify - run: cargo machete --with-metadata + - run: ./scripts/test-standalone.sh - run: just render-all lint-fix - if: github.event_name == 'pull_request' uses: EndBug/add-and-commit@v9 diff --git a/packaging/standalone/install.envsubst b/packaging/standalone/install.envsubst index 637319ec84..46d5d9dc52 100644 --- a/packaging/standalone/install.envsubst +++ b/packaging/standalone/install.envsubst @@ -52,13 +52,13 @@ get_arch() { } shasum_bin() { - if command -v shasum >/dev/null 2>&1; then - echo "shasum" - elif command -v sha256sum >/dev/null 2>&1; then - echo "sha256sum" - else - error "rtx install requires shasum or sha256sum but neither is installed. Aborting." - fi + if command -v shasum >/dev/null 2>&1; then + echo "shasum" + elif command -v sha256sum >/dev/null 2>&1; then + echo "sha256sum" + else + error "rtx install requires shasum or sha256sum but neither is installed. Aborting." + fi } get_checksum() { diff --git a/scripts/release.sh b/scripts/release.sh index eb99227eed..3c5f529cd2 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -53,7 +53,10 @@ gpg --clearsign -u 408B88DB29DDE9E0 SHASUMS256.asc gpg --clearsign -u 408B88DB29DDE9E0 SHASUMS512.asc popd +pushd rtx ./rtx/scripts/render-install.sh >"$RELEASE_DIR"/install.sh +popd + chmod +x "$RELEASE_DIR"/install.sh shellcheck "$RELEASE_DIR"/install.sh # TODO: figure out how to test this diff --git a/scripts/render-install.sh b/scripts/render-install.sh index 1f66c73570..2f21f80d70 100755 --- a/scripts/render-install.sh +++ b/scripts/render-install.sh @@ -14,4 +14,4 @@ RTX_VERSION=$RTX_VERSION \ RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v.*macos-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v.*macos-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \ - "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt" +./scripts/render-install.sh >tmp/install.sh +chmod +x tmp/install.sh +shellcheck tmp/install.sh + +RTX_DATA_DIR="$RELEASE_DIR" ./tmp/install.sh +if [[ ! "$("$RELEASE_DIR/bin/rtx" -v)" =~ ^${RTX_VERSION//v} ]]; then + echo "rtx version mismatch" + exit 1 +fi