Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust and add setup-uv #3

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
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
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