Use single packaging tool pyproject.toml #390
Workflow file for this run
This file contains hidden or 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: Build and test | |
on: | |
push: | |
branches: ['main', 'pyproject'] | |
pull_request: | |
branches: ['main'] | |
release: | |
types: [ 'created' ] | |
# This allows a subsequent queued workflow run to interrupt and cancel previous runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Static-Check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
architecture: "x64" | |
- run: pip3 install hatch | |
- run: hatch run tests.py3.11-2.10:static-check | |
Run-Unit-Tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
airflow-version: [ "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10" ] | |
exclude: | |
# Apache Airflow versions prior to 2.3.0 have not been tested with Python 3.10 | |
# See: https://airflow.apache.org/docs/apache-airflow/2.2.0/installation/prerequisites.html | |
- python-version: "3.10" | |
airflow-version: "2.2" | |
# Apache Airflow versions prior to 2.6.2 have not been tested with Python 3.11 | |
- python-version: "3.11" | |
airflow-version: "2.2" | |
- python-version: "3.11" | |
airflow-version: "2.3" | |
- python-version: "3.11" | |
airflow-version: "2.4" | |
- python-version: "3.11" | |
airflow-version: "2.5" | |
- python-version: "3.11" | |
airflow-version: "2.6" | |
# Apache Airflow versions prior to 2.9.0 have not been tested with Python 3.12. | |
# Official support for Python 3.12 and the corresponding constraints.txt are available only for Apache Airflow >= 2.9.0. | |
# See: https://github.com/apache/airflow/tree/2.9.0?tab=readme-ov-file#requirements | |
# See: https://github.com/apache/airflow/tree/2.8.4?tab=readme-ov-file#requirements | |
- python-version: "3.12" | |
airflow-version: "2.2" | |
- python-version: "3.12" | |
airflow-version: "2.3" | |
- python-version: "3.12" | |
airflow-version: "2.4" | |
- python-version: "3.12" | |
airflow-version: "2.5" | |
- python-version: "3.12" | |
airflow-version: "2.6" | |
- python-version: "3.12" | |
airflow-version: "2.7" | |
- python-version: "3.12" | |
airflow-version: "2.8" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
.local/share/hatch/ | |
key: unit-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('fivetran_provider_async/__init__.py') }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install packages and dependencies | |
run: | | |
python -m pip install uv | |
uv pip install --system hatch | |
hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }} run pip freeze | |
- name: Test Airflow ${{ matrix.airflow-version }} and Python ${{ matrix.python-version }} | |
run: | | |
hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}:test-cov | |
- name: Upload coverage to Github | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-unit-test-${{ matrix.python-version }}-${{ matrix.airflow-version }} | |
path: .coverage | |
include-hidden-files: true | |
Publish-Package: | |
if: github.event_name == 'release' | |
name: Build and publish Python 🐍 distributions 📦 to PyPI | |
needs: | |
- Static-Check | |
- Run-Unit-Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- name: Verify Git Tag and package version | |
run: python3 .github/scripts/verify_tag_and_version.py | |
- run: pip3 install hatch | |
- run: hatch build | |
- run: hatch publish | |
env: | |
HATCH_INDEX_USER: __token__ | |
HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} |