From 4c63efad8d53525d242399937992230062e7e786 Mon Sep 17 00:00:00 2001 From: Joe Shannon Date: Mon, 14 Mar 2022 17:02:39 +0000 Subject: [PATCH] Migrate from Travis to GitHub actions Travis.org is no longer building. The Jython setup has had to be modified as pip does not work in the current version of Jython see: https://github.com/jython/jython/issues/97 In addition pytest has been updated to version 4 requiring changes to parameterised tests. --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++ .travis.yml | 21 --------------- README.rst | 6 ++--- README_template.rst | 6 ++--- install-jython-environment.sh | 49 ++++++++++++++++++++++++++++++++--- 5 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..82d63f3e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: Diffcalc build + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + flavour: ['python', 'jython'] + python-version: [2.7] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + if: matrix.flavour == 'python' + + - name: Install Python packages + run: | + pip install pytest==4.6.11; pip install pytest-xdist==1.26.1; pip install scipy==1.0.0; pip install nose==1.3.7 + echo "PYTEST=pytest -W ignore::PendingDeprecationWarning" >> $GITHUB_ENV + if: matrix.flavour == 'python' + + - name: Install Jython + run: | + source install-jython-environment.sh + echo "PYTEST=$HOME/jython/bin/jython -m pytest" >> $GITHUB_ENV + echo "CLASSPATH=$PWD/jama-1.0.3.jar:$PWD/commons-math3-3.6.1.jar" >> $GITHUB_ENV + if: matrix.flavour == 'jython' + + - name: Tests + run: | + echo Running $PYTEST + $PYTEST diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 74f0cbf9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -# based on https://www.topbug.net/blog/2012/05/27/use-travis-ci-with-jython/ - -language: python - -python: - - "2.7" - -env: - - JYTHON=false - - JYTHON=true - -install: - - if [ "$JYTHON" == "true" ]; then . install-jython-environment.sh; fi - - if [ "$JYTHON" == "false" ]; then pip install pytest==3.10.1; pip install pytest-xdist==1.26.1; pip install scipy==1.0.0;fi - -before_script: - - if [ "$JYTHON" == "true" ]; then export PYTEST=$HOME/jython/bin/pytest; else export PYTEST="pytest -W ignore::PendingDeprecationWarning"; fi - - echo PYTEST:- $PYTEST - -script: $PYTEST - diff --git a/README.rst b/README.rst index 95f0ad3a..2ad2a090 100644 --- a/README.rst +++ b/README.rst @@ -7,10 +7,10 @@ same task as the fourc, sixc, twoc, kappa, psic and surf macros from SPEC. There is a `user guide `_ and `developer guide `_, both at `diffcalc.readthedocs.io `_ -|Travis| |Read the docs| +|GH Actions| |Read the docs| -.. |Travis| image:: https://travis-ci.org/DiamondLightSource/diffcalc.svg?branch=master - :target: https://travis-ci.org/DiamondLightSource/diffcalc +.. |GH Actions| image:: https://github.com/DiamondLightSource/diffcalc/actions/workflows/main.yml/badge.svg?branch=master + :target: https://github.com/DiamondLightSource/diffcalc/actions :alt: Build Status .. |Read the docs| image:: https://readthedocs.org/projects/diffcalc/badge/?version=latest diff --git a/README_template.rst b/README_template.rst index f62cc5f0..179c8922 100644 --- a/README_template.rst +++ b/README_template.rst @@ -7,10 +7,10 @@ same task as the fourc, sixc, twoc, kappa, psic and surf macros from SPEC. There is a `user guide `_ and `developer guide `_, both at `diffcalc.readthedocs.io `_ -|Travis| |Read the docs| +|GH Actions| |Read the docs| -.. |Travis| image:: https://travis-ci.org/DiamondLightSource/diffcalc.svg?branch=master - :target: https://travis-ci.org/DiamondLightSource/diffcalc +.. |GH Actions| image:: https://github.com/DiamondLightSource/diffcalc/actions/workflows/main.yml/badge.svg?branch=master + :target: https://github.com/DiamondLightSource/diffcalc/actions :alt: Build Status .. |Read the docs| image:: https://readthedocs.org/projects/diffcalc/badge/?version=latest diff --git a/install-jython-environment.sh b/install-jython-environment.sh index c166906d..687dabc1 100755 --- a/install-jython-environment.sh +++ b/install-jython-environment.sh @@ -15,6 +15,49 @@ java -jar jython_installer.jar -s -d $HOME/jython # Install nose for Jython # TODO: move to a setup.py -$HOME/jython/bin/pip install nose -$HOME/jython/bin/pip install pytest==3.10.1 -$HOME/jython/bin/pip install pytest-xdist==1.26.1 +#$HOME/jython/bin/pip install nose==1.3.7 +#$HOME/jython/bin/pip install pytest==3.10.1 +#$HOME/jython/bin/pip install pytest-xdist==1.26.1 + + +# Download dependencies directly from Pypi +# as pip is currently broken (https://github.com/jython/jython/issues/97) + + +wget https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/a1/4e/c42167ba5c3192bed633726d39d7896cc55d4fa3ec4a1fb60cd3a53fc4c7/decorator-4.1.2-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/70/c7/e8cb4a537ee4fc497ac80a606a667fd1832f28ad3ddbfa25bf30473eae13/pytest-4.6.11-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/2c/a0/da5f49008ec6e9a658dbf5d7310a4debd397bce0b4db03cf8a410066bb87/atomicwrites-1.4.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/f6/f0/10642828a8dfb741e5f3fbaac830550a518a775c7fff6f04a007259b0548/py-1.11.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/be/be/7abce643bfdf8ca01c48afa2ddf8308c2308b0c3b239a44e57d020afa0ef/attrs-21.4.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/c1/f9/9058661f6b4bb017dfe17ef84b461e4b11130c7bbee1b35cc0883ec8533b/importlib_metadata-2.1.2-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/96/0a/67556e9b7782df7118c1f49bdc494da5e5e429c93aa77965f33e81287c8c/zipp-1.2.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/cf/e5/989798d38831a8505d62687c94b0f2954ff0a40782e25f9add8ed675dc1f/contextlib2-0.6.0-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/76/67/dc02c72177ec79f0176e5bf9921e9c1745a381ed556afb3b3ecc2bb8ba2e/pathlib2-2.3.6-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/f9/d0/6b7b38eaf9964510f5c32aa5aaf9f419864d2e0ebe34274e6cba5689a0c5/scandir-1.10.0-cp27-cp27m-win_amd64.whl +wget https://files.pythonhosted.org/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl +wget https://files.pythonhosted.org/packages/a4/a6/42f17d065bda1fac255db13afc94c93dbfb64393eae37c749b4cb0752fc7/more_itertools-5.0.0-py3-none-any.whl +wget https://files.pythonhosted.org/packages/99/4f/13fb671119e65c4dce97c60e67d3fd9e6f7f809f2b307e2611f4701205cb/nose-1.3.7-py2-none-any.whl + +unzip -d $HOME/jython/Lib/site-packages Pygments-2.2.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages decorator-4.1.2-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages pytest-4.6.11-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages six-1.16.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages atomicwrites-1.4.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages py-1.11.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages attrs-21.4.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages pluggy-0.13.1-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages importlib_metadata-2.1.2-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages zipp-1.2.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages contextlib2-0.6.0-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages configparser-4.0.2-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages pathlib2-2.3.6-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages scandir-1.10.0-cp27-cp27m-win_amd64.whl +unzip -d $HOME/jython/Lib/site-packages packaging-20.9-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages funcsigs-1.0.2-py2.py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages more_itertools-5.0.0-py3-none-any.whl +unzip -d $HOME/jython/Lib/site-packages nose-1.3.7-py2-none-any.whl