CI #762
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
#At the end of every day | |
- cron: 0 0 * * * | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.8, 3.9] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install setuptools wheel --upgrade | |
python -m pip install --upgrade flake8 coverage pytest pytest-cov cython codecov numpy numba tempita | |
pip3 install git+https://github.com/threeML/astromodels.git@dev#egg=astromodels | |
python setup.py install | |
- name: Lint with flake8 | |
run: | | |
flake8 ronswanson | |
- name: Test with pytest | |
run: | | |
python -m pytest -vv --cov=ronswanson/ --cov-report=xml | |
env: | |
NUMBA_DISABLE_JIT: 0 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
files: ./coverage1.xml,./coverage2.xml | |
directory: ./coverage/reports/ | |
package: | |
name: Build & verify package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install twine | |
run: python -m pip install twine | |
- name: Build package | |
run: python setup.py sdist | |
- name: List result | |
run: ls -l dist | |
- name: Check long_description | |
run: python -m twine check dist/* | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install twine | |
run: python -m pip install twine | |
- name: Build package | |
run: python setup.py sdist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_UPLOAD_TOKEN }} | |