Skip to content

Commit a31a8cf

Browse files
committed
simplify python-package workflow
1 parent 0ab54b9 commit a31a8cf

File tree

1 file changed

+37
-152
lines changed

1 file changed

+37
-152
lines changed
Lines changed: 37 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,198 +1,83 @@
1-
name: CI/CD
1+
# Derived from https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
2+
#
3+
name: Python Package
24

35
on:
46
push:
5-
branches: ["master"]
7+
branches: ["master", "dpkp/*"]
68
pull_request:
79
branches: ["master"]
8-
release:
9-
types: [created]
10-
branches:
11-
- 'master'
12-
workflow_dispatch:
1310

1411
env:
1512
FORCE_COLOR: "1" # Make tools pretty.
1613
PIP_DISABLE_PIP_VERSION_CHECK: "1"
1714
PIP_NO_PYTHON_VERSION_WARNING: "1"
18-
PYTHON_LATEST: "3.12"
19-
KAFKA_LATEST: "2.6.0"
20-
21-
# For re-actors/checkout-python-sdist
22-
sdist-artifact: python-package-distributions
2315

2416
jobs:
17+
build:
2518

26-
build-sdist:
27-
name: 📦 Build the source distribution
2819
runs-on: ubuntu-latest
29-
steps:
30-
- name: Checkout project
31-
uses: actions/checkout@v4
32-
with:
33-
fetch-depth: 0
34-
- name: Set up Python
35-
uses: actions/setup-python@v5
36-
with:
37-
python-version: ${{ env.PYTHON_LATEST }}
38-
cache: pip
39-
- run: python -m pip install build
40-
name: Install core libraries for build and install
41-
- name: Build artifacts
42-
run: python -m build
43-
- name: Upload built artifacts for testing
44-
uses: actions/upload-artifact@v3
45-
with:
46-
name: ${{ env.sdist-artifact }}
47-
# NOTE: Exact expected file names are specified here
48-
# NOTE: as a safety measure — if anything weird ends
49-
# NOTE: up being in this dir or not all dists will be
50-
# NOTE: produced, this will fail the workflow.
51-
path: dist/${{ env.sdist-name }}
52-
retention-days: 15
53-
54-
test-python:
5520
name: Tests on ${{ matrix.python-version }}
56-
needs:
57-
- build-sdist
58-
runs-on: ubuntu-latest
5921
continue-on-error: ${{ matrix.experimental }}
6022
strategy:
6123
fail-fast: false
6224
matrix:
25+
kafka-version:
26+
- "0.8.2.2"
27+
- "0.9.0.1"
28+
- "0.10.2.2"
29+
- "0.11.0.3"
30+
- "1.1.1"
31+
- "2.4.0"
32+
- "2.5.0"
33+
- "2.6.0"
6334
python-version:
64-
- "3.8"
65-
- "3.9"
66-
- "3.10"
67-
- "3.11"
6835
- "3.12"
69-
experimental: [ false ]
7036
include:
71-
- python-version: "pypy3.9"
72-
experimental: true
73-
- python-version: "~3.13.0-0"
74-
experimental: true
37+
#- python-version: "pypy3.9"
38+
# kafka-version: "2.6.0"
39+
# experimental: true
40+
#- python-version: "~3.13.0-0"
41+
# kafka-version: "2.6.0"
42+
# experimental: true
43+
- python-version: "3.8"
44+
kafka-version: "2.6.0"
45+
- python-version: "3.9"
46+
kafka-version: "2.6.0"
47+
- python-version: "3.10"
48+
kafka-version: "2.6.0"
49+
- python-version: "3.11"
50+
kafka-version: "2.6.0"
51+
7552
steps:
76-
- name: Checkout the source code
77-
uses: actions/checkout@v4
78-
with:
79-
fetch-depth: 0
80-
- name: Setup java
81-
uses: actions/setup-java@v4
82-
with:
83-
distribution: temurin
84-
java-version: 11
85-
- name: Set up Python
53+
- uses: actions/checkout@v4
54+
- name: Set up Python ${{ matrix.python-version }}
8655
uses: actions/setup-python@v5
8756
with:
8857
python-version: ${{ matrix.python-version }}
8958
cache: pip
9059
cache-dependency-path: |
9160
requirements-dev.txt
92-
- name: Check Java installation
93-
run: source travis_java_install.sh
94-
- name: Pull Kafka releases
95-
run: ./build_integration.sh
96-
env:
97-
PLATFORM: ${{ matrix.platform }}
98-
KAFKA_VERSION: ${{ env.KAFKA_LATEST }}
99-
# TODO: Cache releases to expedite testing
10061
- name: Install dependencies
10162
run: |
10263
sudo apt install -y libsnappy-dev libzstd-dev
10364
python -m pip install --upgrade pip
104-
python -m pip install tox tox-gh-actions
105-
pip install .
10665
pip install -r requirements-dev.txt
107-
- name: Test with tox
108-
run: tox
109-
env:
110-
PLATFORM: ${{ matrix.platform }}
111-
KAFKA_VERSION: ${{ env.KAFKA_LATEST }}
112-
113-
test-kafka:
114-
name: Tests for Kafka ${{ matrix.kafka-version }}
115-
needs:
116-
- build-sdist
117-
runs-on: ubuntu-latest
118-
strategy:
119-
fail-fast: false
120-
matrix:
121-
kafka-version:
122-
- "0.8.2.2"
123-
- "0.9.0.1"
124-
- "0.10.2.2"
125-
- "0.11.0.2"
126-
- "0.11.0.3"
127-
- "1.1.1"
128-
- "2.4.0"
129-
- "2.5.0"
130-
- "2.6.0"
131-
steps:
132-
- name: Checkout the source code
133-
uses: actions/checkout@v4
134-
with:
135-
fetch-depth: 0
66+
pip install tox-gh-actions
13667
- name: Setup java
13768
uses: actions/setup-java@v4
13869
with:
13970
distribution: temurin
140-
java-version: 8
141-
- name: Set up Python
142-
uses: actions/setup-python@v5
143-
with:
144-
python-version: ${{ env.PYTHON_LATEST }}
145-
cache: pip
146-
cache-dependency-path: |
147-
requirements-dev.txt
71+
java-version: 11
72+
- name: Check Java installation
73+
run: source travis_java_install.sh
14874
- name: Pull Kafka releases
14975
run: ./build_integration.sh
15076
env:
151-
# This is fast enough as long as you pull only one release at a time,
152-
# no need to worry about caching
15377
PLATFORM: ${{ matrix.platform }}
154-
KAFKA_VERSION: ${{ matrix.kafka-version }}
155-
- name: Install dependencies
156-
run: |
157-
sudo apt install -y libsnappy-dev libzstd-dev
158-
python -m pip install --upgrade pip
159-
python -m pip install tox tox-gh-actions
160-
pip install .
161-
pip install -r requirements-dev.txt
78+
KAFKA_VERSION: ${{ matrix.kafka_version }}
16279
- name: Test with tox
16380
run: tox
16481
env:
16582
PLATFORM: ${{ matrix.platform }}
166-
KAFKA_VERSION: ${{ matrix.kafka-version }}
167-
168-
check: # This job does nothing and is only used for the branch protection
169-
name: ✅ Ensure the required checks passing
170-
if: always()
171-
needs:
172-
- build-sdist
173-
- test-python
174-
- test-kafka
175-
runs-on: ubuntu-latest
176-
steps:
177-
- name: Decide whether the needed jobs succeeded or failed
178-
uses: re-actors/alls-green@release/v1
179-
with:
180-
jobs: ${{ toJSON(needs) }}
181-
publish:
182-
name: 📦 Publish to PyPI
183-
runs-on: ubuntu-latest
184-
needs: [build-sdist]
185-
permissions:
186-
id-token: write
187-
environment: pypi
188-
if: github.event_name == 'release' && github.event.action == 'created'
189-
steps:
190-
- name: Download the sdist artifact
191-
uses: actions/download-artifact@v3
192-
with:
193-
name: artifact
194-
path: dist
195-
- name: Publish package to PyPI
196-
uses: pypa/gh-action-pypi-publish@release/v1
197-
with:
198-
password: ${{ secrets.PYPI_API_TOKEN }}
83+
KAFKA_VERSION: ${{ matrix.kafka_version }}

0 commit comments

Comments
 (0)