Skip to content

added running test to test-publish #4

added running test to test-publish

added running test to test-publish #4

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# https://jacobian.org/til/github-actions-poetry/
# https://github.com/snok/install-poetry
# https://python-poetry.org/docs/pyproject/#extras
name: Upload MFAwesome to Test-Pypi
on:
push:
branches:
- dev
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
environment:
name: pypi
url: https://test.pypi.org/project/mfawesome/
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel build
- name: Build package
run: python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
runtests:
environment:
name: pypi
url: https://test.pypi.org/project/mfawesome/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.8.4-0
- uses: snok/install-poetry@v1
with:
version: 1.4.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Run Tests with Poetry
run: |
poetry install --no-interaction
poetry run pytest -v
poetry run coverage run
poetry run coverage report
poetry run coverage xml