Skip to content

prefix typed file with underscore to show private intent #24

prefix typed file with underscore to show private intent

prefix typed file with underscore to show private intent #24

Workflow file for this run

name: Python CI/CD
on: [push, pull_request]
permissions: {}
jobs:
Unit_Tests_Py27:
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install -r test-requirements.txt -r requirements.txt
- name: Test
run: |
pytest
Unit_tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: [
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev",
"pypy-2.7", "pypy-3.10"
]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r test-requirements.txt -r requirements.txt
- name: Run tests
run: |
pytest
Mypy:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: [
"3.12"
]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r test-requirements.txt -r requirements.txt
- name: Run tests
run: |
mypy --check tinify
Integration_tests:
if: github.event_name == 'push'
runs-on: ${{ matrix.os }}
timeout-minutes: 10
needs: [Unit_tests, Mypy, Unit_Tests_Py27]
strategy:
fail-fast: false
matrix:
python-version: [
"3.13",
]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r test-requirements.txt -r requirements.txt
- name: Run tests
env:
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
run: |
pytest test/integration.py
Publish:
if: |
github.repository == 'tinify/tinify-python' &&
startsWith(github.ref, 'refs/tags') &&
github.event_name == 'push'
timeout-minutes: 10
needs: [Unit_tests, Integration_tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install build wheel
- name: Check if properly tagged
run: |
PACKAGE_VERSION="$(python -c 'from tinify import __version__;print(__version__)')";
CURRENT_TAG="${GITHUB_REF#refs/*/}";
if [[ "${PACKAGE_VERSION}" != "${CURRENT_TAG}" ]]; then
>&2 echo "Tag mismatch"
>&2 echo "Version in tinify/version.py (${PACKAGE_VERSION}) does not match the current tag=${CURRENT_TAG}"
>&2 echo "Skipping deploy"
exit 1;
fi
- name: Build package (sdist & wheel)
run: |
python -m build --sdist --wheel --outdir dist/
- name: Test sdist install
run: |
python -m venv sdist_env
./sdist_env/bin/pip install dist/tinify*.tar.gz
- name: Test wheel install
run: |
python -m venv wheel_env
./wheel_env/bin/pip install dist/tinify*.whl
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_ACCESS_TOKEN }}
# Use the test repository for testing the publish feature
# repository_url: https://test.pypi.org/legacy/
packages_dir: dist/
print_hash: true