Skip to content

Attempt to cache tox environment #71

Attempt to cache tox environment

Attempt to cache tox environment #71

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Cache tox dir
id: cache-tox
uses: actions/cache@v4
env:
cache-name: cache-tox-data
with:
path: .tox
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('.tox/py310/.tox-info.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-tox.outputs.cache-hit != 'true' }}
name: List the state of tox
continue-on-error: true
run: ls -lha .tox/py310/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Dependencies
run: |
sudo apt update -qq
sudo apt install libudunits2-dev
- name: Install python dependencies
run: |
python -m pip install tox
- name: Run tox, only python 3.10
run: |
tox -e py310