|
| 1 | +name: Continuous Integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + - "develop" |
| 8 | + tags: |
| 9 | + - "*" |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - "develop" |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +jobs: |
| 17 | + format_check: |
| 18 | + name: format check |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + |
| 26 | + - name: Set up Python 3.8 |
| 27 | + uses: actions\setup-python@v2 |
| 28 | + with: |
| 29 | + python-version: 3.8 |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install black |
| 35 | +
|
| 36 | + - name: black check |
| 37 | + run: | |
| 38 | + python -m black --check pykrige/ examples/ tests/ |
| 39 | +
|
| 40 | + build_sdist: |
| 41 | + name: sdist and coveralls |
| 42 | + runs-on: ubuntu-latest |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v2 |
| 48 | + with: |
| 49 | + fetch-depth: '0' |
| 50 | + |
| 51 | + - name: Set up Python 3.8 |
| 52 | + uses: actions\setup-python@v2 |
| 53 | + with: |
| 54 | + python-version: 3.8 |
| 55 | + |
| 56 | + - name: Install dependencies |
| 57 | + run: | |
| 58 | + python -m pip install --upgrade pip |
| 59 | + pip install -r requirements_setup.txt |
| 60 | + pip install -r requirements.txt |
| 61 | + pip install -r requirements_test.txt |
| 62 | + pip install coveralls>=3.0.0 |
| 63 | +
|
| 64 | + - name: Build sdist |
| 65 | + run: | |
| 66 | + python setup.py sdist -d dist |
| 67 | + python setup.py build_ext --inplace |
| 68 | +
|
| 69 | + - name: Run tests |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + run: | |
| 73 | + python -m pytest --cov pykrige --cov-report term-missing -v tests/ |
| 74 | + python -m coveralls --service=github |
| 75 | +
|
| 76 | + - uses: actions/upload-artifact@v2 |
| 77 | + with: |
| 78 | + path: dist/*.tar.gz |
| 79 | + |
| 80 | + build_wheels: |
| 81 | + name: wheels on ${{matrix.os}} |
| 82 | + runs-on: ${{matrix.os}} |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 87 | + |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v2 |
| 90 | + with: |
| 91 | + fetch-depth: '0' |
| 92 | + |
| 93 | + - name: Build wheels |
| 94 | + uses: joerick/cibuildwheel@v1.10.0 |
| 95 | + env: |
| 96 | + CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* |
| 97 | + CIBW_BEFORE_BUILD: pip install numpy==1.19.* scipy==1.5.* cython==0.29.* setuptools |
| 98 | + CIBW_TEST_REQUIRES: pytest scikit-learn |
| 99 | + CIBW_TEST_COMMAND: pytest -v {project}/tests |
| 100 | + with: |
| 101 | + output-dir: dist |
| 102 | + |
| 103 | + - uses: actions/upload-artifact@v2 |
| 104 | + with: |
| 105 | + path: ./dist/*.whl |
| 106 | + |
| 107 | + upload_to_pypi: |
| 108 | + needs: [build_wheels, build_sdist] |
| 109 | + runs-on: ubuntu-latest |
| 110 | + |
| 111 | + steps: |
| 112 | + - uses: actions/download-artifact@v2 |
| 113 | + with: |
| 114 | + name: artifact |
| 115 | + path: dist |
| 116 | + |
| 117 | + - name: Publish to Test PyPI |
| 118 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' |
| 119 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 120 | + with: |
| 121 | + user: __token__ |
| 122 | + password: ${{ secrets.test_pypi_password }} |
| 123 | + repository_url: https://test.pypi.org/legacy/ |
| 124 | + skip_existing: true |
| 125 | + |
| 126 | + - name: Publish to PyPI |
| 127 | + # only if tagged |
| 128 | + if: startsWith(github.ref, 'refs/tags') |
| 129 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 130 | + with: |
| 131 | + user: __token__ |
| 132 | + password: ${{ secrets.pypi_password }} |
0 commit comments