Package with Hatch #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Tests | |
on: [pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
# Checkout the latest commit associated with the PR | |
- uses: actions/checkout@v4 | |
- name: Debug matrix value | |
run: echo "Python version is ${{ matrix.python-version }}" | |
# Set up Miniconda | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true # Optional: update Conda to the latest version | |
python-version: ${{ matrix.python-version }} | |
# Create and activate the Conda environment using the environment.yml file | |
- name: Create and activate Conda environment | |
run: | | |
conda env create -f environment.yml -n test-env | |
conda activate test-env | |
shell: bash -l {0} # Use bash with the login shell to activate Conda | |
# Install any additional dependencies not listed in environment.yml | |
- name: Install additional dependencies | |
run: | | |
conda activate test-env | |
pip install '.[tests]' # Install all dependencies, including test-specific ones | |
shell: bash -l {0} | |
# Run pytest on the specified directory | |
- name: Run tests | |
run: | | |
conda activate test-env | |
pytest tests | |
shell: bash -l {0} | |