From 30fb7d61d8f97e651f98fc72be171c51f52d5076 Mon Sep 17 00:00:00 2001 From: Dmitry Patsura Date: Tue, 2 Apr 2024 19:50:04 +0200 Subject: [PATCH] chore: build without cross --- .github/workflows/rust-cubestore.yml | 76 ++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust-cubestore.yml b/.github/workflows/rust-cubestore.yml index d1da0df86c993..32c6b05a50f1e 100644 --- a/.github/workflows/rust-cubestore.yml +++ b/.github/workflows/rust-cubestore.yml @@ -118,7 +118,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache - cross: + cubestore: runs-on: ${{ matrix.os }} timeout-minutes: 90 env: @@ -180,9 +180,6 @@ jobs: workspaces: ./rust/cubestore -> target prefix-key: v0-rust-cubestore-cross key: target-${{ matrix.target }} - - run: source .github/actions/${{ matrix.before_script }}.sh - if: ${{ matrix.before_script }} - shell: bash - uses: ilammy/msvc-dev-cmd@v1 if: ${{ startsWith(matrix.os, 'windows') }} - name: Install OpenSSL for Windows @@ -243,3 +240,74 @@ jobs: path: cubestore-archive/cubestored-${{ matrix.target }}.tar.gz name: cubestored-${{ matrix.target }}.tar.gz retention-days: 1 + + cubestore_linux: + runs-on: ${{ matrix.os }} + timeout-minutes: 90 + env: + RUSTFLAGS: '-Ctarget-feature=+crt-static' + OPENSSL_STATIC: 1 + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - x86_64-pc-windows-msvc + - x86_64-apple-darwin + - aarch64-unknown-linux-gnu + include: + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + executable_name: cubestored + strip: true + compress: false + - os: ubuntu-22.04 + target: x86_64-unknown-linux-musl + executable_name: cubestored + strip: true + # cubestored: CantPackException: bad DT_HASH nbucket=0x344 len=0x1890 + compress: false + - os: ubuntu-22.04 + target: aarch64-unknown-linux-gnu + executable_name: cubestored + # Unable to recognise the format of the input file `rust/cubestore/target/aarch64-unknown-linux-gnu/release/cubestored' + strip: false + # UPX is broken, issue https://github.com/cube-js/cube/issues/4474 + compress: false + fail-fast: false + container: + image: cubejs/rust-cross:${{ matrix.target }}-02042024 + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + workspaces: ./rust/cubestore -> target + prefix-key: v0-rust-cubestore-cross + key: target-${{ matrix.target }} + - name: Build with Cargo + run: | + cd rust/cubestore && cargo build --release --target=${{ matrix.target }} + - name: Compress binaries + uses: svenstaro/upx-action@v2 + if: ${{ matrix.compress }} + with: + file: rust/cubestore/target/${{ matrix.target }}/release/${{ matrix.executable_name }} + args: --lzma + strip: ${{ matrix.strip }} + - name: Create folder for archive + run: | + mkdir cubestore-archive + mkdir cubestore-archive/bin + - name: Copy/paste OpenSSL to Archive (hotfix for Windows) + if: ${{ startsWith(matrix.os, 'windows') }} + run: cp C:/vcpkg/packages/openssl_x64-windows/bin/*.dll cubestore-archive/bin + - name: Create archive for release + run: | + mv rust/cubestore/target/${{ matrix.target }}/release/${{ matrix.executable_name }} cubestore-archive/bin/${{ matrix.executable_name }} + cd cubestore-archive + tar -cvzf cubestored-${{ matrix.target }}.tar.gz * + - uses: actions/upload-artifact@v2 + with: + path: cubestore-archive/cubestored-${{ matrix.target }}.tar.gz + name: cubestored-${{ matrix.target }}.tar.gz + retention-days: 1