Project Release (Test) #1
Workflow file for this run
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
name: 'Project Release (Test)' | |
on: | |
workflow_dispatch: | |
jobs: | |
test-build-publish-package: | |
name: Test, Build, & Publish Python Package | |
runs-on: ubuntu-20.04 | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
# Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
# Set up the environment to run Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
# Set up the environment to run the latest Python build, test, and publish tools | |
- name: Set Up Environment | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade setuptools | |
python3 -m pip install --upgrade wheel | |
python3 -m pip install --upgrade pytest | |
python3 -m pip install --upgrade twine | |
python3 -m pip install --upgrade pyyaml | |
# Install the package from source | |
- name: Install Source Code | |
run: | | |
python3 -m pip install . | |
# Run the package tests | |
- name: Test Source Code | |
run: | | |
python3 -m pytest -v | |
# Build the package | |
- name: Build Package | |
run: | | |
python3 -m pip install --upgrade build | |
python3 -m build | |
# Check the distribution files with Twine | |
- name: Check Package | |
run: | | |
python3 -m twine check dist/* | |
# Store the distribution files as artifacts | |
- name: Upload Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package | |
path: dist/ | |
# Upload the distribution artifacts to PyPi test environment for all (supported) scenarios | |
- name: Publish Package (PyPi Test) | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ | |
password: ${{ secrets.PYPI_TEST_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ |