Add Fortran ErrorV and associated wrapping code #191
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| jobs: | |
| mypy: | |
| if: ${{ !github.event.pull_request.draft }} | |
| strategy: | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| python-version: [ "3.9" ] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| uv-dependency-install-flags: "--all-extras --group dev" | |
| - name: mypy | |
| run: | | |
| MYPYPATH=stubs uv run --no-sync mypy src | |
| docs: | |
| if: ${{ !github.event.pull_request.draft }} | |
| strategy: | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| python-version: [ "3.11" ] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| uv-dependency-install-flags: "--all-extras --group docs" | |
| - name: Install Graphviz | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y graphviz | |
| - name: docs | |
| run: | | |
| uv run --no-sync mkdocs build --strict | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: "3.11" | |
| uv-dependency-install-flags: "--all-extras --group docs --group dev" | |
| - name: docs-with-changelog | |
| run: | | |
| # Check CHANGELOG will build too | |
| uv run --no-sync towncrier build --yes | |
| uv run --no-sync mkdocs build --strict | |
| # Just in case, undo the staged changes | |
| git restore --staged . && git restore . | |
| urls: | |
| if: ${{ !github.event.pull_request.draft }} | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: check-urls-are-valid | |
| uses: lycheeverse/lychee-action@v2 | |
| with: | |
| # Exclude local links | |
| # and the template link in pyproject.toml | |
| # Don't check for conda-forge while we haven't released there | |
| # Don't check https://www.readthedocs.org/ as it hits rate limits | |
| args: "--exclude 'file://' --exclude '^https://github\\.com/openscm/example-fgen-basic/pull/\\{issue\\}$' --exclude '^https://github.com/conda-forge/example-fgen-basic-feedstock$' --exclude '^https://www.readthedocs.org/$' ." | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| # Test against all security and bugfix versions: https://devguide.python.org/versions/ | |
| python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
| include: | |
| # Test other OS's for a 'very stable' Python version too | |
| - os: "windows-latest" | |
| python-version: "3.11" | |
| - os: "macos-latest" | |
| python-version: "3.11" | |
| # Include other OS for latest Python | |
| # because these seem to be the flakiest from experience | |
| # so are worth the extra testing | |
| - os: "windows-latest" | |
| python-version: "3.13" | |
| - os: "macos-latest" | |
| python-version: "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 | |
| - name: Install Fortran compiler - MacOS | |
| # When building on Mac, we need to have a Fortran compiler | |
| if: ${{ startsWith(matrix.os, 'macos') }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| id: setup-fortran-macos | |
| with: | |
| # TODO: figure out whether we need/want to use other compilers too | |
| compiler: "gcc" | |
| version: "13" | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # When running the tests, install with all optional dependencies | |
| # to get maximum test coverage. | |
| # If we find that we're getting failures | |
| # when people try to run without installing optional dependencies, | |
| # we should add a CI step that runs the tests without optional dependencies too. | |
| # We don't have that right now, because we're not sure this pain point exists. | |
| uv-dependency-install-flags: "-v --reinstall-package example-fgen-basic -Ccompile-args='-v' --all-extras --group tests " | |
| - name: Run tests | |
| run: | | |
| COV_DIR=`uv run --no-sync python -c 'from pathlib import Path; import example_fgen_basic; print(Path(example_fgen_basic.__file__).parent)'` | |
| uv run --no-sync pytest -r a -v tests src --doctest-modules --doctest-report ndiff --cov=${COV_DIR} --cov-report=term-missing --cov-report=xml | |
| uv run --no-sync coverage report | |
| - name: Upload coverage reports to Codecov with GitHub Action | |
| uses: codecov/[email protected] | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| tests-resolution-strategies: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Only test on ubuntu here for now. | |
| # We could consider doing this on different platforms too, | |
| # although that probably belongs better with the PyPI tests. | |
| os: [ "ubuntu-latest" ] | |
| # Tests with lowest direct resolution. | |
| # We don't do lowest because that is essentially testing | |
| # whether downstream dependencies | |
| # have set their minimum support dependencies correctly, | |
| # which isn't our problem to solve. | |
| resolution-strategy: [ "lowest-direct" ] | |
| # Only test against the oldest supported python version | |
| # because python is itself a direct dependency | |
| # (so we're testing against the lowest direct python too). | |
| python-version: [ "3.9" ] | |
| 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 | |
| - name: Setup uv | |
| id: setup-uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "0.8.8" | |
| python-version: ${{ matrix.python-version }} | |
| - name: Create venv | |
| run: | | |
| uv venv --seed | |
| - name: Install dependencies | |
| run: | | |
| uv pip install --requirements requirements-only-tests-locked.txt | |
| uv pip compile --python ${{ matrix.python-version }} --resolution ${{ matrix.resolution-strategy }} --all-extras pyproject.toml -o requirements-tmp.txt | |
| uv pip install --requirements requirements-tmp.txt . | |
| - name: Run tests | |
| run: | | |
| uv run --no-sync pytest tests -r a -v | |
| tests-without-extras: | |
| # Run the tests without installing extras. | |
| # This is just a test to make sure to avoid | |
| # breaking our test PyPI install workflow. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| # Just test against one Python version, this is just a helper. | |
| # The real work happens in the test PyPI install | |
| python-version: [ "3.11" ] | |
| 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 | |
| - name: Set up Python "${{ matrix.python-version }}" | |
| id: setup-python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "${{ matrix.python-version }}" | |
| - name: Install | |
| run: | | |
| pip install --upgrade pip wheel | |
| pip install --no-deps . | |
| pip install -r requirements-locked.txt | |
| pip install -r requirements-only-tests-min-locked.txt | |
| - name: Run tests | |
| run: | | |
| pytest tests -r a -vv tests | |
| imports-without-extras: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| # Test against all security and bugfix versions: https://devguide.python.org/versions/ | |
| python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python "${{ matrix.python-version }}" | |
| id: setup-python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "${{ matrix.python-version }}" | |
| - name: Install | |
| run: | | |
| pip install --upgrade pip wheel | |
| pip install . | |
| - name: Check importable without extras | |
| run: python scripts/test-install.py | |
| check-build: | |
| strategy: | |
| matrix: | |
| # The tests are also effectively a test of the build (at least the Fortran compilation). | |
| # This test is really just about checking what is packaged | |
| # and that we have all the required pieces. | |
| # Hence, for now, only test on ubuntu | |
| # (little value testing on other OS's because this test is not testing compilation directly). | |
| os: [ "ubuntu-latest" ] | |
| python-version: [ "3.11" ] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| uv-dependency-install-flags: "--group dev" | |
| - name: Build package | |
| run: | | |
| uv run --no-sync python scripts/add-locked-targets-to-pyproject-toml.py | |
| cat pyproject.toml | |
| uv build --sdist | |
| # Just in case, undo the changes to `pyproject.toml` | |
| git restore --staged . && git restore . | |
| - name: Check included files in source distribution | |
| run: | | |
| tar -tvf dist/example_fgen_basic-*.tar.gz --wildcards '*example_fgen_basic/py.typed' | |
| tar -tvf dist/example_fgen_basic-*.tar.gz --wildcards 'example_fgen_basic-*/LICENCE' | |
| - name: Check source distribution can be used for installation | |
| run: | | |
| cd dist | |
| ls | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install example_fgen_basic* | |
| python -c 'from example_fgen_basic.get_wavelength import get_wavelength_plain; print(get_wavelength_plain(23.4))' | |
| # check-build-wheel | |
| # For now, decide not to do this as odds of breaking the build are low | |
| # (and we already implicitly test this when running the tests). | |
| # If we find we are breaking the wheel build inadvertently often, | |
| # we can always add this step in. | |
| check-dependency-licences: | |
| strategy: | |
| matrix: | |
| os: [ "ubuntu-latest" ] | |
| python-version: [ "3.11" ] | |
| runs-on: "${{ matrix.os }}" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| uv-dependency-install-flags: "--group dev" | |
| - name: Check licences of dependencies | |
| shell: bash | |
| run: | | |
| TEMP_FILE=$(mktemp) | |
| uv export --no-dev > $TEMP_FILE | |
| uv run --no-sync liccheck -r $TEMP_FILE -R licence-check.txt | |
| cat licence-check.txt |