Skip to content

release_build

release_build #23

Workflow file for this run

# FIXME: update this workflow
name: release_build
on: # yamllint disable-line rule:truthy
workflow_dispatch:
jobs:
Build:
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
with:
ec2-instance-type: c5.4xlarge
ec2-image-id: ami-042a37e33a285c22b
submodules: 'recursive'
run_mode: 'start' # start ec2 on demand instance
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
# update version
./release --version patch
# prepare build cache
aws s3 cp --no-progress s3://tp-internal/proton/cache.tar.gz .
mkdir $GITHUB_WORKSPACE/ccache
tar -zxf ./cache.tar.gz -C $GITHUB_WORKSPACE/ccache
rm cache.tar.gz
# compiling
./docker/packager/packager --package-type binary --docker-image-version clang-16 --build-type release --proton-build --cache ccache --ccache_dir $GITHUB_WORKSPACE/ccache --output-dir $GITHUB_WORKSPACE/output
if [ ! -f "$GITHUB_WORKSPACE/output/proton" ]; then
echo "Compiling proton Failed"
exit 127
fi
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:$GITHUB_SHA-amd64
# push docker image
docker push ghcr.io/timeplus-io/proton:$GITHUB_SHA-amd64
# upload build cache
tar -zcf ./cache.tar.gz -C $GITHUB_WORKSPACE/ccache .
aws s3 cp --no-progress ./cache.tar.gz s3://tp-internal/proton/
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 }}
BuildArm:
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
with:
ec2-instance-type: c6g.4xlarge
ec2-image-id: ami-0f3dbc4cc9994fdee
submodules: 'recursive'
run_mode: 'start' # start ec2 on demand instance
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
# update version
./release --version patch
# prepare build cache
aws s3 cp --no-progress s3://tp-internal/proton/cache-arm.tar.gz .
mkdir $GITHUB_WORKSPACE/ccache
tar -zxf ./cache-arm.tar.gz -C $GITHUB_WORKSPACE/ccache
rm cache-arm.tar.gz
# compiling
./docker/packager/packager --package-type binary --docker-image-version clang-16 --build-type release --proton-build --cache ccache --ccache_dir $GITHUB_WORKSPACE/ccache --output-dir $GITHUB_WORKSPACE/output
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:$GITHUB_SHA-arm64v8
# push docker image
docker push ghcr.io/timeplus-io/proton:$GITHUB_SHA-arm64v8
# upload build cache
tar -zcf ./cache-arm.tar.gz -C $GITHUB_WORKSPACE/ccache .
aws s3 cp --no-progress ./cache-arm.tar.gz s3://tp-internal/proton/
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 }}
CommitTag:
needs: [Build, BuildArm]
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
with:
ec2-instance-type: c5.4xlarge
ec2-image-id: ami-042a37e33a285c22b
submodules: 'recursive'
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
docker pull ghcr.io/timeplus-io/proton:$GITHUB_SHA-amd64
docker pull ghcr.io/timeplus-io/proton:$GITHUB_SHA-arm64v8
docker manifest create ghcr.io/timeplus-io/proton:latest \
ghcr.io/timeplus-io/proton:$GITHUB_SHA-amd64 \
ghcr.io/timeplus-io/proton:$GITHUB_SHA-arm64v8
docker manifest push ghcr.io/timeplus-io/proton:latest
PROTON_TAG="$(docker history --no-trunc ghcr.io/timeplus-io/proton:$GITHUB_SHA-amd64 | grep -Eo 'ARG version=[0-9]+.[0-9]+.[0-9]+' -o | grep -Eo '[0-9]+.[0-9]+.[0-9]+')"
docker manifest create ghcr.io/timeplus-io/proton:$PROTON_TAG-rc \
ghcr.io/timeplus-io/proton:$GITHUB_SHA-amd64 \
ghcr.io/timeplus-io/proton:$GITHUB_SHA-arm64v8
docker manifest push ghcr.io/timeplus-io/proton:$PROTON_TAG-rc
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GH_PERSONAL_ACCESS_TOKEN"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/timeplus-io/proton/actions/workflows/manual_trigger_test.yml/dispatches \
-d "{\"ref\":\"develop\",\"inputs\":{\"arch\": \"x64\", \"tag\":\"$PROTON_TAG-rc\"}}\""
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GH_PERSONAL_ACCESS_TOKEN"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/timeplus-io/proton/actions/workflows/manual_trigger_test.yml/dispatches \
-d "{\"ref\":\"develop\",\"inputs\":{\"arch\": \"arm\", \"tag\":\"$PROTON_TAG-rc\"}}\""
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 }}