Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue (#1405) #1408

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions tools/ci/setup.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
#!/bin/bash
set -eo pipefail
set -euo pipefail

echo "--- Installing yarn dependencies"

# Disable global cache so that we can cache `.yarn/cache` in buildkite
yarn config set enableGlobalCache false

# Immutable is the same as a frozen lockfile
yarn --immutable
# Check for lockfile before running yarn --immutable
if [[ -f yarn.lock ]]; then
echo "--- Verifying lockfile integrity"
yarn --immutable || { echo "Lockfile validation failed! Ensure your lockfile is up to date."; exit 1; }
else
echo "Error: yarn.lock file not found. Aborting."
exit 1
fi

# Need to ensure base branch is up-to-date. If not running on a PR, use `BUILDKITE_BRANCH`
BASE_BRANCH=$BUILDKITE_PULL_REQUEST_BASE_BRANCH
# Need to ensure base branch is up-to-date
BASE_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-$BUILDKITE_BRANCH}"
if [[ -z "$BASE_BRANCH" ]]; then
BASE_BRANCH=$BUILDKITE_BRANCH
echo "Error: Unable to determine base branch. Ensure BUILDKITE_BRANCH is set."
exit 1
fi

echo "--- Updating local '$BASE_BRANCH' base branch"

# Required for correct Nx affected project resolution
git fetch -f --no-tags origin $BASE_BRANCH:$BASE_BRANCH
if git fetch -f --no-tags origin "$BASE_BRANCH:$BASE_BRANCH"; then
echo "--- Successfully updated '$BASE_BRANCH'"
else
echo "Error: Failed to fetch base branch '$BASE_BRANCH'. Ensure it exists in the remote repository."
exit 1
fi

echo "--- Building required packages"

yarn build
if yarn build; then
echo "--- Build completed successfully"
else
echo "Error: Build failed. Check the logs for details."
exit 1
fi