Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depend on requests-negotiate-sspi on Windows. On other platforms, depend on requests-kerberos and pykerberos. #199

Merged
merged 7 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 75 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# This workflow will install Python dependencies and run tests with several versions of Python
# 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.9
POETRY_VERSION: 1.1.10

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
test-and-package-wheel-archive:
name: Build wheel (${{ 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.5, 3.6, 3.7, 3.8, 3.9, 3.10-dev]
exclude:
# Python 3.10-dev on Windows is excluded for now as this combination:
# - has no pywin32 wheel available yet, see https://github.com/mhammond/pywin32/issues/1588 and https://pypi.org/project/pywin32/301/#files
# - has no lxml wheel available yet, and building lxml 4.6.3 fails, even with Cython 0.29.24 installed
pdecat marked this conversation as resolved.
Show resolved Hide resolved
- os: windows-latest
python-version: 3.10-dev

steps:
- uses: actions/checkout@v2
Expand All @@ -28,41 +40,92 @@ jobs:

- name: Install libkrb5-dev
run: sudo apt-get -y install libkrb5-dev
if: matrix.os == 'ubuntu-latest'

- name: Install aws-adfs and its dependencies
- name: Install poetry ${{ env.POETRY_VERSION }}
run: |
python -m pip install --upgrade pip
pip install poetry==1.1.10
pip install poetry==${{ env.POETRY_VERSION }}
poetry config experimental.new-installer false # New installer does not support python 3.10 yet, see https://github.com/python-poetry/poetry/issues/4210

- name: Install aws-adfs and its dependencies
run: |
poetry install

- name: Test with pytest
run: |
poetry run pytest

- name: Build a wheel archive
run: |
poetry build --format wheel

- name: Upload wheel archive
uses: actions/upload-artifact@v2
with:
path: |
dist

package-source-archive:
name: Package source archive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install poetry ${{ env.POETRY_VERSION }}
run: |
pip install poetry==${{ env.POETRY_VERSION }}

- name: Build a source archive
run: |
poetry build --format sdist
if: matrix.python-version == 3.9 # Only build source tarball once

- name: Build a wheel archive
- name: Upload source archive
uses: actions/upload-artifact@v2
with:
path: |
dist

publish:
name: Publish source and wheel archives
needs:
- test-and-package-wheel-archive
- package-source-archive
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') # Only publish tagged releases
steps:
- uses: actions/checkout@v2

- name: Download all workflow source and wheel archives
uses: actions/download-artifact@v2
with:
path: dist

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install poetry ${{ env.POETRY_VERSION }}
run: |
poetry build --format wheel
pip install poetry==${{ env.POETRY_VERSION }}

- 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 --repository testpypi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

- name: Create Release
uses: ncipollo/release-action@v1
Expand All @@ -71,10 +134,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: steps.check-version.outputs.prerelease == 'true'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.pypi_password }}
run: poetry publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && steps.check-version.outputs.prerelease != 'true'
if: steps.check-version.outputs.prerelease != 'true' # Only publish final releases to PyPI
101 changes: 100 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ configparser = "*"
fido2 = "^0.8.1" # fido2 0.9.0 is a breaking release
lxml = "*"
requests = "*"
requests-kerberos = "*"
requests-kerberos = [
{ version = "*", markers = "platform_system != 'Windows'" },
]
requests-negotiate-sspi= [
{ version = ">=0.3.4", markers = "platform_system == 'Windows'" },
]

[tool.poetry.dev-dependencies]
coverage = "<4"
Expand Down