|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + # paths-ignore: |
| 5 | + # - 'CHANGELOG.md' |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + - cron: "0 11 * * *" |
| 9 | + |
| 10 | +jobs: |
| 11 | + skip_duplicate: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 15 | + steps: |
| 16 | + - id: skip_check |
| 17 | + uses: fkirc/skip-duplicate-actions@master |
| 18 | + with: |
| 19 | + github_token: ${{ github.token }} |
| 20 | + concurrent_skipping: never |
| 21 | + skip_after_successful_duplicate: true |
| 22 | + paths_ignore: '["**/README.md", "**/docs/**"]' |
| 23 | + do_not_skip: '["pull_request", "schedule"]' |
| 24 | + |
| 25 | + test-conda: |
| 26 | + name: Test on Conda |
| 27 | + needs: skip_duplicate |
| 28 | + if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + os: ["ubuntu-latest", "macos-latest"] |
| 32 | + python-version: [3.7] |
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v2 |
| 37 | + - name: Cache conda |
| 38 | + uses: actions/cache@v1 |
| 39 | + with: |
| 40 | + path: ~/conda_pkgs_dir |
| 41 | + key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('environment-ci.yml') }} |
| 42 | + - name: Setup Miniconda |
| 43 | + uses: conda-incubator/setup-miniconda@v2 |
| 44 | + with: |
| 45 | + auto-update-conda: true |
| 46 | + auto-activate-base: false |
| 47 | + activate-environment: test_env |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + channels: conda-forge, xspecmodels, threeml, defaults |
| 50 | + environment-file: ci/environment.yml |
| 51 | + |
| 52 | + - name: Init Env |
| 53 | + shell: bash -l {0} |
| 54 | + run: | |
| 55 | + # Make sure we fail in case of error |
| 56 | + if [[ ${{matrix.os}} == ubuntu-latest ]]; |
| 57 | + then |
| 58 | + miniconda_os=Linux |
| 59 | + compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" |
| 60 | + else # osx |
| 61 | + miniconda_os=MacOSX |
| 62 | + compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" |
| 63 | +
|
| 64 | + # On macOS we also need the conda libx11 libraries used to build xspec |
| 65 | + # We also need to pin down ncurses, for now only on macos. |
| 66 | + xorg="xorg-libx11" |
| 67 | + fi |
| 68 | +
|
| 69 | + # Get the version in the __version__ environment variable |
| 70 | + #python ci/set_minor_version.py --patch $TRAVIS_BUILD_NUMBER --version_file threeML/version.py |
| 71 | +
|
| 72 | + #export PKG_VERSION=$(cd threeML && python -c "import version;print(version.__version__)") |
| 73 | +
|
| 74 | + export PKG_VERSION=$(python -c "import versioneer;print(versioneer.get_version())") |
| 75 | +
|
| 76 | + echo "HOME= ${HOME}" |
| 77 | + echo "Building ${PKG_VERSION} ..." |
| 78 | + echo "Python version: ${{matrix.python-version}}" |
| 79 | +
|
| 80 | + #libgfortranver="3.0" |
| 81 | + #NUMPYVER=1.15 |
| 82 | + MATPLOTLIBVER=2 |
| 83 | + XSPECVER="6.25" |
| 84 | + xspec_channel=xspecmodels |
| 85 | +
|
| 86 | + # Figure out requested dependencies |
| 87 | + if [ -n "${MATPLOTLIBVER}" ]; then MATPLOTLIB="matplotlib=${MATPLOTLIBVER}"; fi |
| 88 | + if [ -n "${NUMPYVER}" ]; then NUMPY="numpy=${NUMPYVER}"; fi |
| 89 | + if [ -n "${XSPECVER}" ]; |
| 90 | + then export XSPEC="xspec-modelsonly=${XSPECVER} ${xorg}"; |
| 91 | + fi |
| 92 | +
|
| 93 | +
|
| 94 | + PKG="pytest>=3.6 pandas>=0.23 ultranest interpolation>=2.1.5" |
| 95 | +
|
| 96 | + conda install ${PKG} codecov pytest-cov git ${MATPLOTLIB} ${NUMPY} ${XSPEC} astropy ${compilers} scipy astropy astromodels threeML numba reproject root emcee pymultinest ultranest flake8 |
| 97 | + pip install --no-binary :all: root_numpy |
| 98 | + - name: Conda list |
| 99 | + shell: bash -l {0} |
| 100 | + run: | |
| 101 | + conda list |
| 102 | + - name: install it |
| 103 | + shell: bash -l {0} |
| 104 | + run: | |
| 105 | + pip install -e . |
| 106 | + - name: Lint with flake8 |
| 107 | + shell: bash -l {0} |
| 108 | + run: | |
| 109 | + # stop the build if there are Python syntax errors or undefined names |
| 110 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 111 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 112 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 113 | +
|
| 114 | + - name: test it |
| 115 | + shell: bash -l {0} |
| 116 | + run: | |
| 117 | + python -m pytest -vv |
| 118 | +
|
| 119 | + env: |
| 120 | + OMP_NUM_THREADS: 1 |
| 121 | + MKL_NUM_THREADS: 1 |
| 122 | + NUMEXPR_NUM_THREADS: 1 |
| 123 | + MPLBACKEND: "Agg" |
| 124 | + |
| 125 | + test-master: |
| 126 | + name: Test with master threeML/astromodels |
| 127 | + needs: skip_duplicate |
| 128 | + if: ${{ needs.skip_duplicate.outputs.should_skip == 'false' }} |
| 129 | + strategy: |
| 130 | + matrix: |
| 131 | + os: ["ubuntu-latest", "macos-latest"] |
| 132 | + python-version: [3.7] |
| 133 | + runs-on: ${{ matrix.os }} |
| 134 | + steps: |
| 135 | + - name: Checkout |
| 136 | + uses: actions/checkout@v2 |
| 137 | + - name: Cache conda |
| 138 | + uses: actions/cache@v1 |
| 139 | + with: |
| 140 | + path: ~/conda_pkgs_dir |
| 141 | + key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('environment-ci.yml') }} |
| 142 | + - name: Setup Miniconda |
| 143 | + uses: conda-incubator/setup-miniconda@v2 |
| 144 | + with: |
| 145 | + auto-update-conda: true |
| 146 | + auto-activate-base: false |
| 147 | + activate-environment: test_env |
| 148 | + python-version: ${{ matrix.python-version }} |
| 149 | + channels: conda-forge, xspecmodels, threeml, defaults |
| 150 | + environment-file: ci/environment.yml |
| 151 | + |
| 152 | + - name: Init Env |
| 153 | + shell: bash -l {0} |
| 154 | + run: | |
| 155 | + # Make sure we fail in case of error |
| 156 | + if [[ ${{matrix.os}} == ubuntu-latest ]]; |
| 157 | + then |
| 158 | + miniconda_os=Linux |
| 159 | + compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" |
| 160 | + else # osx |
| 161 | + miniconda_os=MacOSX |
| 162 | + compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" |
| 163 | +
|
| 164 | + # On macOS we also need the conda libx11 libraries used to build xspec |
| 165 | + # We also need to pin down ncurses, for now only on macos. |
| 166 | + xorg="xorg-libx11" |
| 167 | + fi |
| 168 | +
|
| 169 | + # Get the version in the __version__ environment variable |
| 170 | + #python ci/set_minor_version.py --patch $TRAVIS_BUILD_NUMBER --version_file threeML/version.py |
| 171 | +
|
| 172 | + #export PKG_VERSION=$(cd threeML && python -c "import version;print(version.__version__)") |
| 173 | +
|
| 174 | + export PKG_VERSION=$(python -c "import versioneer;print(versioneer.get_version())") |
| 175 | +
|
| 176 | + echo "HOME= ${HOME}" |
| 177 | + echo "Building ${PKG_VERSION} ..." |
| 178 | + echo "Python version: ${{matrix.python-version}}" |
| 179 | +
|
| 180 | + #libgfortranver="3.0" |
| 181 | + #NUMPYVER=1.15 |
| 182 | + MATPLOTLIBVER=2 |
| 183 | + XSPECVER="6.25" |
| 184 | + xspec_channel=xspecmodels |
| 185 | +
|
| 186 | + # Figure out requested dependencies |
| 187 | + if [ -n "${MATPLOTLIBVER}" ]; then MATPLOTLIB="matplotlib=${MATPLOTLIBVER}"; fi |
| 188 | + if [ -n "${NUMPYVER}" ]; then NUMPY="numpy=${NUMPYVER}"; fi |
| 189 | + if [ -n "${XSPECVER}" ]; |
| 190 | + then export XSPEC="xspec-modelsonly=${XSPECVER} ${xorg}"; |
| 191 | + fi |
| 192 | +
|
| 193 | +
|
| 194 | + PKG="pytest>=3.6 pandas>=0.23 ultranest interpolation>=2.1.5" |
| 195 | +
|
| 196 | + conda install ${PKG} codecov pytest-cov git ${MATPLOTLIB} ${NUMPY} ${XSPEC} astropy ${compilers} scipy astropy astromodels threeML numba reproject root emcee pymultinest ultranest flake8 |
| 197 | + pip install --no-binary :all: root_numpy |
| 198 | + pip uninstall astromodels threeML -y |
| 199 | + pip install git+https://github.com/threeml/astromodels.git |
| 200 | + pip install git+https://github.com/threeml/threeML.git |
| 201 | + - name: Conda list |
| 202 | + shell: bash -l {0} |
| 203 | + run: | |
| 204 | + conda list |
| 205 | + - name: install it |
| 206 | + shell: bash -l {0} |
| 207 | + run: | |
| 208 | + pip install -e . |
| 209 | + - name: Lint with flake8 |
| 210 | + shell: bash -l {0} |
| 211 | + run: | |
| 212 | + # stop the build if there are Python syntax errors or undefined names |
| 213 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 214 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 215 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 216 | +
|
| 217 | + - name: test it |
| 218 | + shell: bash -l {0} |
| 219 | + run: | |
| 220 | + python -m pytest -vv |
| 221 | +
|
| 222 | + env: |
| 223 | + OMP_NUM_THREADS: 1 |
| 224 | + MKL_NUM_THREADS: 1 |
| 225 | + NUMEXPR_NUM_THREADS: 1 |
| 226 | + MPLBACKEND: "Agg" |
0 commit comments