Skip to content

Commit

Permalink
CI/releasebuild: final guard when compile (#804)
Browse files Browse the repository at this point in the history
continue on #801
  • Loading branch information
yokofly authored Jul 12, 2024
1 parent 342729f commit 8570684
Showing 1 changed file with 57 additions and 4 deletions.
61 changes: 57 additions & 4 deletions .github/workflows/release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,59 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

Build_Darwin_Arm64:
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
upload_files: proton-*-Darwin-arm64
command: |
cd $GITHUB_WORKSPACE
# git config
git config user.name "proton-robot"
git config user.email "[email protected]"
# update version
./release --version patch
# download the pre-built binary of v8 (this is only for cross-compile)
aws s3 cp --no-progress s3://tp-internal/proton/cross-compile-prebuilt-binary/v8-cmake-arm64.tar.gz $GITHUB_WORKSPACE/contrib/v8-cmake/
tar -zxf $GITHUB_WORKSPACE/contrib/v8-cmake/v8-cmake-arm64.tar.gz -C $GITHUB_WORKSPACE/contrib/v8-cmake/
rm $GITHUB_WORKSPACE/contrib/v8-cmake/v8-cmake-arm64.tar.gz
chmod a+x $GITHUB_WORKSPACE/contrib/v8-cmake/bytecode_builtins_list_generator
chmod a+x $GITHUB_WORKSPACE/contrib/v8-cmake/mksnapshot
chmod a+x $GITHUB_WORKSPACE/contrib/v8-cmake/torque
# prepare build cache
mkdir $GITHUB_WORKSPACE/ccache
echo "max_size = 100.0G" > $GITHUB_WORKSPACE/ccache/ccache.conf
# 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 --compiler clang-16-darwin-aarch64
if [ ! -f "$GITHUB_WORKSPACE/output/proton" ]; then
echo "Compiling proton Failed"
exit 127
fi
# clean ccache and build footprint
rm -rf $GITHUB_WORKSPACE/ccache
rm -rf $GITHUB_WORKSPACE/build_docker
# get proton tag
PROTON_TAG=`grep "SET(VERSION_DESCRIBE" $GITHUB_WORKSPACE/cmake/autogenerated_versions.txt | sed 's/^.*VERSION_DESCRIBE \(.*\)$/\1/' | sed 's/[) ].*//'`
echo "Proton tag: $PROTON_TAG"
echo "tag_name=$PROTON_TAG" >> $GITHUB_OUTPUT
PROTON_BINARY=proton-$PROTON_TAG-Darwin-arm64
echo "Proton Binary Name: $PROTON_BINARY"
sha256sum $GITHUB_WORKSPACE/output/proton
mv $GITHUB_WORKSPACE/output/proton $GITHUB_WORKSPACE/$PROTON_BINARY
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_Native_Darwin_arm64:
needs: Build_Linux_X86_64
runs-on: [self-hosted, macOS, ARM64]
Expand Down Expand Up @@ -278,7 +331,7 @@ jobs:
- name: Strip and Rename binary
run: |
ORIGINAL_BINARY=${{ env.build_directory }}/programs/proton
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64-native
/opt/homebrew/opt/llvm@17/bin/llvm-strip $ORIGINAL_BINARY -o $STRIPPED_BINARY
# Set up AWS credentials for S3 upload
Expand All @@ -292,19 +345,19 @@ jobs:
# Upload the stripped binary to an AWS S3 bucket
- name: Upload Artifact To S3
run: |
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64-native
aws s3 cp --no-progress $STRIPPED_BINARY s3://tp-internal/proton/native_build_macOS/
# Sha256 for homebrew binary
- name: Print SHA256 Checksum
run: |
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64
STRIPPED_BINARY=${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64-native
sha256sum $STRIPPED_BINARY
# Release the binary on GitHub Releases with automatic release notes
- name: Release binary
uses: softprops/[email protected]
with:
files: ${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64
files: ${{ env.build_directory }}/programs/proton-${{ steps.determine_tag.outputs.tag_name }}-Darwin-arm64-native
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
generate_release_notes: true
tag_name: ${{ steps.determine_tag.outputs.tag_name }}

0 comments on commit 8570684

Please sign in to comment.