Skip to content

Commit

Permalink
ci: ci-cloud build both amd64 & arm64 (#14317)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Jan 14, 2024
1 parent b9a4726 commit 023972b
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions .github/workflows/cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ env:
RUNNER_PROVIDER: gcp

jobs:
build:
info:
if: contains(github.event.pull_request.labels.*.name, 'ci-cloud') || contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
runs-on: [self-hosted, X64, Linux, 16c32g, gcp]
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.sha.outputs.sha }}
steps:
Expand All @@ -32,32 +32,50 @@ jobs:
id: sha
run: |
echo "sha=$(git rev-parse --verify HEAD)" > $GITHUB_OUTPUT
build:
needs: info
runs-on: [self-hosted, X64, Linux, 16c32g, gcp]
strategy:
matrix:
arch:
- x86_64
- aarch64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Build Release
uses: ./.github/actions/build_linux
timeout-minutes: 60
with:
sha: ${{ steps.sha.outputs.sha }}
target: x86_64-unknown-linux-gnu
sha: ${{ needs.info.outputs.sha }}
target: ${{ matrix.arch }}-unknown-linux-gnu
artifacts: meta,query

docker:
needs: build
needs: [info, build]
timeout-minutes: 10
runs-on: [self-hosted, X64, Linux, 4c8g, gcp]
outputs:
tag: ${{ steps.prepare.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Download artifact
- name: Download artifact for x86_64
uses: ./.github/actions/artifact_download
with:
sha: ${{ needs.build.outputs.sha }}
sha: ${{ needs.info.outputs.sha }}
target: x86_64-unknown-linux-gnu
path: ./target/x86_64-unknown-linux-gnu/release
artifacts: meta,query
- name: Download artifact for aarch64
uses: ./.github/actions/artifact_download
with:
sha: ${{ needs.info.outputs.sha }}
target: aarch64-unknown-linux-gnu
path: ./target/aarch64-unknown-linux-gnu/release
artifacts: meta,query
- name: Prepare docker build
run: |
mkdir -p ./distro/linux/amd64
cp ./target/release/databend-* ./distro/linux/amd64
- uses: ./.github/actions/setup_docker
id: login
with:
Expand All @@ -66,16 +84,17 @@ jobs:
- name: Prepare for docker
id: prepare
run: |
mkdir -p ./distro/linux/amd64
cp ./target/release/databend-query ./distro/linux/amd64/databend-query
short_sha=$(echo "${{ needs.build.outputs.sha }}" | cut -c1-7)
mkdir -p ./distro/linux/{amd64,arm64}
cp ./target/x86_64-unknown-linux-gnu/release/databend-query ./distro/linux/amd64/
cp ./target/aarch64-unknown-linux-gnu/release/databend-query ./distro/linux/arm64/
short_sha=$(echo "${{ needs.info.outputs.sha }}" | cut -c1-7)
echo "tag=pr-${{ github.event.pull_request.number }}-${short_sha}" >> $GITHUB_OUTPUT
- name: push service image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.login.outputs.ecr_repo }}:${{ steps.prepare.outputs.tag }}
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/debian/query.Dockerfile
- name: Comment on PR
Expand All @@ -92,11 +111,11 @@ jobs:
benchmark:
if: contains(github.event.pull_request.labels.*.name, 'ci-benchmark')
needs: [build, docker]
needs: [info, build, docker]
uses: ./.github/workflows/reuse.benchmark.yml
secrets: inherit
with:
sha: ${{ needs.build.outputs.sha }}
sha: ${{ needs.info.outputs.sha }}
run_id: ${{ github.run_id }}
source: pr
source_id: ${{ github.event.pull_request.number }}
Expand Down

0 comments on commit 023972b

Please sign in to comment.