Skip to content

Commit

Permalink
Update Rust and add setup-uv (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn authored Oct 15, 2024
1 parent c3f8520 commit 5c0cadf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ inputs:
description: Comma-separated list of components to be additionally installed for a new toolchain
required: false
default: clippy, rustfmt
targets:
description: Comma-separated list of targets to be additionally installed for a new toolchain
required: false
default: ""
sccache:
description: "Enable sccache"
required: false
default: "true"

runs:
using: "composite"
Expand All @@ -22,6 +30,7 @@ runs:
with:
toolchain: "${{ steps.rust-version.outputs.version }}"
components: ${{ inputs.components }}
targets: ${{ inputs.targets }}

- name: Rust Dependency Cache
uses: Swatinem/rust-cache@v2
Expand All @@ -31,10 +40,11 @@ runs:

- name: Rust Compile Cache
uses: mozilla-actions/sccache-action@v0.0.6
if: ${{ inputs.sccache == 'true' }}

- name: Rust Compile Cache Config
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
${{ inputs.sccache == 'true' && 'echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV' || '' }}
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
34 changes: 34 additions & 0 deletions .github/actions/setup-uv/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Setup Python UV"
description: "Toolchain setup for Python UV"

inputs:
sync:
description: "Sync the project"
required: false
default: "true"

runs:
using: "composite"
steps:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.18"
enable-cache: true

- name: "Setup up Python"
shell: bash
run: uv python install

- name: Install the project
if: ${{ inputs.sync == 'true' }}
shell: bash
run: uv sync --all-extras --dev -v
env:
MATURIN_PEP517_USE_BASE_PYTHON: "true"
# Keep this constant to avoid pyo3 invalidating itself
PYO3_ENVIRONMENT_SIGNATURE: "cpython3"

- name: Export Path
shell: bash
run: echo "PATH=$PATH" >> $GITHUB_ENV

0 comments on commit 5c0cadf

Please sign in to comment.