diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index dbaedd4..ed74d3f 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -10,30 +10,67 @@ name: Upload Python Package on: release: - types: [published] + types: [ published ] + +env: + PYTHON_VERSION_DEFAULT: "3.14" permissions: contents: read jobs: - deploy: - + quick-test: + name: QuickTest + runs-on: ubuntu-latest + steps: + - name: Checkout + # see https://github.com/actions/checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + - name: Setup Python Environment + # see https://github.com/actions/setup-python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PYTHON_VERSION_DEFAULT }} + architecture: 'x64' + - name: Validate Python Environment + shell: python + run: | + import sys + print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding())) + - name: Install env dependencies + run: python -m pip install --upgrade pip + - name: Install project + run: python -m pip install --user -e ".[testing]" + - name: Run Tests + run: python -m pytest tests + publish: + name: Publish + needs: + - quick-test runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file + - name: Checkout + # see https://github.com/actions/checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + - name: Setup Python Environment + # see https://github.com/actions/setup-python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ env.PYTHON_VERSION_DEFAULT }} + architecture: 'x64' + - name: Install env dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Build package + run: python -m build + - name: Publish package + # see https://github.com/pypa/gh-action-pypi-publish + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 # v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..72d5a39 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,79 @@ +# 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. + + +name: Python CI + +on: + workflow_dispatch: + pull_request: + push: + tags: [ 'v*' ] # run again on release tags to have tools mark them + branches: [ 'main', 'next' ] + schedule: + # schedule daily tests, since some dependencies are not intended to be pinned + # this means: at 23:42 every day + - cron: '42 23 * * *' + +env: + PYTHON_VERSION_DEFAULT: "3.14" + +permissions: + contents: read + +jobs: + build-and-test: + name: Test (${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.toxenv-factors }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + python-version: + - "3.14" # highest supported + - "3.13" + - "3.12" + - "3.11" + - "3.10" + - "3.9" # lowest supported + exclude: + - os: macos-latest # macos-latest is incompatible with some PY versions + python-version: "3.10" + - os: macos-latest # macos-latest is incompatible with some PY versions + python-version: "3.9" + steps: + - name: Disabled Git auto EOL CRLF transforms + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + # see https://github.com/actions/checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + - name: Setup Python Environment + # see https://github.com/actions/setup-python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: ${{ matrix.python-version }} + architecture: 'x64' + - name: Validate Python Environment + shell: python + run: | + import sys + print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding())) + - name: Install env dependencies + run: python -m pip install --upgrade pip + - name: Install project + run: pip install --user -e ".[testing]" + - name: Run Tests + run: python -m pytest tests \ No newline at end of file