Skip to content

Commit

Permalink
ci: Check for mold before trying to install install (mozilla#2421)
Browse files Browse the repository at this point in the history
Older Ubuntus don't have it.
  • Loading branch information
larseggert authored Feb 5, 2025
1 parent b9071e4 commit da548e6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ runs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
[ "$APT_UPDATED" ] || sudo apt-get update && echo "APT_UPDATED=1" >> "$GITHUB_ENV"
sudo apt-get install -y --no-install-recommends mold
if [ "$(apt-cache search --names-only '^mold$' | wc -l)" -ge 1 ]; then
[ "$APT_UPDATED" ] || sudo apt-get update && echo "APT_UPDATED=1" >> "$GITHUB_ENV"
sudo apt-get install -y --no-install-recommends mold
echo "RUSTFLAGS=-C link-arg=-fuse-ld=mold $RUSTFLAGS" >> "$GITHUB_ENV"
fi
# See https://corrode.dev/blog/tips-for-faster-ci-builds/
- name: Set up build environment
Expand All @@ -54,14 +57,9 @@ runs:
{
echo "CARGO_PROFILE_RELEASE_LTO=true"
echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1"
case "${{ runner.os }}" in
Linux)
echo "RUSTFLAGS=-C linker=clang -C link-arg=-fuse-ld=mold $RUSTFLAGS"
;;
Windows)
if [ "${{ runner.os }}" == "Windows"]; then
echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld $RUSTFLAGS"
;;
esac
fi
} >> "$GITHUB_ENV"
- name: Enable sscache
Expand Down

0 comments on commit da548e6

Please sign in to comment.