Skip to content

Merge pull request #418 from venth/dependabot/pip/cryptography-41.0.6 #653

Merge pull request #418 from venth/dependabot/pip/cryptography-41.0.6

Merge pull request #418 from venth/dependabot/pip/cryptography-41.0.6 #653

Workflow file for this run

# This workflow will install Python dependencies and run tests with several versions of Python on MacOS, Ubuntu and Windows
# When successful, packages are published to test.pypi.org and pypi.org (releases only)
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build
env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.2.2"
on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]
jobs:
test:
name: Run tests (${{ matrix.python-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install libkrb5-dev
run: sudo apt-get -y install libkrb5-dev
if: matrix.os == 'ubuntu-latest'
- name: Install poetry ${{ env.POETRY_VERSION }}
run: |
pip install poetry==${{ env.POETRY_VERSION }}
- name: Install aws-adfs and its dependencies
run: |
poetry install
- name: Run all pre-commit checks
if: matrix.os == 'ubuntu-latest'
run: |
poetry run pre-commit run --all
- name: Test with pytest
run: |
poetry run pytest
publish:
name: Publish source and wheel archives
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') # Only publish tagged releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install poetry ${{ env.POETRY_VERSION }}
run: |
pip install poetry==${{ env.POETRY_VERSION }}
- name: Build source and wheel archives
run: |
poetry build
- name: Publish package to TestPyPI
env:
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.test_pypi_password }}
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --skip-existing --repository testpypi
- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
generateReleaseNotes: true
prerelease: ${{ steps.check-version.outputs.prerelease == 'true' }}
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.pypi_password }}
run: poetry publish
# if: steps.check-version.outputs.prerelease != 'true' # Only publish final releases to PyPI