Skip to content

patches

patches #376

Workflow file for this run

name: Testing
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
setup-build:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Cache MTH5 test files
uses: actions/cache@v4
with:
path: ~/.cache/aurora
key: mth5-test-files-${{ runner.os }}-${{ hashFiles('tests/conftest.py') }}
restore-keys: |
mth5-test-files-${{ runner.os }}-
- name: Create virtual environment and install dependencies
run: |
uv venv --python ${{ matrix.python-version }}
source .venv/bin/activate
uv pip install --upgrade pip
uv pip install 'setuptools<68'
uv pip install -e ".[dev,test]"
uv pip install mt_metadata[obspy]
# uv pip install "mt_metadata[obspy] @ git+https://github.com/kujaku11/mt_metadata.git@patches"
# uv pip install git+https://github.com/kujaku11/mth5.git@patches
# uv pip install "mt_metadata[obspy] @ git+https://github.com/kujaku11/mt_metadata.git"
# uv pip install git+https://github.com/kujaku11/mth5.git
uv pip install "mt_metadata[obspy]"
uv pip install mth5
# uv pip install mth5
uv pip install git+https://github.com/kujaku11/mth5_test_data.git
# Explicitly include nbconvert & ipykernel
uv pip install jupyter nbconvert nbformat ipykernel pytest pytest-cov pytest-timeout codecov
python -m ipykernel install --user --name "python3"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pandoc
- name: Run Tests
run: |
source .venv/bin/activate
pytest -s -v --cov=./ --cov-report=xml --cov=aurora -n auto tests
- name: "Upload coverage reports to Codecov"
uses: codecov/codecov-action@v4
with:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
flags: tests
# Note: these conditions won't match python-version 3.10; adjust if desired.
- name: Build Doc
if: ${{ (github.ref == 'refs/heads/main') && (matrix.python-version == '3.8') }}
run: |
source .venv/bin/activate
cd docs
make html
cd ..
- name: GitHub Pages
if: ${{ (github.ref == 'refs/heads/main') && (matrix.python-version == '3.8') }}
uses: crazy-max/[email protected]
with:
build_dir: docs/_build/html
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}