Skip to content
Open
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
98 changes: 85 additions & 13 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Rust CI
on:
push:
branches:
- '**'
- master
- main
- llvm18
pull_request:
branches:
- '**'
Expand All @@ -26,17 +28,21 @@ jobs:
- name: Setup sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: mozilla-actions/sccache-action@v0.0.9

- name: Configure sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV

- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-machete
run: cargo install cargo-machete

- name: Run cargo machete
run: cargo machete

Expand All @@ -45,19 +51,37 @@ jobs:
needs: [format, machete]
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: x86_64-pc-windows-gnu

- name: Setup sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: mozilla-actions/sccache-action@v0.0.9

- name: Configure sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV

- name: "Cache cargo"
id: cache-cargo
uses: "actions/cache@v4"
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
save-always: true
key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{runner.arch}}-cargo-

- name: Install LLVM 18 and Windows cross-compilation tools
run: |
wget https://apt.llvm.org/llvm.sh
Expand All @@ -74,25 +98,30 @@ jobs:
# Verify installation
which llvm-lib
llvm-lib --version

- name: Set LLVM environment variables
run: |
echo "LLVM_SYS_181_PREFIX=/usr/lib/llvm-18" >> $GITHUB_ENV
echo "CLANG_PATH=/usr/lib/llvm-18/bin/clang" >> $GITHUB_ENV
echo "PATH=/usr/lib/llvm-18/bin:$PATH" >> $GITHUB_ENV
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Build
run: cargo build --release

- name: Show sccache stats
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
shell: bash
run: ${SCCACHE_PATH} --show-stats
# someone has to fix the errors
# - name: Run Clippy
# run: cargo clippy -- -D warnings

- name: Run tests
run: cargo test --release

Expand Down Expand Up @@ -129,26 +158,44 @@ jobs:
mkdir -p .cargo
echo '[net]' > .cargo/config.toml
echo 'git-fetch-with-cli = true' >> .cargo/config.toml

- name: Cache sccache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{runner.arch}}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-
${{ runner.os }}-${{runner.arch}}-sccache-

- name: Locate and configure sccache
shell: msys2 {0}
run: |
# export SCCACHE_PATH=$(which sccache)
# echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=${SCCACHE_PATH}" >> $GITHUB_ENV

- name: "Cache cargo"
id: cache-cargo
uses: "actions/cache@v4"
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
save-always: true
key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{runner.arch}}-cargo-

- name: Run cargo
shell: msys2 {0}
run: cargo build --release
#- name: Show sccache stats
# if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
# shell: msys2 {0}
# run: $SCCACHE_PATH --show-stats

- name: Run tests
shell: msys2 {0}
run: cargo test --release
Expand All @@ -158,25 +205,50 @@ jobs:
fail-fast: false
matrix:
include:
- arch: arm64
macos: 13
- arch: x86_64
macos: 13
runs-on: macos-${{ matrix.macos }}
# Intel
- image: macos-15-intel
# ARM64
- image: macos-15
- image: macos-14

runs-on: ${{ matrix.image }}
needs: [format, machete]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pkg-config with Homebrew
- name: Install dependencies with Homebrew
uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: pkg-config sccache llvm@18
cache: yes

- name: Set LLVM environment variables
run: |
brew install pkg-config mingw-w64 sccache llvm
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH
echo "LLVM_SYS_181_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
echo "RUN_DEV_TESTS=1" >> $GITHUB_ENV

- name: sccache setup
run: |
# echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=$(which sccache)" >> $GITHUB_ENV


- name: "Cache cargo"
id: cache-cargo
uses: "actions/cache@v4"
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
save-always: true
key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{runner.arch}}}-cargo-

- name: Build
run: cargo build --release

Expand Down
Loading