From b708982bdc5de84f7f823cddaca6aac9eb8583d8 Mon Sep 17 00:00:00 2001 From: Antony Lewis Date: Tue, 20 Aug 2024 22:49:00 +0100 Subject: [PATCH] github action and require python 3.8, numpy>1.23 --- .github/workflows/tests.yml | 75 +++++++++++++++++++++++++++++++++++ .gitignore | 1 - .travis.yml | 57 -------------------------- README.rst | 6 +-- getdist/__init__.py | 2 +- getdist/chains.py | 11 ----- getdist/tests/getdist_test.py | 4 +- pyproject.toml | 8 ++-- requirements.txt | 2 +- setup.py | 1 - 10 files changed, 86 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..61a9251 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,75 @@ +name: tests + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - name: "Latest Python 3.12" + os: ubuntu-latest + python-version: 3.12 + - name: "OS X Python 3.8" + os: macos-latest + python-version: 3.8 + - name: "Windows Python 3.8" + os: windows-latest + python-version: 3.8 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + + - name: flake8 Lint + if: matrix.os == 'ubuntu-latest' + uses: py-actions/flake8@v2 + with: + args: --select=E713,E704,E703,E714,E10,E11,E20,E22,E23,E25,E27,E301,E302,E304,E9,F405,F406,F5,F6,F7,F8,W1,W2,W3,W6 --show-source --statistics + path: getdist + max-line-length: "120" + + - name: Install dependencies + run: | + python --version + pip install . + git clone --depth=1 https://github.com/cmbant/getdist_testchains + + - name: Run tests + run: | + getdist --help + python -m unittest getdist.tests.getdist_test + + deploy: + needs: build + runs-on: ubuntu-latest + if: github.repository_owner == 'cmbant' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U build twine + + - name: Build package + run: python -m build --sdist + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + diff --git a/.gitignore b/.gitignore index a576ae3..4f8b307 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ __pycache__/ *$py.class # Distribution / packaging -.* env/ build/ develop-eggs/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10e0b89..0000000 --- a/.travis.yml +++ /dev/null @@ -1,57 +0,0 @@ -os: linux -language: python -dist: bionic -git: - depth: false - - -jobs: - include: - - env: - - CHANNEL="defaults" - - PYDIST="ANACONDA" - python: "3.7" - - env: - - CHANNEL="conda-forge" - - PYDIST="ANACONDA" - python: "3.10" - - name: "3.8 with focal" - dist: focal - python: "3.8" - - name: "3.12 with jammy" - dist: jammy - python: "3.12" - - -install: - # Setup anaconda following http://conda.pydata.org/docs/travis.html - - if [[ "$PYDIST" == "ANACONDA" ]]; then - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - bash miniconda.sh -b -p $HOME/miniconda; - export PATH="$HOME/miniconda/bin:$PATH"; - hash -r; - conda config --set always_yes yes --set changeps1 no; - conda info -a; - conda create -q -n test-environment -c $CHANNEL python=$TRAVIS_PYTHON_VERSION scipy matplotlib; - source activate test-environment; - fi - - python --version - - pip install . - - pip install PyYAML flake8 - - getdist --help - - git clone --depth=1 https://github.com/cmbant/getdist_testchains - -script: - - flake8 getdist --select=E713,E704,E703,E714,E10,E11,E20,E22,E23,E25,E27,E301,E302,E304,E9,F405,F406,F5,F6,F7,F8,W1,W2,W3,W6 --show-source --statistics - - python -m unittest getdist.tests.getdist_test - -deploy: - - provider: pypi - distributions: sdist - username: "__token__" - password: $PYPI_PASSWORD - on: - python: '3.8' - branch: master - repo: cmbant/getdist - tags: true diff --git a/README.rst b/README.rst index 6c6b9b6..8db12bf 100644 --- a/README.rst +++ b/README.rst @@ -7,8 +7,8 @@ GetDist :Source: https://github.com/cmbant/getdist :Reference: https://arxiv.org/abs/1910.13970 -.. image:: https://img.shields.io/travis/com/cmbant/getdist - :target: https://app.travis-ci.com/cmbant/getdist +.. image:: https://github.com/cmbant/getdist/actions/workflows/tests.yml/badge.svg + :target: https://github.com/cmbant/getdist/actions/workflows/tests.yml .. image:: https://img.shields.io/pypi/v/GetDist.svg?style=flat :target: https://pypi.python.org/pypi/GetDist/ .. image:: https://readthedocs.org/projects/getdist/badge/?version=latest @@ -63,7 +63,7 @@ the `Plot Gallery and tutorial =1.17.0", "matplotlib (>=2.2.0,!=3.5.0)", "scipy>=1.5", "PyYAML>=5.1", "packaging" + "numpy>=1.23.0", "matplotlib (>=2.2.0,!=3.5.0)", "scipy>=1.5", "PyYAML>=5.1", "packaging" ] [project.optional-dependencies] diff --git a/requirements.txt b/requirements.txt index f8aeba0..eea577e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy>=1.17.0 +numpy>=1.23.0 matplotlib>=2.2.0,!=3.5.0 scipy>=1.5.0 PyYAML>=5.1 diff --git a/setup.py b/setup.py index db07c91..217c788 100644 --- a/setup.py +++ b/setup.py @@ -94,5 +94,4 @@ def run(self): platforms="any", package_data=package_data, packages=["getdist", "getdist.gui", "getdist.tests", "getdist.styles"], - test_suite="getdist.tests", cmdclass=cmd_class)