Test cases #187
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
# Generated by cdkactions. Do not modify | |
# Generated as part of the 'pypi' stack. | |
name: Build and Publish | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- 3.11 | |
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: pip install poetry tox tox-gh-actions codecov | |
- name: Test | |
run: tox | |
- name: Upload Code Coverage | |
run: codecov | |
publish: | |
runs-on: ubuntu-latest | |
container: | |
image: python:3.11 | |
needs: test | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: pip install poetry | |
- name: Verify tag | |
run: |- | |
GIT_TAG=${GITHUB_REF} | |
LIBRARY_VERSION=$(poetry version -s) | |
POETRY_REF=refs/tags/$LIBRARY_VERSION | |
echo $POETRY_REF | |
echo $GIT_TAG | |
if [ $GIT_TAG != $POETRY_REF ]; then exit 1; fi | |
- name: Build | |
run: poetry build | |
- name: Publish | |
run: poetry publish | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PASSWORD }} |