Skip to content

Commit

Permalink
cache hdf5 in python ci
Browse files Browse the repository at this point in the history
  • Loading branch information
DanW97 committed Nov 7, 2024
1 parent 90abfa4 commit fae7c73
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/docs-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,36 @@ concurrency:

jobs:
build-python-docs:
strategy:
fail-fast: true
matrix:
python-version: ['3.12']

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
uv venv -p ${{ matrix.python-version }}
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV
- name: Install Python dependencies
working-directory: docs
run: uv pip install -r requirements-docs.txt

# Cache HDF5
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Cache apt packages
with:
packages: libhdf5-dev
version: 1.0

- name: Install up4
run: uv pip install .

- name: Build Python documentation
working-directory: docs
run: make html
Expand Down
28 changes: 2 additions & 26 deletions .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# If rustup is a valid command, we can assume that rust is installed,
# this is to mainly assist with testing locally via act.
- name: Determine if Rust is installed
run: |
if ! command -v rustup &> /dev/null
then
echo "RUNNING_LOCALLY=1" >> $GITHUB_ENV
else
echo "RUNNING_LOCALLY=0" >> $GITHUB_ENV
fi
# Rust doesn't already exist - need to install rustup and
# update apt packages to install libhdf5-dev locally
# (https://github.com/awalsh128/cache-apt-pkgs-action/issues/125)
- if: env.RUNNING_LOCALLY == '1'
name: Install Rust
uses: actions-rs/toolchain@v1
with: {toolchain: 'stable', profile: minimal, override: true}

- if: env.RUNNING_LOCALLY == '1'
run: sudo apt-get update

# Rust already exists, so we can skip the installation
- if: env.RUNNING_LOCALLY == '0'
name: Set up Rust

- name: Set up Rust
run: rustup override set stable && rustup update

- uses: awalsh128/cache-apt-pkgs-action@latest
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
test-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.11', '3.12']
Expand All @@ -56,13 +56,13 @@ jobs:
env:
BIN: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }}
run: |
python -m venv .venv
python3 -m pip install uv
uv venv -p ${{ matrix.python-version }}
echo "$GITHUB_WORKSPACE/.venv/$BIN" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
pip install uv
uv pip install -r requirements.txt -r requirements_test.txt
- name: Set up Rust
Expand All @@ -72,9 +72,16 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref_name == 'uPPPP' }}

# Cache HDF5
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Cache apt packages
with:
packages: libhdf5-dev
version: 1.0

- name: Install up4
run: pip install .
run: uv pip install .

# TODO add doctests
# - name: Run doctests
Expand All @@ -83,7 +90,9 @@ jobs:
# python tests/docs/run_doctest.py

- name: Run tests
run: python3 -m pytest tests/test_all.py
env:
BIN: ${{ matrix.os == 'windows-latest' && 'Scripts/python.exe' || 'bin/python' }}
run: $VIRTUAL_ENV/$BIN -m pytest tests/test_all.py

- name: Trigger docs build and deploy
uses: peter-evans/repository-dispatch@v3
Expand Down

0 comments on commit fae7c73

Please sign in to comment.