Skip to content

test: book url

test: book url #482

Workflow file for this run

# GitHub Actions Workflow: Python Tests with Caching
# This workflow automates running tests on Python code using pytest and speeds up the process using caching.
name: Tests
on:
push:
branches:
- dev # Run tests on pushes to the dev branch
- main # Run tests on pushes to the main branch
pull_request:
branches:
- main # Run tests on pull requests targeting the main branch
workflow_dispatch: # Enables manual execution from the Actions tab
jobs:
test:
runs-on: ubuntu-latest # Use the latest Ubuntu runner provided by GitHub
strategy:
matrix:
python-version: [ 3.11 ] # Python version to run
steps:
# Step 1: Checkout the repository's code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Step 3: Cache pip dependencies to speed up installs
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip # Path to cache
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('Makefile') }} # Unique cache key based on the OS, Python version, and Makefile hash
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
# Step 4: Install system-level dependencies required by the project
- name: Install system dependencies
run: |
sudo apt-get update && sudo apt-get install -y python3-dev graphviz libgraphviz-dev pkg-config
pip install pygraphviz
# Step 5: Install Python dependencies using make and run tests
- name: Install dependencies with Makefile and run tests
run: |
python -m pip install --upgrade pip # Upgrade pip to the latest version
make test # Install dependencies using the Makefile
# Step 6: Cache installed packages for system dependencies
- name: Cache pygraphviz dependencies
uses: actions/cache@v3
with:
path: /usr/local/lib/python3.11/dist-packages # Path to cache the installed system dependencies
key: pygraphviz-${{ runner.os }}-python3.11
restore-keys: |
pygraphviz-${{ runner.os }}-