Create ci-cd.yml #1
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-cd | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: actions/checkout@v2 | |
- uses: snok/install-poetry@v1 | |
- name: Install package | |
run: poetry install | |
- name: Test with pytest | |
run: poetry run pytest tests/ --cov=datexplore --cov-report=xml | |
- uses: codecov/codecov-action@v2 | |
with: | |
files: ./coverage.xml | |
fail_ci_if_error: false | |
- name: Build documentation | |
run: poetry run make html --directory docs/ | |
cd: | |
needs: ci | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Python Semantic Release | |
run: | | |
pip install python-semantic-release | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release publish | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
- name: Test install from TestPyPI | |
run: | | |
pip install \ | |
--index-url https://test.pypi.org/simple/ \ | |
--extra-index-url https://pypi.org/simple \ | |
datexplore | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |