[pre-commit.ci] pre-commit autoupdate #225
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: Build and test | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
release: | |
types: [ 'created' ] | |
# This allows a subsequently queued workflow run to interrupt and cancel previous runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Run-Unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [ 3.7, 3.8, 3.9, '3.10' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '${{ matrix.python }}' | |
architecture: 'x64' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-${{ hashFiles('setup.cfg') }} | |
- run: pip install -U pip wheel | |
- run: pip install -e '.[tests]' | |
- run: pytest --junit-xml=test-report/report.xml tests | |
build-n-publish: | |
if: github.event_name == 'release' | |
name: Build and publish Python 🐍 distributions 📦 to PyPI | |
needs: | |
- Run-Unit-tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
architecture: 'x64' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ hashFiles('setup.cfg') }} | |
- name: Verify Git Tag and package version | |
run: python3 .github/scripts/verify_tag_and_version.py | |
- run: pip3 install -U pip wheel build twine | |
- run: python3 -m build | |
- run: twine check dist/* | |
- run: twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |