Skip to content

manual_trigger_build #23

manual_trigger_build

manual_trigger_build #23

name: manual_trigger_build
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
build_type:
description: 'Build type'
required: false
default: 'release'
type: choice
options:
- release
- address
- thread
- memory
- undefined
arch:
descrition: 'Hardware architecture'
required: true
default: x64
type: choice
options:
- x64
- arm
tag:
description: 'Docker image tag'
required: true
type: string
default: 'manual'
jobs:
prepare_sanitizer:
runs-on: ubuntu-latest
if: github.event.inputs.build_type != 'release'
outputs:
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
# prepare build cache
aws s3 cp --no-progress s3://tp-internal/proton/ci_cache/cache${SANITIZER:+_}$SANITIZER${ARCH:+_}$ARCH.tar.gz .
mkdir $GITHUB_WORKSPACE/ccache
tar -zxf ./cache${SANITIZER:+_}$SANITIZER${ARCH:+_}$ARCH.tar.gz -C $GITHUB_WORKSPACE/ccache
rm cache${SANITIZER:+_}$SANITIZER${ARCH:+_}$ARCH.tar.gz
# compiling
./docker/packager/packager --package-type binary --docker-image-version clang-16 --sanitizer $SANITIZER --proton-build --enable-proton-local --cache ccache --ccache_dir $GITHUB_WORKSPACE/ccache --output-dir $GITHUB_WORKSPACE/output
# clear compiling footprint
rm -rf $GITHUB_WORKSPACE/ccache
rm -rf build_docker
# build unit test docker image
cp $GITHUB_WORKSPACE/output/unit_tests_dbms $GITHUB_WORKSPACE/docker/test/proton_unit_test/
cd $GITHUB_WORKSPACE/docker/test/proton_unit_test/
docker build . -t ghcr.io/timeplus-io/proton-unit-test:$TAG
docker push ghcr.io/timeplus-io/proton-unit-test:$TAG
docker run --name static-server -p 8080:80 -v $GITHUB_WORKSPACE/output:/usr/share/nginx/html:ro -d nginx
cd $GITHUB_WORKSPACE/docker/server
# build docker image
docker build . --network host --build-arg single_binary_location_url=http://localhost:8080/proton -t ghcr.io/timeplus-io/proton:$TAG
# push docker image
docker push ghcr.io/timeplus-io/proton:$TAG
echo "docker push ghcr.io/timeplus-io/proton:$TAG"
steps:
- name: display command
run: |
echo 'command: ${{ steps.set_command.outputs.command }}'
prepare_release:
runs-on: ubuntu-latest
if: github.event.inputs.build_type == 'release'
outputs:
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
# prepare build cache
aws s3 cp --no-progress s3://tp-internal/proton/ci_cache/cache${ARCH:+_}$ARCH.tar.gz .
mkdir $GITHUB_WORKSPACE/ccache
tar -zxf ./cache${ARCH:+_}$ARCH.tar.gz -C $GITHUB_WORKSPACE/ccache
rm cache${ARCH:+_}$ARCH.tar.gz
# compiling
./docker/packager/packager --package-type binary --docker-image-version clang-16 --build-type release --proton-build --enable-proton-local --cache ccache --ccache_dir $GITHUB_WORKSPACE/ccache --output-dir $GITHUB_WORKSPACE/output
# release doesn't build unit_tests_dbms
# clear compiling footprint
rm -rf $GITHUB_WORKSPACE/ccache
rm -rf build_docker
docker run --name static-server -p 8080:80 -v $GITHUB_WORKSPACE/output:/usr/share/nginx/html:ro -d nginx
cd $GITHUB_WORKSPACE/docker/server
# build docker image
docker build . --network host --build-arg single_binary_location_url=http://localhost:8080/proton -t ghcr.io/timeplus-io/proton:$TAG
# push docker image
docker push ghcr.io/timeplus-io/proton:$TAG
echo "docker pull ghcr.io/timeplus-io/proton:$TAG"
steps:
- name: display command
run: |
echo 'command: ${{ steps.set_command.outputs.command }}'
build_x64:
needs: prepare_sanitizer
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
if: github.event.inputs.arch == 'x64' && github.event.inputs.build_type != 'release'
with:
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
ec2-image-id: ${{ vars.X64_AMI }}
ec2-volume-size: ${{ vars.VOLUME_SIZE }}
submodules: 'recursive'
sanitizer: ${{ github.event.inputs.build_type }}
arch: ${{ vars.X64_ARCH }}
tag: ${{ github.event.inputs.tag }}
command: |
${{ needs.prepare_sanitizer.outputs.command }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build_x64_release:
needs: prepare_release
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
if: github.event.inputs.arch == 'x64' && github.event.inputs.build_type == 'release'
with:
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
ec2-image-id: ${{ vars.X64_AMI }}
ec2-volume-size: ${{ vars.VOLUME_SIZE }}
submodules: 'recursive'
sanitizer: ""
arch: ${{ vars.X64_ARCH }}
tag: ${{ github.event.inputs.tag }}
command: |
${{ needs.prepare_release.outputs.command }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build_arm:
needs: prepare_sanitizer
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
if: github.event.inputs.arch == 'arm' && github.event.inputs.build_type != 'release'
with:
ec2-instance-type: ${{ vars.ARM_INSTANCE_TYPE }}
ec2-image-id: ${{ vars.ARM_AMI }}
ec2-volume-size: ${{ vars.VOLUME_SIZE }}
submodules: 'recursive'
sanitizer: ${{ github.event.inputs.build_type }}
arch: ${{ vars.ARM_ARCH }}
tag: ${{ github.event.inputs.tag }}
command: |
${{ needs.prepare_sanitizer.outputs.command }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build_arm_release:
needs: prepare_release
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
if: github.event.inputs.arch == 'arm' && github.event.inputs.build_type == 'release'
with:
ec2-instance-type: ${{ vars.ARM_INSTANCE_TYPE }}
ec2-image-id: ${{ vars.ARM_AMI }}
ec2-volume-size: ${{ vars.VOLUME_SIZE }}
submodules: 'recursive'
sanitizer: ""
arch: ${{ vars.ARM_ARCH }}
tag: ${{ github.event.inputs.tag }}
command: |
${{ needs.prepare_release.outputs.command }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}