diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f169fe..79dbb5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,3 +27,9 @@ jobs: ] # this ruleset only supports linux and macos exclude_windows: true + integration-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - working-directory: examples/target-determinator + run: ./minimal_download_test.sh diff --git a/examples/target-determinator/minimal_download_test.sh b/examples/target-determinator/minimal_download_test.sh new file mode 100755 index 0000000..4ee0b88 --- /dev/null +++ b/examples/target-determinator/minimal_download_test.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -o errexit -o pipefail -o nounset + +# Determine a single file we are supposed to download for the host platform +OS="$(uname | tr '[:upper:]' '[:lower:]')" +ARCH="$(arch)" +ALLOWED="target-determinator.${OS}.${ARCH}" +if [ "$ARCH" == "x86_64" ]; then + ALLOWED="target-determinator.${OS}.amd64" +fi + +############# +# Test bzlmod +OUTPUT_BASE=$(mktemp -d) +REPO_CACHE=$(mktemp -d) +DL_CONFIG=$(mktemp) + +# Construct a Bazel downloader config that forbids access to non-allowed files from multitool.lock.json +for file in target-determinator.darwin.arm64 target-determinator.linux.amd64 target-determinator.darwin.amd64; do + if [ "$file" != "$ALLOWED" ]; then + cat >$DL_CONFIG <