Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 4 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Install llvm 18
run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 18 && rm llvm.sh
- name: Install llvm
run: sudo apt update && sudo apt install -y clang # This requires Ubuntu 24.04 or later
- name: Install cargo generate
run: cargo install cargo-generate
- name: Generate workspace
Expand All @@ -37,18 +37,16 @@ jobs:
run: cd test-workspace && echo "1.75.0" > rust-toolchain
- name: Install riscv64 target
run: cd test-workspace && rustup target add riscv64imac-unknown-none-elf
# TODO: Ubuntu 24.04 ships a clang package with clang, clang-18 and llvm-ar-18, while fedora ships a clang package with
# clang, clang-19 and llvm-ar. We will need to deal with this quirk between different distros.
- name: Run all checks
run: cd test-workspace && CLANG=clang-18 make build test check clippy
run: cd test-workspace && make build test check clippy
- name: Reproducible build runs
run: cd test-workspace && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean
- name: Generate standalone contract
run: cargo generate --path . standalone-contract --name test-contract
- name: Lock Rust version
run: cd test-contract && echo "1.75.0" > rust-toolchain
- name: Run all checks
run: cd test-contract && CLANG=clang-18 make build test check clippy
run: cd test-contract && make build test check clippy
- name: Reproducible build runs
run: cd test-contract && ./scripts/reproducible_build_docker --update && ./scripts/reproducible_build_docker --no-clean

Expand Down
20 changes: 13 additions & 7 deletions standalone-contract/scripts/find_clang
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@ if [[ -n "${CLANG}" ]]; then
exit 0
fi

CANDIDATES=("clang" "clang-16" "clang-17" "clang-18")
# To cope with packaging messes from different distros, we would search
# for a different binary other than clang, then convert it back to clang
# at the end.
SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}"

CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16")

BREW_PREFIX=$(brew --prefix 2> /dev/null)
if [[ -n "${BREW_PREFIX}" ]]; then
CANDIDATES+=(
"${BREW_PREFIX}/opt/llvm/bin/clang"
"${BREW_PREFIX}/opt/llvm@16/bin/clang"
"${BREW_PREFIX}/opt/llvm@17/bin/clang"
"${BREW_PREFIX}/opt/llvm@18/bin/clang"
"${BREW_PREFIX}/opt/llvm/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@19/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@18/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@17/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@16/bin/${SEARCH_TARGET}"
)
fi

for candidate in ${CANDIDATES[@]}; do
OUTPUT=$($candidate -dumpversion 2> /dev/null | cut -d'.' -f 1)
OUTPUT=$($candidate --version 2> /dev/null | grep 'version [0-9]' | head -n 1 | cut -d'.' -f 1 | grep -o '[0-9][0-9]*')

if [[ $((OUTPUT)) -ge 16 ]]; then
echo "$candidate"
echo "${candidate/${SEARCH_TARGET}/clang}"
exit 0
fi
done
Expand Down
20 changes: 13 additions & 7 deletions workspace/scripts/find_clang
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@ if [[ -n "${CLANG}" ]]; then
exit 0
fi

CANDIDATES=("clang" "clang-16" "clang-17" "clang-18")
# To cope with packaging messes from different distros, we would search
# for a different binary other than clang, then convert it back to clang
# at the end.
SEARCH_TARGET="${SEARCH_TARGET:-llvm-strip}"

CANDIDATES=("${SEARCH_TARGET}" "${SEARCH_TARGET}-19" "${SEARCH_TARGET}-18" "${SEARCH_TARGET}-17" "${SEARCH_TARGET}-16")

BREW_PREFIX=$(brew --prefix 2> /dev/null)
if [[ -n "${BREW_PREFIX}" ]]; then
CANDIDATES+=(
"${BREW_PREFIX}/opt/llvm/bin/clang"
"${BREW_PREFIX}/opt/llvm@16/bin/clang"
"${BREW_PREFIX}/opt/llvm@17/bin/clang"
"${BREW_PREFIX}/opt/llvm@18/bin/clang"
"${BREW_PREFIX}/opt/llvm/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@19/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@18/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@17/bin/${SEARCH_TARGET}"
"${BREW_PREFIX}/opt/llvm@16/bin/${SEARCH_TARGET}"
)
fi

for candidate in ${CANDIDATES[@]}; do
OUTPUT=$($candidate -dumpversion 2> /dev/null | cut -d'.' -f 1)
OUTPUT=$($candidate --version 2> /dev/null | grep 'version [0-9]' | head -n 1 | cut -d'.' -f 1 | grep -o '[0-9][0-9]*')

if [[ $((OUTPUT)) -ge 16 ]]; then
echo "$candidate"
echo "${candidate/${SEARCH_TARGET}/clang}"
exit 0
fi
done
Expand Down
Loading