Skip to content

Commit 3136016

Browse files
committed
chore(ci): PR workflow - build native once for all jobs (speedup builds)
1 parent 7e363f7 commit 3136016

File tree

1 file changed

+75
-38
lines changed

1 file changed

+75
-38
lines changed

.github/workflows/push.yml

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ jobs:
4646
unit:
4747
runs-on: ubuntu-24.04
4848
timeout-minutes: 60
49-
needs: latest-tag-sha
49+
needs: [latest-tag-sha, build-native-linux]
5050
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
5151

5252
strategy:
5353
matrix:
5454
# Current docker version + next LTS
5555
node-version: [20.x, 22.x]
56+
# Don't forget to update build-native-release
5657
python-version: [3.11]
5758
transpile-worker-threads: [false, true]
5859
fail-fast: false
@@ -69,13 +70,11 @@ jobs:
6970
with:
7071
# pulls all commits (needed for codecov)
7172
fetch-depth: 2
72-
- name: Install Rust
73-
uses: actions-rust-lang/setup-rust-toolchain@v1
73+
- name: Download backend-native artifact
74+
uses: actions/download-artifact@v4
7475
with:
75-
toolchain: 1.84.1
76-
# override: true # this is by default on
77-
rustflags: ""
78-
components: rustfmt
76+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node" # this name is referenced in above in native_linux
77+
path: ./packages/cubejs-backend-native/
7978
- name: Install Node.js ${{ matrix.node-version }}
8079
uses: actions/setup-node@v4
8180
with:
@@ -111,11 +110,6 @@ jobs:
111110
run: yarn tsc
112111
- name: Build client
113112
run: yarn build
114-
- name: Build cubejs-backend-native (with Python)
115-
run: yarn run native:build-release-python
116-
working-directory: ./packages/cubejs-backend-native
117-
env:
118-
PYO3_PYTHON: python${{ matrix.python-version }}
119113
- name: Lerna test
120114
run: yarn lerna run --concurrency 1 --stream --no-prefix unit
121115
# - uses: codecov/codecov-action@v1
@@ -304,8 +298,56 @@ jobs:
304298
path: ./rust/cubestore/target/release/cubestored
305299
retention-days: 5
306300

301+
build-native-linux:
302+
runs-on: ubuntu-22.04
303+
timeout-minutes: 60
304+
name: Build Linux Native backend for Dev image
305+
container:
306+
image: cubejs/rust-cross:x86_64-unknown-linux-gnu-15082024-python-3.11
307+
308+
steps:
309+
- name: Checkout
310+
uses: actions/checkout@v4
311+
- name: Install Rust
312+
uses: actions-rust-lang/setup-rust-toolchain@v1
313+
with:
314+
toolchain: 1.84.1
315+
# override: true # this is by default on
316+
rustflags: ""
317+
components: rustfmt
318+
target: x86_64-unknown-linux-gnu
319+
cache: false
320+
- uses: Swatinem/rust-cache@v2
321+
with:
322+
workspaces: ./rust/cubesql -> target
323+
key: cubesql-x86_64-unknown-linux-gnu
324+
shared-key: cubesql-x86_64-unknown-linux-gnu
325+
- name: Install Node.js 20
326+
uses: actions/setup-node@v4
327+
with:
328+
node-version: 20
329+
- name: Install Yarn
330+
run: npm install -g yarn
331+
- name: Set Yarn version
332+
run: yarn policies set-version v1.22.22
333+
# We don't need to install all yarn deps to build native
334+
- name: Install cargo-cp-artifact
335+
run: npm install -g [email protected]
336+
- name: Build native (with Python)
337+
env:
338+
PYO3_PYTHON: python3.11
339+
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
340+
working-directory: ./packages/cubejs-backend-native
341+
run: yarn run native:build-release-python
342+
- name: Store build artifact for dev image
343+
uses: actions/upload-artifact@v4
344+
with:
345+
name: "native-linux-x64-glibc-3.11.node" # this name is referenced below in docker-image-dev
346+
path: ./packages/cubejs-backend-native/index.node
347+
overwrite: true
348+
307349
integration-cubestore:
308-
needs: [latest-tag-sha, build-cubestore]
350+
needs: [latest-tag-sha, build-cubestore, build-native-linux]
309351
runs-on: ubuntu-24.04
310352
timeout-minutes: 60
311353
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -334,13 +376,11 @@ jobs:
334376
df -h
335377
- name: Checkout
336378
uses: actions/checkout@v4
337-
- name: Install Rust
338-
uses: actions-rust-lang/setup-rust-toolchain@v1
379+
- name: Download backend-native artifact
380+
uses: actions/download-artifact@v4
339381
with:
340-
toolchain: 1.84.1
341-
# override: true # this is by default on
342-
rustflags: ""
343-
components: rustfmt
382+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node" # this name is referenced in above in native_linux
383+
path: ./packages/cubejs-backend-native/
344384
- name: Install Node.js ${{ matrix.node-version }}
345385
uses: actions/setup-node@v4
346386
with:
@@ -370,9 +410,6 @@ jobs:
370410
command: yarn install --frozen-lockfile
371411
- name: Lerna tsc
372412
run: yarn tsc
373-
- name: Build cubejs-backend-native (without Python)
374-
run: yarn run native:build-release
375-
working-directory: ./packages/cubejs-backend-native
376413
- name: Download cubestored-x86_64-unknown-linux-gnu-release artifact
377414
uses: actions/download-artifact@v4
378415
with:
@@ -388,7 +425,7 @@ jobs:
388425
yarn lerna run --concurrency 1 --stream --no-prefix integration:cubestore
389426
390427
integration:
391-
needs: [unit, lint, latest-tag-sha]
428+
needs: [unit, lint, latest-tag-sha, build-native-linux]
392429
runs-on: ubuntu-24.04
393430
timeout-minutes: 60
394431
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -411,6 +448,11 @@ jobs:
411448
steps:
412449
- name: Checkout
413450
uses: actions/checkout@v4
451+
- name: Download backend-native artifact
452+
uses: actions/download-artifact@v4
453+
with:
454+
name: "native-linux-x64-glibc-3.11.node" # this name is referenced in above in native_linux
455+
path: ./packages/cubejs-backend-native/
414456
- name: Install Rust
415457
uses: actions-rust-lang/setup-rust-toolchain@v1
416458
with:
@@ -447,9 +489,6 @@ jobs:
447489
command: yarn install --frozen-lockfile
448490
- name: Lerna tsc
449491
run: yarn tsc
450-
- name: Build cubejs-backend-native (without Python)
451-
run: yarn run native:build-release
452-
working-directory: ./packages/cubejs-backend-native
453492
- name: Run Integration tests for ${{ matrix.db }} matrix
454493
uses: nick-fields/retry@v3
455494
with:
@@ -475,7 +514,7 @@ jobs:
475514
DRIVERS_TESTS_DREMIO_CUBEJS_DB_DREMIO_AUTH_TOKEN: ${{ secrets.DRIVERS_TESTS_DREMIO_CUBEJS_DB_DREMIO_AUTH_TOKEN }}
476515

477516
integration-smoke:
478-
needs: [ latest-tag-sha, build-cubestore ]
517+
needs: [latest-tag-sha, build-cubestore, build-native-linux]
479518
runs-on: ubuntu-24.04
480519
timeout-minutes: 90
481520
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -505,6 +544,11 @@ jobs:
505544
df -h
506545
- name: Checkout
507546
uses: actions/checkout@v4
547+
- name: Download backend-native artifact
548+
uses: actions/download-artifact@v4
549+
with:
550+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node" # this name is referenced in above in native_linux
551+
path: ./packages/cubejs-backend-native/
508552
- name: Install Node.js ${{ matrix.node-version }}
509553
uses: actions/setup-node@v4
510554
with:
@@ -540,8 +584,6 @@ jobs:
540584
uses: GoodManWEN/oracle-client-action@main
541585
- name: Build client
542586
run: yarn build
543-
- name: Build cubejs-backend-native (with Python)
544-
run: yarn run native:build-release-python
545587
working-directory: ./packages/cubejs-backend-native
546588
env:
547589
PYO3_PYTHON: python${{ matrix.python-version }}
@@ -638,14 +680,11 @@ jobs:
638680
df -h
639681
- name: Checkout
640682
uses: actions/checkout@v4
641-
- name: Install Rust
642-
uses: actions-rust-lang/setup-rust-toolchain@v1
683+
- name: Download backend-native artifact
684+
uses: actions/download-artifact@v4
643685
with:
644-
toolchain: 1.84.1
645-
# override: true # this is by default on
646-
rustflags: ""
647-
components: rustfmt
648-
target: ${{ matrix.target }}
686+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node" # this name is referenced in above in native_linux
687+
path: ./packages/cubejs-backend-native/
649688
- name: Install Node.js ${{ matrix.node-version }}
650689
uses: actions/setup-node@v4
651690
with:
@@ -686,8 +725,6 @@ jobs:
686725
run: yarn build
687726
- name: Lerna tsc
688727
run: yarn tsc
689-
- name: Build cubejs-backend-native (without Python)
690-
run: yarn run native:build-release
691728
working-directory: ./packages/cubejs-backend-native
692729
- name: Set up QEMU
693730
uses: docker/setup-qemu-action@v3

0 commit comments

Comments
 (0)