Skip to content

fix: Specify source type for readthedocs #103

fix: Specify source type for readthedocs

fix: Specify source type for readthedocs #103

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [main]
tags: ['v*']
jobs:
mypy:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: mypy
run: make mypy
pre-commit:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: pre-commit
run: make pre-commit
docs:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
env:
REF_DATA_ROOT: ${{ github.workspace }}/.esgpull/data
REF_OUTPUT_ROOT: ${{ github.workspace }}/out
REF_DATABASE_URL: "sqlite:///${{ github.workspace }}/.ref/db/ref.db"
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Cache test data
id: cache-test-data
uses: actions/cache@v4
with:
path: .esgpull
key: test-data-${{ hashFiles('scripts/fetch_test_data.py') }}
- if: ${{ steps.cache-test-data.outputs.cache-hit != 'true' }}
run: |
echo "Rerun after cache generation in tests job"
exit 1
- name: docs
run: |
mkdir -p ${{ github.workspace }}/.ref/db
uv run ref ingest --source-type cmip6 .esgpull/data
uv run mkdocs build --strict
tests:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
defaults:
run:
# This might be needed for Windows and doesn't seem to affect unix-based systems
# so we include it. If you have better proof of whether this is needed or not,
# feel free to update.
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
# Share a cache of test data across all test jobs
- name: Cache test data
id: cache-test-data
uses: actions/cache@v4
with:
path: .esgpull
key: test-data-${{ hashFiles('scripts/fetch_test_data.py') }}
- name: Install esgpull
run: |
uv run esgpull self install .esgpull || uv run esgpull self choose .esgpull
- if: ${{ steps.cache-test-data.outputs.cache-hit != 'true' }}
name: Fetch the test data
run: |
uv run esgpull config api.index_node esgf-node.llnl.gov
make fetch-test-data
- name: Run tests
run: |
uv run --package ref pytest packages/ref -r a -v --doctest-modules --cov=packages/ref/src --cov-report=term
uv run --package ref-core pytest packages/ref-core -r a -v --doctest-modules --cov=packages/ref-core/src --cov-report=term
uv run --package ref-metrics-example pytest packages/ref-metrics-example -r a -v --doctest-modules --cov=packages/ref-metrics-example/src --cov-report=term --cov-append
uv run coverage xml
# Run integration tests (without adding to the coverage)
uv run pytest tests -r a -v
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
imports-without-extras:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- name: Check importable without extras
run: uv run --package ref-core python scripts/test-install.py
# Check if a changelog message was added to the PR
# Only runs on pull requests
check-for-changelog:
runs-on: ubuntu-latest
if: github.event.pull_request
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get all changelog files
id: changed-changelog-files
uses: tj-actions/changed-files@v45
with:
# Avoid using single or double quotes for multiline patterns
files: |
changelog/*.md
- name: Print out the changed files
if: steps.changed-files-specific.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-changelog-files.outputs.all_changed_files }}
run: |
make changelog-draft
- name: Fail if no changelog message is present
if: steps.changed-changelog-files.outputs.any_changed == 'false'
run: |
echo "No changelog present."
exit 1