Skip to content

Commit

Permalink
[ci] use uv to manage Python and pip dependencies
Browse files Browse the repository at this point in the history
The GitHub-provided setup-python action does not create portable
binaries and can cause failure for bitstream cache. Instead, ask
uv to manage our dependencies.

Signed-off-by: Gary Guo <[email protected]>
  • Loading branch information
nbdd0121 committed Oct 14, 2024
1 parent 7d3d80a commit d1e0f5f
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: Path at which to install Verible
required: true
default: /tools/verible
venv-path:
description: Path at which to place Python venv
required: true
default: ~/.local/share/venv

runs:
using: composite
Expand All @@ -32,15 +36,29 @@ runs:
grep '^[^#]' apt-requirements.txt | xargs sudo apt install -y
shell: bash

- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v3
with:
python-version: '3.8'
cache-dependency-path: python-requirements.txt
cache: pip
version: '0.4.20'
enable-cache: true
cache-dependency-glob: |
pyproject.toml
python-requirements.txt
- name: Install Python
shell: bash
run: |
uv python install 3.8
# Create a virtual environment for UV
uv venv ${{ inputs.venv-path }}
echo "${{ inputs.venv-path }}/bin" >> "$GITHUB_PATH"
echo "VIRTUAL_ENV=${{ inputs.venv-path }}" >> "$GITHUB_ENV"
- name: Install Python dependencies
run: python3 -m pip install -r python-requirements.txt --require-hashes
shell: bash
run: |
uv pip install -r python-requirements.txt --require-hashes
# We installed uv from setup-uv action, so uninstall from venv to prevent conflict
uv pip uninstall uv
- name: Install Verilator
run: |
Expand Down

0 comments on commit d1e0f5f

Please sign in to comment.