From 4466e3ac6014bb14176448e9b80824fe87318f47 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 10 Jul 2024 22:04:01 +0900 Subject: [PATCH 1/5] chore(ci): Publish - speedup --- .github/workflows/publish.yml | 58 ++++++++--------------------------- 1 file changed, 13 insertions(+), 45 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 28876fd434d36..e229f7425c014 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,7 +8,7 @@ on: jobs: npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 permissions: contents: write @@ -39,8 +39,6 @@ jobs: ${{ runner.os }}-yarn- - name: Set Yarn version run: yarn policies set-version v1.22.19 - - name: Copy yarn.lock file - run: cp yarn.lock packages/cubejs-docker - name: Yarn install uses: nick-fields/retry@v3 env: @@ -106,19 +104,9 @@ jobs: run: npm install -g yarn - name: Set Yarn version run: yarn policies set-version v1.22.19 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" - shell: bash - - name: Restore yarn cache - uses: actions/cache@v4 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Copy yarn.lock file - run: cp yarn.lock packages/cubejs-docker + # We don't need to install all yarn deps to build native + - name: Install cargo-cp-artifact + run: npm install -g cargo-cp-artifact@0.1 - name: Yarn install uses: nick-fields/retry@v3 env: @@ -219,21 +207,11 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" - shell: bash - - name: Restore yarn cache - uses: actions/cache@v4 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Set Yarn version run: yarn policies set-version v1.22.19 - - name: Copy yarn.lock file - run: cp yarn.lock packages/cubejs-docker + # We don't need to install all yarn deps to build native + - name: Install cargo-cp-artifact + run: npm install -g cargo-cp-artifact@0.1 - name: Yarn install uses: nick-fields/retry@v3 env: @@ -315,21 +293,11 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" - shell: bash - - name: Restore yarn cache - uses: actions/cache@v4 - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Set Yarn version run: yarn policies set-version v1.22.19 - - name: Copy yarn.lock file - run: cp yarn.lock packages/cubejs-docker + # We don't need to install all yarn deps to build native + - name: Install cargo-cp-artifact + run: npm install -g cargo-cp-artifact@0.1 - name: Yarn install uses: nick-fields/retry@v3 env: @@ -455,7 +423,7 @@ jobs: docker-debian-jdk: needs: [npm, cubestore_linux, native_linux] name: Debian with jdk docker image - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 30 permissions: contents: write @@ -536,7 +504,7 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 + - os: ubuntu-24.04 target: x86_64-unknown-linux-gnu platforms: linux/amd64 build-args: WITH_AVX2=1 @@ -549,7 +517,7 @@ jobs: postfix: "-arm64v8" tag: "arm64v8" # Non AVX build - - os: ubuntu-20.04 + - os: ubuntu-24.04 target: x86_64-unknown-linux-gnu platforms: linux/amd64 build-args: WITH_AVX2=0 From 9c7c2f2818bd3f5cdb6e38f306374a6af79e56cc Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 10 Jul 2024 23:33:40 +0900 Subject: [PATCH 2/5] chore: introduce cubejs/rust-builder --- rust/cubestore/Dockerfile | 26 +------------------------- rust/cubestore/builder.Dockerfile | 29 +++++++++++++++++++++++++++++ rust/cubestore/docker-bake.hcl | 10 ++++++++++ rust/cubestore/rust-toolchain.toml | 2 +- 4 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 rust/cubestore/builder.Dockerfile create mode 100644 rust/cubestore/docker-bake.hcl diff --git a/rust/cubestore/Dockerfile b/rust/cubestore/Dockerfile index a3a9a5b05792f..6307cffd7c605 100644 --- a/rust/cubestore/Dockerfile +++ b/rust/cubestore/Dockerfile @@ -1,28 +1,4 @@ -FROM rust:1-bookworm AS builder - -RUN rustup update && \ - rustup default nightly-2024-01-10 && \ - rustup component add --toolchain nightly-2024-01-10 rustfmt; - -RUN apt update \ - && apt upgrade -y \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common pkg-config wget gnupg git apt-transport-https ca-certificates \ - && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ - # https://github.com/llvm/llvm-project/issues/62475 \ - # add it twice to workaround: - && add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-18 main" \ - && add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-18 main" \ - && sleep 5 \ - && apt update \ - && apt install -y git llvm-18 clang-18 libclang-18-dev clang-18 cmake \ - && rm -rf /var/lib/apt/lists/*; - -RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 -RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-18 100 -RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-18 100 - -WORKDIR /usr/src +FROM cubejs/rust-builder:bookworm-llvm-18 AS builder WORKDIR /build/cubestore COPY Cargo.toml . diff --git a/rust/cubestore/builder.Dockerfile b/rust/cubestore/builder.Dockerfile new file mode 100644 index 0000000000000..635f0da283387 --- /dev/null +++ b/rust/cubestore/builder.Dockerfile @@ -0,0 +1,29 @@ +ARG OS_NAME=bookworm-slim + +FROM rust:$OS_NAME + +ARG LLVM_VERSION=18 + +RUN rustup update && \ + rustup default nightly-2024-01-29 && \ + rustup component add --toolchain nightly-2024-01-29 rustfmt clippy; + +RUN apt update \ + && apt upgrade -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common libssl-dev pkg-config wget gnupg git apt-transport-https ca-certificates \ + && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ + # https://github.com/llvm/llvm-project/issues/62475 \ + # add it twice to workaround: + && add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \ + && add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \ + && sleep 5 \ + && apt update \ + && apt install -y git llvm-$LLVM_VERSION clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev clang-$LLVM_VERSION cmake \ + && rm -rf /var/lib/apt/lists/*; + +RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100 +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 +RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-$LLVM_VERSION 100 +RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-$LLVM_VERSION 100 + +WORKDIR /usr/src diff --git a/rust/cubestore/docker-bake.hcl b/rust/cubestore/docker-bake.hcl new file mode 100644 index 0000000000000..8f390a2b89a4e --- /dev/null +++ b/rust/cubestore/docker-bake.hcl @@ -0,0 +1,10 @@ +target "rust-builder-bookworm" { + context = "." + dockerfile = "builder.Dockerfile" + args = { + OS_NAME = "1-slim-bookworm" + LLVM_VERSION = "18" + } + tags = ["cubejs/rust-builder:bookworm-llvm-18"] + platforms = ["linux/amd64", "linux/arm64"] +} diff --git a/rust/cubestore/rust-toolchain.toml b/rust/cubestore/rust-toolchain.toml index ee3a523511814..ff511a5586793 100644 --- a/rust/cubestore/rust-toolchain.toml +++ b/rust/cubestore/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2024-01-29" -components = ["rustfmt", "rustc-dev", "clippy"] +components = ["rustfmt", "clippy"] profile = "minimal" From 5803807e4e8c904daa4d3421d8f6456ac748ced4 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Wed, 10 Jul 2024 23:34:00 +0900 Subject: [PATCH 3/5] chore: sync llvm --- .github/workflows/publish.yml | 2 +- .github/workflows/rust-cubestore-master.yml | 2 +- .github/workflows/rust-cubestore.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e229f7425c014..c481abdfaedac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -734,7 +734,7 @@ jobs: run: vcpkg integrate install; vcpkg install openssl:x64-windows - name: Instal LLVM for Windows if: ${{ startsWith(matrix.os, 'windows') }} - run: choco install -y --force llvm --version 18.1.2 + run: choco install -y --force llvm --version 18.1.6 - name: Set Env Variables for Windows uses: allenevans/set-env@v4.0.0 if: ${{ startsWith(matrix.os, 'windows') }} diff --git a/.github/workflows/rust-cubestore-master.yml b/.github/workflows/rust-cubestore-master.yml index 333bf6f0e0192..c3d46fbc86d9f 100644 --- a/.github/workflows/rust-cubestore-master.yml +++ b/.github/workflows/rust-cubestore-master.yml @@ -223,7 +223,7 @@ jobs: run: vcpkg integrate install; vcpkg install openssl:x64-windows - name: Instal LLVM for Windows if: ${{ startsWith(matrix.os, 'windows') }} - run: choco install -y --force llvm --version 18.1.2 + run: choco install -y --force llvm --version 18.1.6 - name: Set Env Variables for Windows uses: allenevans/set-env@v3.0.0 if: ${{ startsWith(matrix.os, 'windows') }} diff --git a/.github/workflows/rust-cubestore.yml b/.github/workflows/rust-cubestore.yml index 5557355d8295b..35487fb332a07 100644 --- a/.github/workflows/rust-cubestore.yml +++ b/.github/workflows/rust-cubestore.yml @@ -154,7 +154,7 @@ jobs: run: vcpkg integrate install; vcpkg install openssl:x64-windows - name: Instal LLVM for Windows if: ${{ startsWith(matrix.os, 'windows') }} - run: choco install -y --force llvm --version 18.1.2 + run: choco install -y --force llvm --version 18.1.6 - name: Set Env Variables for Windows uses: allenevans/set-env@v3.0.0 if: ${{ startsWith(matrix.os, 'windows') }} From 0ee3239baf2e7e28afa0e31a5b87deb851dfab0e Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Thu, 11 Jul 2024 00:14:57 +0900 Subject: [PATCH 4/5] chore: use gha cache --- .github/workflows/rust-cubestore-master.yml | 13 ++----------- .github/workflows/rust-cubestore.yml | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/rust-cubestore-master.yml b/.github/workflows/rust-cubestore-master.yml index c3d46fbc86d9f..39097bbb290d9 100644 --- a/.github/workflows/rust-cubestore-master.yml +++ b/.github/workflows/rust-cubestore-master.yml @@ -143,15 +143,6 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - with: - version: v0.9.1 - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ matrix.target }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.target }}-buildx- - name: Push to Docker Hub uses: docker/build-push-action@v3 with: @@ -161,8 +152,8 @@ jobs: build-args: ${{ matrix.build-args }} push: true tags: ${{ steps.prep.outputs.tags }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=gha + cache-to: type=gha,mode=max labels: | org.opencontainers.image.title=${{ fromJson(steps.repo.outputs.result).name }} org.opencontainers.image.description=${{ fromJson(steps.repo.outputs.result).description }} diff --git a/.github/workflows/rust-cubestore.yml b/.github/workflows/rust-cubestore.yml index 35487fb332a07..07495623d8fdb 100644 --- a/.github/workflows/rust-cubestore.yml +++ b/.github/workflows/rust-cubestore.yml @@ -91,15 +91,6 @@ jobs: uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - with: - version: v0.9.1 - - name: Cache Docker layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-${{ matrix.target }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.target }}-buildx- - name: Build only uses: docker/build-push-action@v3 with: @@ -108,8 +99,8 @@ jobs: platforms: ${{ matrix.platforms }} build-args: ${{ matrix.build-args }} push: false - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=gha + cache-to: type=gha,mode=max cubestore: runs-on: ${{ matrix.os }} From 65b0de9dbd0eeda10fefaa40e2f4782aeb91cac9 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Thu, 11 Jul 2024 00:15:21 +0900 Subject: [PATCH 5/5] chore: bump action --- .github/workflows/rust-cubestore-master.yml | 2 +- .github/workflows/rust-cubestore.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust-cubestore-master.yml b/.github/workflows/rust-cubestore-master.yml index 39097bbb290d9..5b84143c563af 100644 --- a/.github/workflows/rust-cubestore-master.yml +++ b/.github/workflows/rust-cubestore-master.yml @@ -142,7 +142,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Push to Docker Hub uses: docker/build-push-action@v3 with: diff --git a/.github/workflows/rust-cubestore.yml b/.github/workflows/rust-cubestore.yml index 07495623d8fdb..ef163d07923f2 100644 --- a/.github/workflows/rust-cubestore.yml +++ b/.github/workflows/rust-cubestore.yml @@ -90,7 +90,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build only uses: docker/build-push-action@v3 with: