diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..80735aee --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,69 @@ + +name: tests +#Running tests on all branches +on: [push,pull_request] + +jobs: + # This is a job for linux python3 tests + linuxpy3: + runs-on: [ubuntu-18.04] + container: + image: 'rootproject/root:latest' + steps: + - uses: actions/checkout@v2 + - name: Test with pytest + env: + COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS }} + run: | + yum install -y python-pip ghostscript + python -m pip install pytest + python -m pip install coveralls + python setup.py test + coveralls + + # This is a job for macOS python3 tests + macospy3: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Test with pytest + run: | + brew update + brew cask uninstall --force oclint + brew upgrade python cmake libpng libtiff + brew install --force ossp-uuid davix fftw fontconfig gd graphviz gsl lz4 tbb xrootd + curl -O https://clange.web.cern.ch/clange/root-v6.18.00.tar.gz + tar xzf root-v6.18.00.tar.gz + mkdir -p /usr/local/Cellar/root + mv 6.18.00 /usr/local/Cellar/root/ + cd /usr/local/Cellar/root/6.18.00 + export PATH=${PWD}/bin:${PATH} + export PYTHONPATH=${PWD}/lib/root:${PYTHONPATH} + export LD_LIBRARY_PATH=${PWD}/lib/root:${LD_LIBRARY_PATH} + echo ${PYTHONPATH} + cd - + python3 setup.py test && python3 -m pip install -e . && python3 -m pylint hepdata_lib/*.py + + + # This is a job for linux python2.7 tests + linuxpy27: + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2 + - name: Test with pytest + run: | + sudo apt-get install python2.7 + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools + curl -O https://root.cern.ch/download/root_v6.20.00.Linux-ubuntu16-x86_64-gcc5.4.tar.gz + tar xzf root_v6.20.00.Linux-ubuntu16-x86_64-gcc5.4.tar.gz + python -m pip install numpy==1.16.5 + sudo sed -i '/MVG/d' /etc/ImageMagick-6/policy.xml + sudo sed -i '/PDF/{s/none/read|write/g}' /etc/ImageMagick-6/policy.xml + sudo sed -i '/PDF/ a ' /etc/ImageMagick-6/policy.xml + python -m pip install --upgrade enum34 pytest_pylint configparser astroid coveralls + sudo apt update + sudo apt install -y ghostscript + source root/bin/thisroot.sh + python setup.py test + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6094d8af..00000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: python - -matrix: - include: - - os: linux - python: 2.7 - - os: osx - language: generic - - -before_install: - - travis_retry ./.travis/setup.sh - -install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd root; source bin/thisroot.sh; cd ..; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd /usr/local/Cellar/root/6.18.00/ && export PATH=${PWD}/bin:${PATH} && export PYTHONPATH=${PWD}/lib/root:${PYTHONPATH} && export LD_LIBRARY_PATH=${PWD}/lib/root:${LD_LIBRARY_PATH} && echo ${PYTHONPATH} && cd -; fi - -script: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then python setup.py test; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python3 setup.py test && python3 -m pip install -e . && python3 -m pylint hepdata_lib/*.py; fi - -after_success: - - coveralls - diff --git a/.travis/setup.sh b/.travis/setup.sh deleted file mode 100755 index 23f977af..00000000 --- a/.travis/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# fail script immediately on any errors in external commands -set -e - -source ./.travis/travis_wait.sh - -if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - brew update - brew cask uninstall --force oclint - brew upgrade python cmake libpng libtiff - # Install ROOT dependencies - brew install ossp-uuid davix isl libmpc gcc fftw freetype fontconfig webp gd graphviz gsl lz4 tbb xrootd - echo "Installing ROOT" - # travis_wait 45 brew install root - curl -O https://clange.web.cern.ch/clange/root-v6.18.00.tar.gz - tar xzf root-v6.18.00.tar.gz - mkdir -p /usr/local/Cellar/root - mv 6.18.00 /usr/local/Cellar/root/ - - pip3 install --upgrade enum34 pytest_pylint configparser astroid coveralls - -elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - curl -O https://root.cern.ch/download/root_v6.12.06.Linux-ubuntu14-x86_64-gcc4.8.tar.gz - tar xzf root_v6.12.06.Linux-ubuntu14-x86_64-gcc4.8.tar.gz - - sudo sed -i '/MVG/d' /etc/ImageMagick-6/policy.xml - sudo sed -i '/PDF/{s/none/read|write/g}' /etc/ImageMagick-6/policy.xml - sudo sed -i '/PDF/ a ' /etc/ImageMagick-6/policy.xml - - pip install --upgrade enum34 pytest_pylint configparser astroid coveralls - - sudo apt update - sudo apt install -y ghostscript -fi diff --git a/.travis/travis_wait.sh b/.travis/travis_wait.sh deleted file mode 100644 index 38f64066..00000000 --- a/.travis/travis_wait.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Taken from https://github.com/travis-ci/travis-build/blob/9edbf2a4330491dbd554b62b6a2cda25da97c7cb/lib/travis/build/templates/header.sh - -travis_wait() { - local timeout=$1 - if [[ $timeout =~ ^[0-9]+$ ]]; then - # looks like an integer, so we assume it's a timeout - shift - else - # default value - timeout=20 - fi - local cmd="$@" - local log_file=travis_wait_$$.log - $cmd &>$log_file & - local cmd_pid=$! - travis_jigger $! $timeout $cmd & - local jigger_pid=$! - local result - { - wait $cmd_pid 2>/dev/null - result=$? - ps -p$jigger_pid &>/dev/null && kill $jigger_pid - } - if [ $result -eq 0 ]; then - echo -e "\n${ANSI_GREEN}The command $cmd exited with $result.${ANSI_RESET}" - else - echo -e "\n${ANSI_RED}The command $cmd exited with $result.${ANSI_RESET}" - fi - echo -e "\n${ANSI_GREEN}Log:${ANSI_RESET}\n" - cat $log_file - return $result -} - -travis_jigger() { - # helper method for travis_wait() - local cmd_pid=$1 - shift - local timeout=$1 # in minutes - shift - local count=0 - # clear the line - echo -e "\n" - while [ $count -lt $timeout ]; do - count=$(($count + 1)) - echo -ne "Still running ($count of $timeout): $@\r" - sleep 60 - done - echo -e "\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"$@\"${ANSI_RESET}\n" - kill -9 $cmd_pid -} \ No newline at end of file diff --git a/README.md b/README.md index e17d71d6..5ad7904a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![DOI](https://zenodo.org/badge/129248575.svg)](https://zenodo.org/badge/latestdoi/129248575) [![PyPI version](https://badge.fury.io/py/hepdata-lib.svg)](https://badge.fury.io/py/hepdata-lib) -[![Build Status](https://travis-ci.org/HEPData/hepdata_lib.svg?branch=master)](https://travis-ci.org/HEPData/hepdata_lib) -[![Coverage Status](https://coveralls.io/repos/github/HEPData/hepdata_lib/badge.svg?branch=master)](https://coveralls.io/github/HEPData/hepdata_lib?branch=master) +[![Actions Status](https://github.com/SirVheod/hepdata_lib/workflows/tests/badge.svg)](https://github.com/SirVheod/hepdata_lib/actions) +[![Coverage Status](https://coveralls.io/repos/github/SirVheod/hepdata_lib/badge.svg?branch=master)](https://coveralls.io/github/SirVheod/hepdata_lib?branch=master) [![Documentation Status](https://readthedocs.org/projects/hepdata-lib/badge/)](http://hepdata-lib.readthedocs.io/) [![Docker Hub](https://images.microbadger.com/badges/image/clelange/hepdata_lib.svg)](https://hub.docker.com/r/clelange/hepdata_lib/)