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
8 changes: 8 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full
LLVM_DOWNLOAD_DIR: "${{ github.workspace }}/llvm-downloads"

jobs:
test:
Expand All @@ -31,8 +32,15 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Cache LLVM source
uses: actions/cache@v6
with:
path: llvm-downloads
key: llvm-downloads-${{ hashFiles('Cargo.toml', 'etc/download-llvm.sh') }}
- name: Download llvm source
run: ./etc/download-llvm.sh

- name: Build and run tests
run: cargo test --workspace

Expand Down
2 changes: 1 addition & 1 deletion etc/download-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version="$(
llvm_hash="${version##*-}"

target_dir="${CARGO_TARGET_DIR:-target}"
out_dir="$target_dir/llvm-downloads"
out_dir="${LLVM_DOWNLOAD_DIR:-$target_dir/llvm-downloads}"
mkdir -p "$out_dir"

if [ -d "$out_dir/llvm-project-$llvm_hash" ] && [ "${1:-}" != "-f" ]; then
Expand Down
8 changes: 6 additions & 2 deletions fuzz/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ fn main() -> io::Result<()> {
let target_dir = env::var_os("CARGO_TARGET_DIR")
.map(PathBuf::from)
.unwrap_or_else(|| manifest_dir.parent().unwrap().join("target"));
let llvm_root = target_dir.join(format!("llvm-downloads/llvm-project-{llvm_commit_hash}"));
let version_dir = format!("llvm-project-{llvm_commit_hash}");
let llvm_root = match env::var_os("LLVM_DOWNLOAD_DIR") {
Some(dir) => PathBuf::from(dir).join(version_dir),
None => target_dir.join("llvm-downloads").join(version_dir),
};

if !llvm_root.try_exists().is_ok_and(|val| val) {
panic!(
"llvm dir `{llvm_root:?}` does not exist or cannot be reached. \
"llvm dir {llvm_root:?} does not exist or cannot be reached. \
Perhaps you need to run etc/download-llvm.sh?"
)
}
Expand Down
Loading