Skip to content

Commit

Permalink
fix: make install.dependencies on Windows
Browse files Browse the repository at this point in the history
This change fixes make install.dependencies on Windows. The Windows
platform relies on sha512sum tool instead of shasum tool which is
available on macOS. This change also adds a spot check for make
install.dependencies on macOS 13 and Windows to CI.

Signed-off-by: Austin Vazquez <[email protected]>
  • Loading branch information
austinvazquez committed Jun 25, 2024
1 parent 91c52d7 commit 2b3f8c8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ concurrency:
cancel-in-progress: true

jobs:
install-dependencies:
# This is a spot check for make install.dependencies on macOS and Windows platforms.
# Finch-core provides the core dependencies needed to run Finch such as the base OS
# image, rootfs, and Lima bundle. Validate the mechanism used to install the core
# dependencies works on the respective platforms.
strategy:
fail-fast: false
matrix:
os: [macos-13, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
persist-credentials: false
submodules: true
- name: Setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: e2e/go.mod
cache-dependency-path: e2e/go.sum
- name: Install platform dependencies
run: make install.dependencies
- name: Clean up dependencies
run: make clean

e2e-tests:
strategy:
fail-fast: false
Expand Down
12 changes: 11 additions & 1 deletion deps/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ esac
# pull artifact from dependency repository
curl -L --fail "${url}/${artifact}" > "${file}"

shasum_command=()
if hash sha512sum; then
shasum_command=(sha512sum)
elif hash shasum; then
shasum_command=(shasum --algorithm 512)
else
echo "error: shasum dependency not found" && exit 1
fi

# validate shasum for downloaded artifact
(shasum --algorithm 512 "${file}" | cut -d ' ' -f 1 | grep -xq "^${digest}$") || \
shasum=$("${shasum_command[@]}" "${file}")
(echo "${shasum}" | cut -d ' ' -f 1 | grep -xq "^${digest}$") || \
(echo "error: shasum verification failed for dependency" && rm -f "${file}" && exit 1)

0 comments on commit 2b3f8c8

Please sign in to comment.