CD test #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: Test and deploy | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/README.rst' | |
- 'docs/**' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/README.rst' | |
- 'docs/**' | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
run: | | |
pip install poetry | |
- name: Install dependencies | |
run: | | |
poetry install | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox | |
deploy: | |
needs: tests | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
- name: Install poetry | |
run: | | |
pip install poetry | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Build and publish to Test PyPI | |
run: | | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.test-pypi ${{ secrets.TEST_PYPI_TOKEN }} | |
poetry publish --build | |