Skip to content

Commit

Permalink
ci: Use uv pip for faster build
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Feb 20, 2024
1 parent ac9fdd1 commit e6ce476
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/build_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,34 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
# Workaround; remove once https://github.com/astral-sh/uv/issues/1386 is fixed
- run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
- name: Install uv
run: pip install uv
- name: Install dependencies
# Only if the cache misses
# Based on https://github.com/pypa/pip/issues/8049#issuecomment-633845028
# read_requirements.py should be removed once
# https://github.com/pypa/pip/issues/11440 is resolved.
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install toml
# Remove old versions of pip
export site_packages=${Python_ROOT_DIR}/lib/python${{ matrix.python-version}}/site-packages
if [ "$RUNNER_OS" = "Linux" ]; then
rm -fr $site_packages/pip-23.0.1.dist-info
rm -fr $site_packages/pip-23.3.1.dist-info
elif [ "$RUNNER_OS" = "Windows" ]; then
rm -r -fo $site_packages/pip-23.0.1.dist-info
rm -r -fo $site_packages/pip-23.3.1.dist-info
else
# macos
rm -fr $site_packages/pip-23.2.1.dist-info
fi
uv pip install toml
python tests/read_requirements.py > requirements.txt
pip install -r requirements.txt
uv pip install -r requirements.txt
- name: Install Mesa
run: pip install --no-deps .
run: uv pip install --no-deps .
- name: Test with pytest
run: pytest --durations=10 --cov=mesa tests/ --cov-report=xml
- if: matrix.os == 'ubuntu'
Expand All @@ -90,18 +106,24 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: test-examples-pip-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
# Workaround; remove once https://github.com/astral-sh/uv/issues/1386 is fixed
- run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
- name: Install uv
run: pip install uv
- name: Install dependencies
# Only if the cache misses
# Based on https://github.com/pypa/pip/issues/8049#issuecomment-633845028
# read_requirements.py should be removed once
# https://github.com/pypa/pip/issues/11440 is resolved.
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install toml
rm -fr ${Python_ROOT_DIR}/lib/python${{ matrix.python-version}}/site-packages/pip-23.0.1.dist-info
rm -fr ${Python_ROOT_DIR}/lib/python${{ matrix.python-version}}/site-packages/pip-23.3.1.dist-info
uv pip install toml
python tests/read_requirements.py > requirements.txt
pip install -r requirements.txt
uv pip install -r requirements.txt
- name: Install Mesa
run: pip install --no-deps .
run: uv pip install --no-deps .
- name: Checkout mesa-examples
uses: actions/checkout@v4
with:
Expand Down

0 comments on commit e6ce476

Please sign in to comment.