diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e2e0dda..67c8a88d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,6 +72,43 @@ jobs: - run: ./setup-cli/assert/clean.sh shell: bash + action_twice: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: ./setup-cli + + # Confirm the action can be invoked more than once in the same job, and + # that each invocation resolves to its own binary. + - uses: ./setup-cli + + - run: echo $(which databricks) + shell: bash + + - uses: ./setup-cli + + - run: echo $(which databricks) + shell: bash + + - run: databricks version + shell: bash + + - run: ./setup-cli/assert/version.sh $(cat ./setup-cli/VERSION) + shell: bash + + - run: ./setup-cli/assert/clean.sh + shell: bash + install: runs-on: ${{ matrix.os }} diff --git a/setup_release.sh b/setup_release.sh index 4f2303ff..ed21b691 100644 --- a/setup_release.sh +++ b/setup_release.sh @@ -38,16 +38,19 @@ ARM64) ;; esac -# Change into temporary directory. -cd "$RUNNER_TEMP" +# Use a unique directory per invocation so repeated calls in the same job (and +# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the +# beginning and end of each job, so it needs no manual cleanup; see +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +dir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" +cd "$dir" # Download release archive. curl -fsSL -O "https://github.com/databricks/cli/releases/download/v${VERSION}/${FILE}.zip" # Unzip release archive. -unzip -q "${FILE}.zip" -d .bin +unzip -q "${FILE}.zip" # Add databricks to path. -dir=$PWD/.bin chmod +x "${dir}/databricks" echo "$dir" >> "$GITHUB_PATH" diff --git a/setup_snapshot.sh b/setup_snapshot.sh index 92549f52..6f70e73e 100755 --- a/setup_snapshot.sh +++ b/setup_snapshot.sh @@ -66,12 +66,16 @@ macOS) ;; esac -# Change into temporary directory. -cd "$RUNNER_TEMP" +# Use a unique directory per invocation so repeated calls in the same job (and +# other tools using $RUNNER_TEMP) don't collide. $RUNNER_TEMP is emptied at the +# beginning and end of each job, so it needs no manual cleanup; see +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +tmpdir="$(mktemp -d "$RUNNER_TEMP/databricks.XXXXXX")" +cd "$tmpdir" -gh run download "$last_successful_run_id" -n "$artifact" -D .bin +gh run download "$last_successful_run_id" -n "$artifact" -D . -dir="$PWD/.bin/$(cli_snapshot_directory)" +dir="$PWD/$(cli_snapshot_directory)" if [ ! -d "$dir" ]; then echo "Directory does not exist: $dir"