From 07159bfd9796d80cb7981706be64091136660a9c Mon Sep 17 00:00:00 2001 From: "w.pomp" Date: Thu, 16 Apr 2026 18:02:50 +0200 Subject: [PATCH] CI workflow --- .github/workflows/CI.yml | 50 ++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5fe262b..bdd1b16 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -32,22 +32,54 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x - - name: Install Rust (rustup) - env: - SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET || '' }} # optional + - name: Cache Rust and sccache + uses: actions/cache@v4 + with: + path: | + ${{ runner.temp }}/cargo + ${{ runner.temp }}/rustup + ~/.cache/pip + ~/.cache/pip-wheel + ~/.cache/sccache + key: rust-cache-${{ matrix.platform.target }}-${{ hashFiles('**/Cargo.lock') }}-${{ runner.os }}-${{ github.ref }} + restore-keys: | + rust-cache-${{ matrix.platform.target }}-${{ runner.os }}- + rust-cache-${{ runner.os }}- + + - name: Install Rust (rustup) if needed run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - source $HOME/.cargo/env - rustup default nightly - rustup target add x86_64-unknown-linux-gnu - cargo install sccache + set -e + export RUSTUP_HOME="${{ runner.temp }}/rustup" + export CARGO_HOME="${{ runner.temp }}/cargo" + export PATH="$CARGO_HOME/bin:$PATH" + if ! command -v rustc >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source "$CARGO_HOME/env" 2>/dev/null || true + rustup default nightly + rustup target add x86_64-unknown-linux-gnu + fi + rustup target add "${{ matrix.platform.target }}" || true + shell: bash + + - name: Install sccache and maturin + run: | + export RUSTUP_HOME="${{ runner.temp }}/rustup" + export CARGO_HOME="${{ runner.temp }}/cargo" + export PATH="$CARGO_HOME/bin:$PATH" + python -m pip install --upgrade pip + pip install maturin + if ! command -v sccache >/dev/null 2>&1; then + cargo install sccache || pip install sccache + fi + shell: bash + - name: Build wheels run: | source $HOME/.cargo/env python -m pip install maturin maturin build --release --out dist --find-interpreter --target ${{ matrix.platform.target }} - name: Upload wheels - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@v3.2.2 with: name: wheels-linux-${{ matrix.platform.target }} path: dist