Skip to content

Commit

Permalink
Fix jq error and master not found issue
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval committed Jan 3, 2025
1 parent 0ebb862 commit 28bc37e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rustc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ jobs:
uses: actions/checkout@v4

- name: Run rustc script
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/check_rustc.sh
23 changes: 19 additions & 4 deletions scripts/check_rustc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,25 @@ cd "$REPO_DIR"
# Get the commit ID from rustc --version
echo "Retrieving commit ID..."
COMMIT_ID=$(rustc --version | sed -e "s/.*(\(.*\) .*/\1/")
echo "$COMMIT_ID for rustc is"

# Get the full commit ID for shallow clone
curl -H "Connection: close" -o "${TMP_RUST_DIR}/output.json" -s --show-error \
"https://api.github.com/repos/rust-lang/rust/commits?sha=${COMMIT_ID}&per_page=1"
COMMIT_ID=$(jq -r '.[0].sha' "${TMP_RUST_DIR}/output.json")
echo "Full commit id for $COMMIT_ID for is:"

if [ -z "${GH_TOKEN:-}" ]; then
curl -o "${TMP_RUST_DIR}/output.json" -s --show-error \
"https://api.github.com/repos/rust-lang/rust/commits?sha=${COMMIT_ID}&per_page=1"
else
# Use token if possible to avoid being throttled
curl -o "${TMP_RUST_DIR}/output.json" -s --show-error \
--request GET \
--url "https://api.github.com/repos/rust-lang/rust/commits?sha=${COMMIT_ID}&per_page=1" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer $GH_TOKEN"
fi
cat "${TMP_RUST_DIR}/output.json" # Dump the file in case `curl` fails.

COMMIT_ID=$(cat "${TMP_RUST_DIR}/output.json" | jq -r '.[0].sha')
echo "- $COMMIT_ID"

# Clone the rust-lang/rust repository
echo "Cloning rust-lang/rust repository into ${TMP_RUST_DIR}..."
Expand All @@ -74,6 +87,8 @@ cp -r "${REPO_DIR}/library" "${TMP_RUST_DIR}"
pushd "${TMP_RUST_DIR}"
./configure --set=llvm.download-ci-llvm=true
export RUSTFLAGS="--check-cfg cfg(kani) --check-cfg cfg(feature,values(any()))"
export RUST_BACKTRACE=1
unset GITHUB_ACTIONS # Bootstrap script requires specific repo layout when run from an action. Disable that.

# Run tidy
if [ "${TIDY_MODE}" == "--bless" ];
Expand Down

0 comments on commit 28bc37e

Please sign in to comment.