release_build #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FIXME: update this workflow | |
name: release_build | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
schedule: | |
# build at 15:30UTC,8:30PST, 23:30CST, on every Tuesday and Friday | |
- cron: '30 15 * * 4' #was 30 15 * * 2,5 | |
jobs: | |
Build: | |
uses: timeplus-io/proton/.github/workflows/run_command.yml@feature/issue-50-upload-to-ghcr | |
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]" | |
# 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 | |
docker tag ghcr.io/timeplus-io/proton:$GITHUB_SHA ghcr.io/timeplus-io/proton:amd64 | |
# push docker image | |
docker push ghcr.io/timeplus-io/proton:$GITHUB_SHA | |
docker push ghcr.io/timeplus-io/proton: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@feature/issue-50-upload-to-ghcr | |
with: | |
ec2-instance-type: c6g.4xlarge | |
ec2-image-id: ami-0f3dbc4cc9994fdee | |
submodules: 'recursive' | |
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 | |
docker tag ghcr.io/timeplus-io/proton:$GITHUB_SHA ghcr.io/timeplus-io/proton:arm64v8 | |
# push docker image | |
docker push ghcr.io/timeplus-io/proton:$GITHUB_SHA | |
docker push ghcr.io/timeplus-io/proton: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@feature/issue-50-upload-to-ghcr | |
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:amd64 | |
docker pull ghcr.io/timeplus-io/proton:arm64v8 | |
docker manifest create ghcr.io/timeplus-io/proton:develop \ | |
ghcr.io/timeplus-io/proton:amd64 \ | |
ghcr.io/timeplus-io/proton:arm64v8 | |
docker manifest push ghcr.io/timeplus-io/proton:develop | |
PROTON_TAG="$(docker history --no-trunc ghcr.io/timeplus-io/proton: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 \ | |
ghcr.io/timeplus-io/proton:amd64 \ | |
ghcr.io/timeplus-io/proton:arm64v8 | |
docker manifest push ghcr.io/timeplus-io/proton:$PROTON_TAG | |
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\"}}\"" | |
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\"}}\"" | |
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 }} |