Skip to content

Commit

Permalink
Merge pull request #52 from ocefpaf/fix_cis
Browse files Browse the repository at this point in the history
Use pixi for CIs
  • Loading branch information
ocefpaf authored Sep 17, 2024
2 parents 0d3cbf5 + cfaa161 commit d7b683d
Show file tree
Hide file tree
Showing 8 changed files with 16,800 additions and 89 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
37 changes: 7 additions & 30 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,18 @@ on:
- published

jobs:
build-docs:
run:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
fetch-depth: 0
manifest-path: pyproject.toml

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=3 pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge
- name: Install ciso
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall
- name: Build documentation
shell: bash -l {0}
run: |
set -e
jupyter nbconvert --to notebook --execute notebooks/ciso_unstructure.ipynb --output=ciso_unstructure-output.ipynb
jupyter nbconvert --to notebook --execute notebooks/ciso_c_grid.ipynb --output=ciso_c_grid-output.ipynb
mv notebooks/*output.ipynb docs/source/
pushd docs
make clean html linkcheck
popd
- name: Run Tests
run: pixi run --environment py312 docs

- name: Deploy
if: success() && github.event_name == 'release'
Expand Down
46 changes: 13 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,28 @@ name: Tests
on:
pull_request:
push:
branches: [main]
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, ubuntu-latest, macos-latest]
experimental: [false]
include:
- python-version: "3.12"
os: "ubuntu-latest"
experimental: true
pixi-environment: [ py310, py311, py312 ]
os: [ windows-latest, ubuntu-latest, macos-latest ]
fail-fast: false
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: Setup Micromamba ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge
- name: Install unstable dependencies
if: matrix.experimental == true
run: |
micromamba install conda-forge/label/numpy_dev::numpy
- name: Install ciso
run: |
python -m pip install -e . --no-deps --force-reinstall
manifest-path: pyproject.toml

- name: Tests
run: |
python -m pytest -rxs ciso/tests
- name: Run Tests
run: pixi run --environment ${{ matrix.pixi-environment }} test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ _ciso*.so
build/
ciso/_version.py
dist/
# pixi environments
.pixi
*.egg-info
16,727 changes: 16,727 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

53 changes: 48 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ requires = [
"setuptools>=41.2",
"setuptools-scm",
"cython>=3",
"oldest-supported-numpy ; python_version < '3.9'",
"numpy>=2.0.0rc1 ; python_version >= '3.9'",
"numpy>=2",
"wheel",
]
build-backend = "setuptools.build_meta"
Expand All @@ -18,11 +17,10 @@ authors = [
{email = "hetland@tamu.edu"},
{name = "Robert Hetland"}
]
requires-python = ">=3.9"
requires-python = ">=3.10"
license = {text = "BSD-2-Clause"}
dependencies = [
"oldest-supported-numpy ; python_version < '3.9'",
"numpy>=2.0.0rc1 ; python_version >= '3.9'",
"numpy",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -79,3 +77,48 @@ exclude = ["setup.py", "docs", "tests"]
verbose = 1
quiet = false
color = true

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-64"]

[tool.pixi.environments]
default = { features = ["py312"], solve-group = "py312" }
py312 = { features = ["py312"], solve-group = "py312" }
py311 = ["py311"]
py310 = ["py310"]

[tool.pixi.tasks]
install-pre-commit = "pre-commit install"
pre-commit = "pre-commit run --all-files"
test = "pip install -e . --no-deps --force-reinstall && pytest -rxs ciso/tests"
docs = """\
pip install -e . --no-deps --force-reinstall
&& jupyter nbconvert --to notebook --execute notebooks/ciso_unstructure.ipynb --output=ciso_unstructure-output.ipynb
&& jupyter nbconvert --to notebook --execute notebooks/ciso_c_grid.ipynb --output=ciso_c_grid-output.ipynb
&& mv notebooks/*output.ipynb docs/source/
&& cd docs
&& make clean html linkcheck
"""

[tool.pixi.feature.py312.dependencies]
python = "3.12.*"

[tool.pixi.feature.py311.dependencies]
python = "3.11.*"

[tool.pixi.feature.py310.dependencies]
python = "3.10.*"

[tool.pixi.dependencies]
cython = ">=3.0.11,<4"
numpy = ">1.19"
pytest = ">=8.3.3,<9"
pre-commit = ">=3.8.0,<4"
gridgeo = ">=1.5.2,<2"
jupyter = ">=1.1.1,<2"
nbsphinx = ">=0.9.5,<0.10"
sphinx = ">=8.0.2,<9"
pip = ">=24.2,<25"
scitools-iris = ">=3.9.0,<4"
nbclassic = ">=1.1.0,<2"
19 changes: 0 additions & 19 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit d7b683d

Please sign in to comment.