diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 704e0015a0378cf9bf0515eb876c65f019f4e86b..e136930a81a0a6ab1fba8c9b578069c3b4c70eb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ stages: - "Code Quality" - - pretest - - test - - prerelease + - "Tests" + - "Prerelease-Tests" + - integration - nightly - docs - deploy @@ -25,11 +25,25 @@ stages: rules: - if: $CI_PIPELINE_SOURCE == "schedule" -# -------------------------- Pre Tests -------------------------------------------------------------------------------- +# -------------------------- Code Quality -------------------------------------------------------------------------------- + + +# Linter for code formatting +flake8-lint: + stage: "Code Quality" + extends: .every-commit + image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine + script: + - nox -s lint + tags: + - docker + + +# -------------------------- Tests -------------------------------------------------------------------------------- # Normal test - runs on every commit all but "long run" tests testsuite-cuda-py3.10: - stage: pretest + stage: "Tests" extends: .every-commit image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12.6 needs: [] @@ -53,21 +67,19 @@ testsuite-cuda-py3.10: path: coverage.xml junit: report.xml -# Test against latest pystencils 2.0 development version -pystencils-2.0dev: - stage: pretest + +testsuite-cpu-py3.13: + stage: "Tests" extends: .every-commit - image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12.6 - allow_failure: true + image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine needs: [] script: - mkdir -p ~/.config/matplotlib - echo "backend:template" > ~/.config/matplotlib/matplotlibrc - - nox -s "tests_pystencils2(cupy12)" + - nox -s "testsuite_cpu-3.13" tags: - docker - AVX - - cuda11 artifacts: when: always paths: @@ -75,9 +87,10 @@ pystencils-2.0dev: reports: junit: report.xml + # Normal test with longruns tests-and-coverage-with-longrun: - stage: test + stage: "Tests" when: manual allow_failure: true image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full @@ -96,102 +109,43 @@ tests-and-coverage-with-longrun: - cuda11 - AVX -# Linter for code formatting -flake8-lint: - stage: "Code Quality" - extends: .every-commit - image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine - script: - - nox -s lint - tags: - - docker - -# -------------------------- Tests ------------------------------------------------------------------------------------- +# -------------------------- Nightly and Pre-Release Tests -------------------------------------------------------------------------------- -# pipeline with latest python version -latest-python: - stage: test +# Test against latest pystencils 2.0 development version +pystencils-2.0dev: + stage: "Prerelease-Tests" extends: .every-commit - image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python - before_script: - - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils + image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:ubuntu24.04-cuda12.6 + allow_failure: true + needs: [] script: - - env - - pip list - - export NUM_CORES=$(nproc --all) - mkdir -p ~/.config/matplotlib - echo "backend:template" > ~/.config/matplotlib/matplotlibrc - - mkdir public - - py.test -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml + - nox -s "testsuite_pystencils2(cupy12)" tags: - docker - AVX + - cuda11 artifacts: when: always + paths: + - test-report reports: junit: report.xml -# Minimal tests in windows environment -#minimal-windows: -# stage: test -# except: -# variables: -# - $ENABLE_NIGHTLY_BUILDS -# tags: -# - win -# script: -# - export NUM_CORES=$(nproc --all) -# - export MPLBACKEND=Agg -# - source /cygdrive/c/Users/build/Miniconda3/Scripts/activate -# - source activate pystencils -# - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils -# - python -c "import numpy" -# - pip install sympy==1.9 -# - py.test -v -m "not (notebook or longrun)" - minimal-sympy-master: - stage: test + stage: "Prerelease-Tests" extends: .every-commit - image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda - before_script: - - pip install -e . + image: i10git.cs.fau.de:5005/pycodegen/pycodegen/nox:alpine script: - - pip install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils - - python -m pip install --upgrade git+https://github.com/sympy/sympy.git - - pip list - - python quicktest.py + - nox -s quicktest -- --sympy-master allow_failure: true tags: - docker - - cuda - -ubuntu: - stage: test - extends: .every-commit - image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu - before_script: - # - apt-get -y remove python3-sympy - - ln -s /usr/include/locale.h /usr/include/xlocale.h - # - pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'` - - pip3 install git+https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pystencils.git@master#egg=pystencils - script: - - export NUM_CORES=$(nproc --all) - - mkdir -p ~/.config/matplotlib - - echo "backend:template" > ~/.config/matplotlib/matplotlibrc - - env - - pip3 list - - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml - tags: - - docker - - cuda11 - artifacts: - when: always - reports: - junit: report.xml pycodegen-integration: image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full - stage: test + stage: integration when: manual allow_failure: true script: diff --git a/noxfile.py b/noxfile.py index 6b890236b18c6b8345880d0578b1487a60384ca0..9e723b9a47f5f7f8de09b79086219b5aa1d1cbe1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,6 @@ from __future__ import annotations from typing import Sequence +from argparse import ArgumentParser import os import nox @@ -74,6 +75,9 @@ def install_pystencils_master(session: nox.Session): session.install("git+https://i10git.cs.fau.de/pycodegen/pystencils.git@master") +def install_sympy_master(session: nox.Session): + session.install("git+https://i10git.cs.fau.de/pycodegen/pystencils.git@master") + @nox.session(python="3.10", tags=["qa", "code-quality"]) def lint(session: nox.Session): """Lint code using flake8""" @@ -128,7 +132,7 @@ def testsuite_gpu(session: nox.Session, cupy_version: str | None): @nox.parametrize("cupy_version", [None, "12", "13"], ids=["cpu", "cupy12", "cupy13"]) @nox.session(python="3.10", tags=["test"]) -def tests_pystencils2(session: nox.Session, cupy_version: str | None): +def testsuite_pystencils2(session: nox.Session, cupy_version: str | None): if cupy_version is not None: install_cupy(session, cupy_version, skip_if_no_cuda=True) @@ -136,3 +140,18 @@ def tests_pystencils2(session: nox.Session, cupy_version: str | None): editable_install(session, ["alltrafos", "use_cython", "interactive", "tests"]) run_testsuite(session) + + +@nox.session +def quicktest(session: nox.Session): + parser = ArgumentParser() + parser.add_argument("--sympy-master", action="store_true", help="Use latest SymPy master revision") + args = parser.parse_args(session.posargs) + + install_pystencils_master(session) + editable_install(session) + + if args.sympy_master: + install_sympy_master(session) + + session.run("python", "quicktest.py")