checkout the test files for the test #9
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: test-pypi-push | |
# https://packaging.python.org/en/latest/tutorials/packaging-projects/ | |
# https://docs.pypi.org/trusted-publishers/using-a-publisher/ | |
on: | |
push: | |
paths: | |
- 'changepoynt/**' | |
- 'tests/**' | |
- '.github/workflows/test_pypi.yml' | |
pull_request: | |
jobs: | |
pypi-publish: | |
name: upload release to PyPI | |
runs-on: ubuntu-latest | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
# retrieve your distributions here | |
- name: Get the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
- name: Update the package Version for testing | |
# https://stackoverflow.com/questions/54310050/how-to-version-build-artifacts-using-github-actions | |
run: | | |
sh rename_version.sh ${{ github.run_number }} | |
- name: Make the build steps for the packaging | |
# https://stackoverflow.com/questions/21064581/how-to-overwrite-pypi-package-when-doing-upload-from-command-line | |
# https://peps.python.org/pep-0427/#file-name-convention | |
run: | | |
python3 -m pip install --upgrade build | |
python3 -m build | |
- name: Publish package distributions to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
pypi-download-test: | |
name: Install Package from PyPI | |
needs: pypi-publish | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
python-version: [ '3.9', '3.11' ] | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# https://github.com/actions/checkout#fetch-only-a-single-file | |
# get only the test files for the test of the installed package | |
- name: Get the test scripts from the original repository | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
tests | |
- name: Install dependencies | |
# https://packaging.python.org/en/latest/guides/using-testpypi/ | |
run: | | |
python3 -m pip install pytest | |
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ changepoynt | |
- name: Test with pytest | |
run: pytest |