Skip to content

Commit

Permalink
ci(python): Cache Rust build on main branch (pola-rs#9130)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored May 30, 2023
1 parent 6fbc142 commit 4ce4040
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cache-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Cache Rust

on:
push:
branches:
- main
paths:
- py-polars/**
- polars/**
- .github/workflows/cache-rust.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cache-rust:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Set up Rust
run: rustup show

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: shared-${{ matrix.os }}
workspaces: py-polars

- name: Run cargo build
working-directory: py-polars
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
run: cargo build
8 changes: 4 additions & 4 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'py-polars/requirements-dev.txt'

- name: Create virtual environment
run: |
Expand All @@ -49,7 +47,9 @@ jobs:
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: shared-ubuntu-latest
workspaces: py-polars
save-if: false

- name: Install Polars
env:
Expand Down Expand Up @@ -96,8 +96,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: py-polars/requirements-dev.txt

- name: Install Python dependencies
run: |
Expand All @@ -110,7 +108,9 @@ jobs:
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: shared-windows-latest
workspaces: py-polars
save-if: false

- name: Install Polars
shell: bash
Expand Down

0 comments on commit 4ce4040

Please sign in to comment.