From 8570684116cd22dfab55d204f8402cd28015dc70 Mon Sep 17 00:00:00 2001 From: yun Date: Fri, 12 Jul 2024 16:20:30 +0800 Subject: [PATCH] CI/releasebuild: final guard when compile (#804) continue on #801 --- .github/workflows/release_build.yml | 61 +++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 9a6fbcc550..17e87477dc 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -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 "proton_robot@timeplus.io" + + # 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] @@ -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 @@ -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/action-gh-release@v2.0.6 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 }}