Skip to content

Commit 4a44d84

Browse files
authored
Split the publish flow into two flows (#5004)
Split the build publish into two workflows to make it easier to test each in isolation. Signed-off-by: Adam Gutglick <[email protected]>
1 parent 47d1161 commit 4a44d84

File tree

2 files changed

+151
-134
lines changed

2 files changed

+151
-134
lines changed

.github/workflows/package.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to set (e.g., 0.1.0)"
8+
required: true
9+
type: string
10+
workflow_call:
11+
inputs:
12+
version:
13+
description: "Version to set (e.g., 0.1.0)"
14+
required: true
15+
type: string
16+
17+
jobs:
18+
prepare-python:
19+
runs-on: ${{ matrix.target.runs-on }}
20+
timeout-minutes: 120
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
target:
25+
- { os: macos, runs-on: "macos-latest", target: aarch64-apple-darwin }
26+
- { os: macos, runs-on: "macos-13", target: x86_64-apple-darwin }
27+
- { os: ubuntu, runs-on: "ubuntu-latest", target: aarch64-unknown-linux-gnu }
28+
- { os: ubuntu, runs-on: "ubuntu-latest", target: x86_64-unknown-linux-gnu }
29+
steps:
30+
- uses: actions/checkout@v5
31+
with:
32+
fetch-depth: 0
33+
34+
- uses: ./.github/actions/setup-rust
35+
with:
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
targets: ${{ matrix.target.target }}
38+
39+
- name: Cargo Set Version
40+
run: |
41+
cargo install cargo-edit
42+
cargo set-version --workspace ${{ inputs.version }}
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v6
46+
# Latest macOS doesn't allow maturin to install stuff into the global Python interpreter
47+
if: "${{ matrix.target.runs-on == 'macos-latest' }}"
48+
with:
49+
python-version: "3.11"
50+
51+
- name: Build wheel
52+
uses: PyO3/maturin-action@v1
53+
with:
54+
command: build
55+
target: ${{ matrix.target.target }}
56+
args: >
57+
${{ (matrix.target.os == 'ubuntu' && '--zig') || '' }}
58+
--compatibility manylinux2014
59+
--release
60+
--manifest-path vortex-python/Cargo.toml
61+
--out dist
62+
--interpreter python3.11
63+
env:
64+
MATURIN_PEP517_USE_BASE_PYTHON: "true"
65+
# Keep this constant to avoid pyo3 invalidating itself
66+
PYO3_ENVIRONMENT_SIGNATURE: "cpython3"
67+
68+
- name: Upload wheels
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: "wheels-${{ matrix.target.target }}.zip"
72+
path: dist/
73+
retention-days: 7
74+
75+
prepare-java-macos:
76+
runs-on: "macos-latest"
77+
steps:
78+
- uses: actions/checkout@v5
79+
with:
80+
fetch-depth: 0
81+
- uses: actions/setup-java@v5
82+
with:
83+
distribution: "corretto"
84+
java-version: "17"
85+
- uses: ./.github/actions/setup-rust
86+
with:
87+
repo-token: ${{ secrets.GITHUB_TOKEN }}
88+
- run: cargo build --release --package vortex-jni
89+
- uses: actions/upload-artifact@v4
90+
with:
91+
name: "libvortex_jni_aarch64-apple-darwin.zip"
92+
path: "target/release/libvortex_jni.dylib"
93+
retention-days: 7
94+
if-no-files-found: error
95+
96+
prepare-java-linux:
97+
runs-on: ${{ matrix.target.runs-on }}
98+
container:
99+
image: "ubuntu:20.04"
100+
timeout-minutes: 120
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
target:
105+
- { os: ubuntu, runs-on: "ubuntu-24.04-arm", target: aarch64-unknown-linux-gnu }
106+
- { os: ubuntu, runs-on: "ubuntu-24.04", target: x86_64-unknown-linux-gnu }
107+
steps:
108+
- uses: actions/checkout@v5
109+
with:
110+
fetch-depth: 0
111+
- run: |
112+
apt update
113+
apt install -y wget curl build-essential
114+
- name: Print GLIBC version
115+
run: ldd --version
116+
- name: Verify GLIBC version
117+
run: |
118+
set -eux
119+
120+
ldd --version | grep 'GLIBC 2.31'
121+
- uses: actions/setup-java@v5
122+
with:
123+
distribution: "corretto"
124+
java-version: "17"
125+
- uses: ./.github/actions/setup-rust
126+
with:
127+
targets: ${{ matrix.target.target }}
128+
repo-token: ${{ secrets.GITHUB_TOKEN }}
129+
- run: cargo build --release --package vortex-jni
130+
- uses: actions/upload-artifact@v4
131+
with:
132+
name: "libvortex_jni_${{ matrix.target.target }}.zip"
133+
path: "target/release/libvortex_jni.so"
134+
retention-days: 7
135+
if-no-files-found: error
136+
137+
prepare-all:
138+
needs: [prepare-python, prepare-java-macos, prepare-java-linux]
139+
runs-on: ubuntu-latest
140+
steps:
141+
- run: echo "All packages built successfully"

.github/workflows/publish.yml

Lines changed: 10 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -8,140 +8,16 @@ on:
88
types: [published]
99

1010
jobs:
11-
prepare-python:
12-
runs-on: ${{ matrix.target.runs-on }}
13-
timeout-minutes: 120
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
target:
18-
- { os: macos, runs-on: "macos-latest", target: aarch64-apple-darwin }
19-
- { os: macos, runs-on: "macos-13", target: x86_64-apple-darwin }
20-
- { os: ubuntu, runs-on: "ubuntu-latest", target: aarch64-unknown-linux-gnu }
21-
- { os: ubuntu, runs-on: "ubuntu-latest", target: x86_64-unknown-linux-gnu }
22-
environment:
23-
name: pypi
24-
url: https://pypi.org/p/vortex-data
25-
permissions:
26-
contents: read
27-
id-token: write
28-
steps:
29-
- uses: actions/checkout@v5
30-
with:
31-
fetch-depth: 0
32-
33-
- uses: ./.github/actions/setup-rust
34-
with:
35-
repo-token: ${{ secrets.GITHUB_TOKEN }}
36-
targets: ${{ matrix.target.target }}
37-
38-
- name: Cargo Set Version
39-
run: |
40-
cargo install cargo-edit
41-
cargo set-version --workspace ${{ github.event.release.tag_name || github.event.inputs.version }}
42-
43-
- name: Set up Python
44-
uses: actions/setup-python@v6
45-
# Latest macOS doesn't allow maturin to install stuff into the global Python interpreter
46-
if: "${{ matrix.target.runs-on == 'macos-latest' }}"
47-
with:
48-
python-version: "3.11"
49-
50-
- name: Build wheel
51-
uses: PyO3/maturin-action@v1
52-
with:
53-
command: build
54-
target: ${{ matrix.target.target }}
55-
args: >
56-
${{ (matrix.target.os == 'ubuntu' && '--zig') || '' }}
57-
--compatibility manylinux2014
58-
--release
59-
--manifest-path vortex-python/Cargo.toml
60-
--out dist
61-
--interpreter python3.11
62-
env:
63-
MATURIN_PEP517_USE_BASE_PYTHON: "true"
64-
# Keep this constant to avoid pyo3 invalidating itself
65-
PYO3_ENVIRONMENT_SIGNATURE: "cpython3"
66-
67-
- name: Upload wheels
68-
uses: actions/upload-artifact@v4
69-
with:
70-
name: "wheels-${{ matrix.target.target }}.zip"
71-
path: dist/
72-
73-
prepare-java-macos:
74-
runs-on: "macos-latest"
75-
steps:
76-
- uses: actions/checkout@v5
77-
with:
78-
fetch-depth: 0
79-
- uses: actions/setup-java@v5
80-
with:
81-
distribution: "corretto"
82-
java-version: "17"
83-
- uses: ./.github/actions/setup-rust
84-
with:
85-
repo-token: ${{ secrets.GITHUB_TOKEN }}
86-
- run: cargo build --release --package vortex-jni
87-
- uses: actions/upload-artifact@v4
88-
with:
89-
name: "libvortex_jni_aarch64-apple-darwin.zip"
90-
path: "target/release/libvortex_jni.dylib"
91-
retention-days: 1
92-
if-no-files-found: error
93-
94-
prepare-java-linux:
95-
runs-on: ${{ matrix.target.runs-on }}
96-
container:
97-
image: "ubuntu:20.04"
98-
timeout-minutes: 120
99-
strategy:
100-
fail-fast: false
101-
matrix:
102-
target:
103-
- { os: ubuntu, runs-on: "ubuntu-24.04-arm", target: aarch64-unknown-linux-gnu }
104-
- { os: ubuntu, runs-on: "ubuntu-24.04", target: x86_64-unknown-linux-gnu }
105-
steps:
106-
- uses: actions/checkout@v5
107-
with:
108-
fetch-depth: 0
109-
- run: |
110-
apt update
111-
apt install -y wget curl build-essential
112-
- name: Print GLIBC version
113-
run: ldd --version
114-
- name: Verify GLIBC version
115-
run: |
116-
set -eux
117-
118-
ldd --version | grep 'GLIBC 2.31'
119-
- uses: actions/setup-java@v5
120-
with:
121-
distribution: "corretto"
122-
java-version: "17"
123-
- uses: ./.github/actions/setup-rust
124-
with:
125-
targets: ${{ matrix.target.target }}
126-
repo-token: ${{ secrets.GITHUB_TOKEN }}
127-
- run: cargo build --release --package vortex-jni
128-
- uses: actions/upload-artifact@v4
129-
with:
130-
name: "libvortex_jni_${{ matrix.target.target }}.zip"
131-
path: "target/release/libvortex_jni.so"
132-
retention-days: 1
133-
if-no-files-found: error
134-
135-
prepare-all:
136-
needs: [prepare-python, prepare-java-macos, prepare-java-linux]
137-
runs-on: ubuntu-latest
138-
steps:
139-
- run: echo built # GitHub requires at least one step.
11+
package:
12+
uses: ./.github/workflows/package.yml
13+
with:
14+
version: ${{ github.event.release.tag_name }}
15+
secrets: inherit
14016

14117
publish-rust:
14218
runs-on: ubuntu-latest
14319
timeout-minutes: 120
144-
needs: [prepare-all]
20+
needs: [package]
14521
steps:
14622
- uses: actions/checkout@v5
14723
with:
@@ -154,7 +30,7 @@ jobs:
15430
- name: Cargo Set Version
15531
run: |
15632
cargo install cargo-edit
157-
cargo set-version --workspace ${{ github.event.release.tag_name || github.event.inputs.version }}
33+
cargo set-version --workspace ${{ github.event.release.tag_name }}
15834
15935
- name: Release
16036
run: |
@@ -171,7 +47,7 @@ jobs:
17147
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
17248

17349
publish-python:
174-
needs: [prepare-all]
50+
needs: [package]
17551
runs-on: ubuntu-latest
17652
timeout-minutes: 120
17753
permissions:
@@ -197,12 +73,12 @@ jobs:
19773
skip-existing: true # Idempotent releases
19874

19975
publish-java:
200-
needs: [prepare-all]
76+
needs: [package]
20177
runs-on: ubuntu-latest
20278
timeout-minutes: 120
20379
env:
20480
# Picked up by gradle-git-version
205-
GIT_VERSION: ${{ github.event.release.tag_name || github.event.inputs.version }}
81+
GIT_VERSION: ${{ github.event.release.tag_name }}
20682
defaults:
20783
run:
20884
working-directory: ./java

0 commit comments

Comments
 (0)