-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Update test and publish workflows
- Loading branch information
Showing
7 changed files
with
75 additions
and
45 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
name: Publish package to PyPI | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
pull_request: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
environment: | ||
name: test-pypi | ||
url: https://test.pypi.org/project/aiomqtt-test | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Fetch entire history for poetry-dynamic-versioning | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
id: setup-python | ||
uses: actions/setup-python@v4 # Uses the Python version in .python-version | ||
with: | ||
python-version: 3.x | ||
- name: Install dependencies | ||
run: pip install build | ||
- name: Create package | ||
run: python -m build -s -w . | ||
- name: Upload package | ||
cache: "poetry" | ||
- name: Setup dynamic versioning | ||
run: poetry self add "poetry-dynamic-versioning[plugin]" | ||
- name: Build package | ||
run: poetry build | ||
# - name: Publish to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Safety first | ||
set -o errexit -o pipefail -o nounset | ||
# Change into the project's directory | ||
cd "$(dirname "$0")/.." | ||
|
||
# Check with ruff and mypy | ||
poetry run ruff check asyncio_mqtt tests | ||
poetry run mypy asyncio_mqtt tests |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Safety first | ||
set -o errexit -o pipefail -o nounset | ||
# Change into the project's directory | ||
cd "$(dirname "$0")/.." | ||
|
||
# Run tests with pytest | ||
poetry run pytest --failed-first --strict-config --strict-markers --verbosity=2 --cov=asyncio_mqtt --cov-report=xml --junitxml=reports/pytest.xml tests |