Skip to content

Commit 9a8d835

Browse files
committed
verify with tests after publish to pypi
1 parent 4b11d3e commit 9a8d835

3 files changed

Lines changed: 47 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
verify:
4747
needs: publish
4848
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
airflow: ["2", "3"]
4952
steps:
5053
- uses: actions/checkout@v4
5154

@@ -54,13 +57,11 @@ jobs:
5457
with:
5558
python-version: "3.12"
5659

60+
- name: Install tox
61+
run: pip install tox
62+
5763
- name: Wait for PyPI to update
5864
run: sleep 30
5965

60-
- name: Install from PyPI and test dependencies
61-
run: |
62-
pip install airflow-postgres-csv pytest
63-
pip show airflow-postgres-csv
64-
65-
- name: Run tests against installed package
66-
run: pytest tests/ -v
66+
- name: Run tests against published package (Airflow ${{ matrix.airflow }})
67+
run: tox -e verify-airflow${{ matrix.airflow }}

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ CsvToPostgresOperator(
112112
| `null_string` | String representing NULL | `""` |
113113
| `timeout` | Query timeout in minutes | `60` |
114114

115+
## Development
116+
117+
### Running tests
118+
119+
Tests can be run against both supported Airflow versions using [tox](https://tox.wiki):
120+
121+
```bash
122+
pip install tox
123+
124+
tox -e airflow2 # test against Airflow 2.x
125+
tox -e airflow3 # test against Airflow 3.x
126+
tox # run both
127+
```
128+
129+
Each environment installs the correct Airflow and provider versions automatically — no manual dependency management needed.
130+
115131
## Requirements
116132

117133
| | Airflow 2 | Airflow 3 |

pyproject.toml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "airflow-postgres-csv"
7-
version = "0.2.0"
7+
version = "0.3.0"
88
description = "Airflow operators for PostgreSQL <-> CSV file transfers using COPY"
99
readme = "README.md"
1010
license = "MIT"
@@ -72,3 +72,25 @@ deps = [
7272
"pytest-cov",
7373
]
7474
commands = [["pytest", "--cov=airflow_postgres_csv", "--cov-report=xml", "{posargs:tests/}"]]
75+
76+
[tool.tox.env.verify-airflow2]
77+
description = "Verify the published PyPI package works with Airflow 2.x"
78+
skip_install = true
79+
deps = [
80+
"airflow-postgres-csv",
81+
"apache-airflow>=2.9,<3.0",
82+
"apache-airflow-providers-postgres>=5.0,<6.0",
83+
"pytest>=8.0",
84+
]
85+
commands = [["pytest", "{posargs:tests/}"]]
86+
87+
[tool.tox.env.verify-airflow3]
88+
description = "Verify the published PyPI package works with Airflow 3.x"
89+
skip_install = true
90+
deps = [
91+
"airflow-postgres-csv",
92+
"apache-airflow>=3.0",
93+
"apache-airflow-providers-postgres>=6.0",
94+
"pytest>=8.0",
95+
]
96+
commands = [["pytest", "{posargs:tests/}"]]

0 commit comments

Comments
 (0)