Introduction


trigger:

  - Dev
pool:

  vmImage: windows-latest
steps:

  - task: UsePythonVersion@0

    inputs:

      versionSpec: 3.7

    displayName: Install Python

  - script: |

      python -m pip install -U pip
      pip install poetry
      poetry install

    displayName: Install software

    workingDirectory: src/libs/portal_roles

  - script: |

      poetry run python -m unittest discover tests/ -v

    displayName: Test software
    workingDirectory: src/libs/portal_roles

  - script: |

      poetry build
    displayName: Package software
    workingDirectory: #directory contains pyproject.toml file

For the publishing, the Azure pipeline recomends use Twine libary to handle the authentication, however, was getting entry_points() got an unexpected keyword argument error, after looking at the log it is because libary conflicts between Twine and Poetry. That means if i’d like to use the Poetry i need to give up Twine.

Since Poetry supports publish to private repo, then trying to config publish with Poetry directly.

	  - task: Bash@3
    inputs:

      targetType: "inline"

      script: |

        poetry config repositories.[repo_name] https://pkgs.dev.azure.com/[org_name]/[project_name]/_packaging/[feed_name]/pypi/upload

        poetry publish -r [repo_anme] -u a -p $(System.AccessToken)

      displayName: Publish artifacts

      workingDirectory: src/libs/portal_roles