Merge pull request #1078 from hash-org/updates #1922
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test: | |
runs-on: ["${{ matrix.distro }}"] | |
name: Build on ${{ matrix.distro }} ${{ matrix.arch }} | |
strategy: | |
matrix: | |
include: | |
- arch: x64 | |
distro: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Cache LLVM | |
id: cache-llvm | |
uses: actions/cache@v2 | |
with: | |
path: ./llvm | |
key: llvm-18 | |
- name: Install LLVM | |
uses: KyleMayes/install-llvm-action@abb6cec0ec431e834bc5e5090ea39a2d1d63a4c6 # v2.0.3 | |
with: | |
version: "18.1.4" | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
- name: Install Rust nightly | |
run: | | |
rustup toolchain install nightly | |
rustup component add clippy --toolchain nightly | |
rustup component add rustfmt --toolchain nightly | |
rustup default nightly | |
- name: Dependency caching | |
uses: Swatinem/rust-cache@v2 | |
- name: LLVM location | |
# @@Dumbness: we need to install `libtinfo5` because of: | |
# - https://github.com/hash-org/hashc/actions/runs/9634436024/job/26570084536 | |
run: | | |
sudo apt install -y libtinfo5 | |
echo $LLVM_PATH | |
$LLVM_PATH/bin/llvm-config --version | |
- name: Run tests | |
run: "LLVM_SYS_181_PREFIX=$LLVM_PATH cargo test --all --verbose" | |
- name: Run clippy | |
run: "LLVM_SYS_181_PREFIX=$LLVM_PATH cargo clippy --all -- -D warnings" | |
- name: Check formatting | |
run: "cargo fmt --all -- --check" |