Skip to content

Commit 6595ae2

Browse files
committed
chore(ci): PR workflow - build native once for all jobs (speedup builds)
chore(ci): PR workflow - build native once for all jobs (speedup builds) chore: use env variable chore: use env variable chore: use env variable chore: drop unused chore: name chore: correct cache chore: fix build chore: fix build chore: fix build chore: align
1 parent 6c8564f commit 6595ae2

File tree

1 file changed

+88
-81
lines changed

1 file changed

+88
-81
lines changed

.github/workflows/push.yml

Lines changed: 88 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,21 @@ on:
4141

4242
env:
4343
CUBEJS_TESSERACT_ORCHESTRATOR: true
44+
# Current user version for Python. Should be aligned between build-native & docker-dev
45+
PYTHON_VERSION_CURRENT: 3.11
4446

4547
jobs:
4648
unit:
4749
runs-on: ubuntu-24.04
4850
timeout-minutes: 60
49-
needs: latest-tag-sha
51+
needs: [latest-tag-sha, build-native-linux]
5052
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
5153

5254
strategy:
5355
matrix:
5456
# Current docker version + next LTS
5557
node-version: [20.x, 22.x]
58+
# Don't forget to update build-native-release
5659
python-version: [3.11]
5760
transpile-worker-threads: [false, true]
5861
fail-fast: false
@@ -69,13 +72,11 @@ jobs:
6972
with:
7073
# pulls all commits (needed for codecov)
7174
fetch-depth: 2
72-
- name: Install Rust
73-
uses: actions-rust-lang/setup-rust-toolchain@v1
75+
- name: Download backend-native artifact
76+
uses: actions/download-artifact@v4
7477
with:
75-
toolchain: 1.84.1
76-
# override: true # this is by default on
77-
rustflags: ""
78-
components: rustfmt
78+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node"
79+
path: ./packages/cubejs-backend-native/
7980
- name: Install Node.js ${{ matrix.node-version }}
8081
uses: actions/setup-node@v4
8182
with:
@@ -111,11 +112,6 @@ jobs:
111112
run: yarn tsc
112113
- name: Build client
113114
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 }}
119115
- name: Lerna test
120116
run: yarn lerna run --concurrency 1 --stream --no-prefix unit
121117
# - uses: codecov/codecov-action@v1
@@ -304,8 +300,60 @@ jobs:
304300
path: ./rust/cubestore/target/release/cubestored
305301
retention-days: 5
306302

303+
build-native-linux:
304+
runs-on: ubuntu-24.04
305+
timeout-minutes: 60
306+
name: "Build native linux (Python: ${{ matrix.python-version }})"
307+
strategy:
308+
matrix:
309+
# Don't forget to align with PYTHON_VERSION_CURRENT
310+
python-version: [ 3.11 ]
311+
fail-fast: false
312+
container:
313+
image: cubejs/rust-cross:x86_64-unknown-linux-gnu-15082024-python-${{ matrix.python-version }}
314+
steps:
315+
- name: Checkout
316+
uses: actions/checkout@v4
317+
- name: Install Rust
318+
uses: actions-rust-lang/setup-rust-toolchain@v1
319+
with:
320+
toolchain: 1.84.1
321+
# override: true # this is by default on
322+
rustflags: ""
323+
components: rustfmt
324+
target: x86_64-unknown-linux-gnu
325+
cache: false
326+
- uses: Swatinem/rust-cache@v2
327+
with:
328+
workspaces: ./packages/cubejs-backend-native
329+
key: native-${{ runner.OS }}-x86_64-unknown-linux-gnu
330+
shared-key: native-${{ runner.OS }}-x86_64-unknown-linux-gnu
331+
- name: Install Node.js 20
332+
uses: actions/setup-node@v4
333+
with:
334+
node-version: 20
335+
- name: Install Yarn
336+
run: npm install -g yarn
337+
- name: Set Yarn version
338+
run: yarn policies set-version v1.22.22
339+
# We don't need to install all yarn deps to build native
340+
- name: Install cargo-cp-artifact
341+
run: npm install -g [email protected]
342+
- name: Build native (with Python)
343+
env:
344+
PYO3_PYTHON: python${{ env.PYTHON_VERSION_CURRENT }}
345+
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
346+
working-directory: ./packages/cubejs-backend-native
347+
run: yarn run native:build-release-python
348+
- name: Store build artifact for dev image
349+
uses: actions/upload-artifact@v4
350+
with:
351+
name: "native-linux-x64-glibc-${{ env.PYTHON_VERSION_CURRENT }}.node"
352+
path: ./packages/cubejs-backend-native/index.node
353+
overwrite: true
354+
307355
integration-cubestore:
308-
needs: [latest-tag-sha, build-cubestore]
356+
needs: [latest-tag-sha, build-cubestore, build-native-linux]
309357
runs-on: ubuntu-24.04
310358
timeout-minutes: 60
311359
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -334,17 +382,14 @@ jobs:
334382
df -h
335383
- name: Checkout
336384
uses: actions/checkout@v4
337-
- name: Install Rust
338-
uses: actions-rust-lang/setup-rust-toolchain@v1
339-
with:
340-
toolchain: 1.84.1
341-
# override: true # this is by default on
342-
rustflags: ""
343-
components: rustfmt
344385
- name: Install Node.js ${{ matrix.node-version }}
345386
uses: actions/setup-node@v4
346387
with:
347388
node-version: ${{ matrix.node-version }}
389+
- name: Install Python
390+
uses: actions/setup-python@v5
391+
with:
392+
python-version: ${{ env.PYTHON_VERSION_CURRENT }}
348393
- name: Get yarn cache directory path
349394
id: yarn-cache-dir-path
350395
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
@@ -370,10 +415,12 @@ jobs:
370415
command: yarn install --frozen-lockfile
371416
- name: Lerna tsc
372417
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
376-
- name: Download cubestored-x86_64-unknown-linux-gnu-release artifact
418+
- name: Download backend-native artifact
419+
uses: actions/download-artifact@v4
420+
with:
421+
name: "native-linux-x64-glibc-${{ env.PYTHON_VERSION_CURRENT }}.node"
422+
path: ./packages/cubejs-backend-native/
423+
- name: Download cubestored artifact
377424
uses: actions/download-artifact@v4
378425
with:
379426
path: ./rust/cubestore/target/release/
@@ -388,7 +435,7 @@ jobs:
388435
yarn lerna run --concurrency 1 --stream --no-prefix integration:cubestore
389436
390437
integration:
391-
needs: [unit, lint, latest-tag-sha]
438+
needs: [unit, lint, latest-tag-sha, build-native-linux]
392439
runs-on: ubuntu-24.04
393440
timeout-minutes: 60
394441
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -411,6 +458,11 @@ jobs:
411458
steps:
412459
- name: Checkout
413460
uses: actions/checkout@v4
461+
- name: Download backend-native artifact
462+
uses: actions/download-artifact@v4
463+
with:
464+
name: "native-linux-x64-glibc-${{ env.PYTHON_VERSION_CURRENT }}.node"
465+
path: ./packages/cubejs-backend-native/
414466
- name: Install Rust
415467
uses: actions-rust-lang/setup-rust-toolchain@v1
416468
with:
@@ -447,9 +499,6 @@ jobs:
447499
command: yarn install --frozen-lockfile
448500
- name: Lerna tsc
449501
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
453502
- name: Run Integration tests for ${{ matrix.db }} matrix
454503
uses: nick-fields/retry@v3
455504
with:
@@ -475,7 +524,7 @@ jobs:
475524
DRIVERS_TESTS_DREMIO_CUBEJS_DB_DREMIO_AUTH_TOKEN: ${{ secrets.DRIVERS_TESTS_DREMIO_CUBEJS_DB_DREMIO_AUTH_TOKEN }}
476525

477526
integration-smoke:
478-
needs: [ latest-tag-sha, build-cubestore ]
527+
needs: [latest-tag-sha, build-cubestore, build-native-linux]
479528
runs-on: ubuntu-24.04
480529
timeout-minutes: 90
481530
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
@@ -505,6 +554,11 @@ jobs:
505554
df -h
506555
- name: Checkout
507556
uses: actions/checkout@v4
557+
- name: Download backend-native artifact
558+
uses: actions/download-artifact@v4
559+
with:
560+
name: "native-linux-x64-glibc-${{ matrix.python-version }}.node"
561+
path: ./packages/cubejs-backend-native/
508562
- name: Install Node.js ${{ matrix.node-version }}
509563
uses: actions/setup-node@v4
510564
with:
@@ -540,11 +594,6 @@ jobs:
540594
uses: GoodManWEN/oracle-client-action@main
541595
- name: Build client
542596
run: yarn build
543-
- name: Build cubejs-backend-native (with Python)
544-
run: yarn run native:build-release-python
545-
working-directory: ./packages/cubejs-backend-native
546-
env:
547-
PYO3_PYTHON: python${{ matrix.python-version }}
548597
- name: Lerna tsc
549598
run: yarn tsc
550599
- name: Download cubestored-x86_64-unknown-linux-gnu-release artifact
@@ -598,7 +647,7 @@ jobs:
598647
OUT: ${{ steps.get-tag.outputs.sha }}
599648

600649
docker-dev:
601-
needs: [latest-tag-sha]
650+
needs: [latest-tag-sha, build-native-linux]
602651
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
603652
name: Build & Test :dev for ${{ matrix.name }} without pushing
604653
runs-on: ubuntu-22.04
@@ -638,57 +687,15 @@ jobs:
638687
df -h
639688
- name: Checkout
640689
uses: actions/checkout@v4
641-
- name: Install Rust
642-
uses: actions-rust-lang/setup-rust-toolchain@v1
690+
- name: Download backend-native artifact
691+
uses: actions/download-artifact@v4
643692
with:
644-
toolchain: 1.84.1
645-
# override: true # this is by default on
646-
rustflags: ""
647-
components: rustfmt
648-
target: ${{ matrix.target }}
693+
name: "native-linux-x64-glibc-${{ env.PYTHON_VERSION_CURRENT }}.node"
694+
path: ./packages/cubejs-backend-native/
649695
- name: Install Node.js ${{ matrix.node-version }}
650696
uses: actions/setup-node@v4
651697
with:
652698
node-version: ${{ matrix.node-version }}
653-
- name: Install Yarn
654-
run: npm install -g yarn
655-
- name: Set Yarn version
656-
run: yarn policies set-version v1.22.22
657-
- name: Install cargo-cp-artifact
658-
run: npm install -g [email protected]
659-
- uses: Swatinem/rust-cache@v2
660-
with:
661-
workspaces: ./packages/cubejs-backend-native
662-
key: native-${{ runner.OS }}-${{ matrix.target }}
663-
shared-key: native-${{ runner.OS }}-${{ matrix.target }}
664-
- name: Get yarn cache directory path
665-
id: yarn-cache-dir-path
666-
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
667-
shell: bash
668-
- name: Restore yarn cache
669-
uses: actions/cache@v4
670-
with:
671-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
672-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
673-
restore-keys: |
674-
${{ runner.os }}-yarn-
675-
- name: Yarn install
676-
uses: nick-fields/retry@v3
677-
env:
678-
CUBESTORE_SKIP_POST_INSTALL: true
679-
with:
680-
max_attempts: 3
681-
retry_on: error
682-
retry_wait_seconds: 15
683-
timeout_minutes: 20
684-
command: yarn install --frozen-lockfile
685-
- name: Build client
686-
run: yarn build
687-
- name: Lerna tsc
688-
run: yarn tsc
689-
- name: Build cubejs-backend-native (without Python)
690-
run: yarn run native:build-release
691-
working-directory: ./packages/cubejs-backend-native
692699
- name: Set up QEMU
693700
uses: docker/setup-qemu-action@v3
694701
# current .dockerignore prevents use of native build

0 commit comments

Comments
 (0)