From c63ceeb1158db155260d7c788f615cde33bef705 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Mon, 17 Aug 2020 15:14:52 -0500 Subject: [PATCH 1/4] introduce cross-platform automatic builds --- .github/workflows/build-deb-pkg.sh | 32 +++++++++++++++ .github/workflows/build-linux-release.yml | 47 +++++++++++++++++++++++ .github/workflows/build-macos-release.yml | 44 +++++++++++++++++++++ .github/workflows/build-tgz-pkg.sh | 20 ++++++++++ .github/workflows/build-win-release.yml | 47 +++++++++++++++++++++++ .github/workflows/debian/template/control | 8 ++++ 6 files changed, 198 insertions(+) create mode 100755 .github/workflows/build-deb-pkg.sh create mode 100644 .github/workflows/build-linux-release.yml create mode 100644 .github/workflows/build-macos-release.yml create mode 100755 .github/workflows/build-tgz-pkg.sh create mode 100644 .github/workflows/build-win-release.yml create mode 100644 .github/workflows/debian/template/control diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh new file mode 100755 index 000000000000..97b877f869f4 --- /dev/null +++ b/.github/workflows/build-deb-pkg.sh @@ -0,0 +1,32 @@ +PKG_ROOT=/tmp/avalanche +DEBIAN_BASE_DIR=$PKG_ROOT/debian +AVALANCHE_BUILD_BIN_DIR=$DEBIAN_BASE_DIR/usr/local/bin +AVALANCHE_LIB_DIR=$DEBIAN_BASE_DIR/usr/local/lib/avalanche +TEMPLATE=.github/workflows/debian/template +DEBIAN_CONF=$DEBIAN_BASE_DIR/DEBIAN + +mkdir -p $PKG_ROOT/$DEBIAN_BASE_DIR +mkdir -p $DEBIAN_CONF +mkdir -p $AVALANCHE_BUILD_BIN_DIR +mkdir -p $AVALANCHE_LIB_DIR + +OK=`cp ./build/avalanche $AVALANCHE_BUILD_BIN_DIR` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp ./build/plugins/evm $AVALANCHE_LIB_DIR` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp $TEMPLATE/control $DEBIAN_CONF` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi + +echo "Build debian package..." +cd $PKG_ROOT +echo "Tag: $TAG" +NEW_VERSION_STRING="Version: $TAG" +sed -i "s/Version.*/$NEW_VERSION_STRING/g" debian/DEBIAN/control +dpkg-deb --build debian avalanche-linux_$TAG.deb +aws s3 cp avalanche-linux_$TAG.deb s3://avalanche-public-builds/linux/ diff --git a/.github/workflows/build-linux-release.yml b/.github/workflows/build-linux-release.yml new file mode 100644 index 000000000000..61fde4285eb4 --- /dev/null +++ b/.github/workflows/build-linux-release.yml @@ -0,0 +1,47 @@ +# Build a debian package from the avalanche repo + +name: build-linux-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-18.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Build the avalanche binaries + run: ./scripts/build.sh + + - name: Install aws cli + run: sudo apt-get install awscli + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + - name: Create debian package structure + run: ./.github/workflows/build-deb-pkg.sh + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + TAG: ${{ steps.get_version.outputs.VERSION }} + + - name: Create tgz package structure + run: ./.github/workflows/build-tgz-pkg.sh + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + TAG: ${{ steps.get_version.outputs.VERSION }} diff --git a/.github/workflows/build-macos-release.yml b/.github/workflows/build-macos-release.yml new file mode 100644 index 000000000000..59801901d3a8 --- /dev/null +++ b/.github/workflows/build-macos-release.yml @@ -0,0 +1,44 @@ +# Build a macos release from the avalanche repo + +name: build-macos-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: macos-10.15 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Build the avalanche binaries + run: ./scripts/build.sh + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + - name: Install aws cli + run: | + curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" + sudo installer -pkg AWSCLIV2.pkg -target / + + - name: Create zip file + run: 7z a avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip build/avalanche build/plugins + + - name: Upload file to S3 + run: aws s3 cp avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://avalanche-public-builds/macos/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} diff --git a/.github/workflows/build-tgz-pkg.sh b/.github/workflows/build-tgz-pkg.sh new file mode 100755 index 000000000000..d85986f02e9f --- /dev/null +++ b/.github/workflows/build-tgz-pkg.sh @@ -0,0 +1,20 @@ +PKG_ROOT=/tmp +VERSION=$TAG +AVALANCHE_ROOT=$PKG_ROOT/avalanche-$VERSION + +mkdir -p $AVALANCHE_ROOT + +OK=`cp ./build/avalanche $AVALANCHE_ROOT` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp -r ./build/plugins $AVALANCHE_ROOT` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi + +echo "Build tgz package..." +cd $PKG_ROOT +echo "Version: $VERSION" +tar -czvf "avalanche-linux-$VERSION.tar.gz" avalanche-$VERSION +aws s3 cp avalanche-linux-$VERSION.tar.gz s3://avalanche-public-builds/linux/ diff --git a/.github/workflows/build-win-release.yml b/.github/workflows/build-win-release.yml new file mode 100644 index 000000000000..4035ddb3f7d1 --- /dev/null +++ b/.github/workflows/build-win-release.yml @@ -0,0 +1,47 @@ +# Build a windows release from the avalanche repo + +name: build-win-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: windows-2019 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + # Runs a single command using the runners shell + - name: Build the avalanche binaries + run: ./scripts/build.sh + shell: bash + + - name: Create zip + run: | + mv .\build\avalanche .\build\avalanche.exe + mv .\build\plugins\evm .\build\plugins\evm.exe + Compress-Archive -Path .\build\avalanche.exe,.\build\plugins -DestinationPath .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + + - name: Install aws cli + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + run: | + Install-Module -Name AWS.Tools.Installer -Force + Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Force + Write-S3Object -BucketName avalanche-public-builds -File .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + diff --git a/.github/workflows/debian/template/control b/.github/workflows/debian/template/control new file mode 100644 index 000000000000..6348c5a99620 --- /dev/null +++ b/.github/workflows/debian/template/control @@ -0,0 +1,8 @@ +Package: avalanche +Version: 0.1.0 +Section: misc +Priority: optional +Architecture: amd64 +Depends: +Maintainer: Fabio Barone +Description: The Avalanche platform binaries From e842e71d6c135a9372227999b62db49a21ca94b0 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Tue, 1 Sep 2020 18:40:45 -0500 Subject: [PATCH 2/4] bucket --- .github/workflows/build-deb-pkg.sh | 2 +- .github/workflows/build-linux-release.yml | 2 ++ .github/workflows/build-macos-release.yml | 2 +- .github/workflows/build-tgz-pkg.sh | 2 +- .github/workflows/build-win-release.yml | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh index 97b877f869f4..b91b06c4640a 100755 --- a/.github/workflows/build-deb-pkg.sh +++ b/.github/workflows/build-deb-pkg.sh @@ -29,4 +29,4 @@ echo "Tag: $TAG" NEW_VERSION_STRING="Version: $TAG" sed -i "s/Version.*/$NEW_VERSION_STRING/g" debian/DEBIAN/control dpkg-deb --build debian avalanche-linux_$TAG.deb -aws s3 cp avalanche-linux_$TAG.deb s3://avalanche-public-builds/linux/ +aws s3 cp avalanche-linux_$TAG.deb s3://$BUCKET/linux/ diff --git a/.github/workflows/build-linux-release.yml b/.github/workflows/build-linux-release.yml index 61fde4285eb4..71fffae06364 100644 --- a/.github/workflows/build-linux-release.yml +++ b/.github/workflows/build-linux-release.yml @@ -38,6 +38,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} TAG: ${{ steps.get_version.outputs.VERSION }} + BUCKET: ${{ secrets.BUCKET }} - name: Create tgz package structure run: ./.github/workflows/build-tgz-pkg.sh @@ -45,3 +46,4 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} TAG: ${{ steps.get_version.outputs.VERSION }} + BUCKET: ${{ secrets.BUCKET }} diff --git a/.github/workflows/build-macos-release.yml b/.github/workflows/build-macos-release.yml index 59801901d3a8..fbfb83e36636 100644 --- a/.github/workflows/build-macos-release.yml +++ b/.github/workflows/build-macos-release.yml @@ -38,7 +38,7 @@ jobs: run: 7z a avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip build/avalanche build/plugins - name: Upload file to S3 - run: aws s3 cp avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://avalanche-public-builds/macos/ + run: aws s3 cp avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://{{ secrets.BUCKET }}/macos/ env: AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} diff --git a/.github/workflows/build-tgz-pkg.sh b/.github/workflows/build-tgz-pkg.sh index d85986f02e9f..bf1c13824f57 100755 --- a/.github/workflows/build-tgz-pkg.sh +++ b/.github/workflows/build-tgz-pkg.sh @@ -17,4 +17,4 @@ echo "Build tgz package..." cd $PKG_ROOT echo "Version: $VERSION" tar -czvf "avalanche-linux-$VERSION.tar.gz" avalanche-$VERSION -aws s3 cp avalanche-linux-$VERSION.tar.gz s3://avalanche-public-builds/linux/ +aws s3 cp avalanche-linux-$VERSION.tar.gz s3://$BUCKET/linux/ diff --git a/.github/workflows/build-win-release.yml b/.github/workflows/build-win-release.yml index 4035ddb3f7d1..26a6caa56bf7 100644 --- a/.github/workflows/build-win-release.yml +++ b/.github/workflows/build-win-release.yml @@ -43,5 +43,5 @@ jobs: run: | Install-Module -Name AWS.Tools.Installer -Force Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Force - Write-S3Object -BucketName avalanche-public-builds -File .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + Write-S3Object -BucketName ${{ secrets.BUCKET }} -File .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip From eeead58b983612f6c6e25b6730b81fccd01d3640 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Thu, 3 Sep 2020 10:24:32 -0500 Subject: [PATCH 3/4] fix build dir hierarchy after review by @moreati --- .github/workflows/build-deb-pkg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh index b91b06c4640a..efab3af76dbf 100755 --- a/.github/workflows/build-deb-pkg.sh +++ b/.github/workflows/build-deb-pkg.sh @@ -5,7 +5,7 @@ AVALANCHE_LIB_DIR=$DEBIAN_BASE_DIR/usr/local/lib/avalanche TEMPLATE=.github/workflows/debian/template DEBIAN_CONF=$DEBIAN_BASE_DIR/DEBIAN -mkdir -p $PKG_ROOT/$DEBIAN_BASE_DIR +mkdir -p $DEBIAN_BASE_DIR mkdir -p $DEBIAN_CONF mkdir -p $AVALANCHE_BUILD_BIN_DIR mkdir -p $AVALANCHE_LIB_DIR From c09b4ee2381dd7f649ddf3d9e1ee858139e6865c Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Mon, 14 Sep 2020 09:56:17 -0500 Subject: [PATCH 4/4] updated to latest renaming --- .github/workflows/build-deb-pkg.sh | 10 +++++----- .github/workflows/build-linux-release.yml | 4 ++-- .github/workflows/build-macos-release.yml | 8 ++++---- .github/workflows/build-tgz-pkg.sh | 8 ++++---- .github/workflows/build-win-release.yml | 10 +++++----- .github/workflows/debian/template/control | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh index efab3af76dbf..169bc7b553e1 100755 --- a/.github/workflows/build-deb-pkg.sh +++ b/.github/workflows/build-deb-pkg.sh @@ -1,7 +1,7 @@ -PKG_ROOT=/tmp/avalanche +PKG_ROOT=/tmp/avalanchego DEBIAN_BASE_DIR=$PKG_ROOT/debian AVALANCHE_BUILD_BIN_DIR=$DEBIAN_BASE_DIR/usr/local/bin -AVALANCHE_LIB_DIR=$DEBIAN_BASE_DIR/usr/local/lib/avalanche +AVALANCHE_LIB_DIR=$DEBIAN_BASE_DIR/usr/local/lib/avalanchego TEMPLATE=.github/workflows/debian/template DEBIAN_CONF=$DEBIAN_BASE_DIR/DEBIAN @@ -10,7 +10,7 @@ mkdir -p $DEBIAN_CONF mkdir -p $AVALANCHE_BUILD_BIN_DIR mkdir -p $AVALANCHE_LIB_DIR -OK=`cp ./build/avalanche $AVALANCHE_BUILD_BIN_DIR` +OK=`cp ./build/avalanchego $AVALANCHE_BUILD_BIN_DIR` if [[ $OK -ne 0 ]]; then exit $OK; fi @@ -28,5 +28,5 @@ cd $PKG_ROOT echo "Tag: $TAG" NEW_VERSION_STRING="Version: $TAG" sed -i "s/Version.*/$NEW_VERSION_STRING/g" debian/DEBIAN/control -dpkg-deb --build debian avalanche-linux_$TAG.deb -aws s3 cp avalanche-linux_$TAG.deb s3://$BUCKET/linux/ +dpkg-deb --build debian avalanchego-linux_$TAG.deb +aws s3 cp avalanchego-linux_$TAG.deb s3://$BUCKET/linux/ diff --git a/.github/workflows/build-linux-release.yml b/.github/workflows/build-linux-release.yml index 71fffae06364..c2c2107dfeba 100644 --- a/.github/workflows/build-linux-release.yml +++ b/.github/workflows/build-linux-release.yml @@ -1,4 +1,4 @@ -# Build a debian package from the avalanche repo +# Build a debian package from the avalanchego repo name: build-linux-release @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v2 # Runs a single command using the runners shell - - name: Build the avalanche binaries + - name: Build the avalanchego binaries run: ./scripts/build.sh - name: Install aws cli diff --git a/.github/workflows/build-macos-release.yml b/.github/workflows/build-macos-release.yml index fbfb83e36636..56320b57dfa9 100644 --- a/.github/workflows/build-macos-release.yml +++ b/.github/workflows/build-macos-release.yml @@ -1,4 +1,4 @@ -# Build a macos release from the avalanche repo +# Build a macos release from the avalanchego repo name: build-macos-release @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v2 # Runs a single command using the runners shell - - name: Build the avalanche binaries + - name: Build the avalanchego binaries run: ./scripts/build.sh - name: Get the version @@ -35,10 +35,10 @@ jobs: sudo installer -pkg AWSCLIV2.pkg -target / - name: Create zip file - run: 7z a avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip build/avalanche build/plugins + run: 7z a avalanchego-macos-${{ steps.get_version.outputs.VERSION }}.zip build/avalanchego build/plugins - name: Upload file to S3 - run: aws s3 cp avalanche-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://{{ secrets.BUCKET }}/macos/ + run: aws s3 cp avalanchego-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://{{ secrets.BUCKET }}/macos/ env: AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} diff --git a/.github/workflows/build-tgz-pkg.sh b/.github/workflows/build-tgz-pkg.sh index bf1c13824f57..5399e103d462 100755 --- a/.github/workflows/build-tgz-pkg.sh +++ b/.github/workflows/build-tgz-pkg.sh @@ -1,10 +1,10 @@ PKG_ROOT=/tmp VERSION=$TAG -AVALANCHE_ROOT=$PKG_ROOT/avalanche-$VERSION +AVALANCHE_ROOT=$PKG_ROOT/avalanchego-$VERSION mkdir -p $AVALANCHE_ROOT -OK=`cp ./build/avalanche $AVALANCHE_ROOT` +OK=`cp ./build/avalanchego $AVALANCHE_ROOT` if [[ $OK -ne 0 ]]; then exit $OK; fi @@ -16,5 +16,5 @@ fi echo "Build tgz package..." cd $PKG_ROOT echo "Version: $VERSION" -tar -czvf "avalanche-linux-$VERSION.tar.gz" avalanche-$VERSION -aws s3 cp avalanche-linux-$VERSION.tar.gz s3://$BUCKET/linux/ +tar -czvf "avalanchego-linux-$VERSION.tar.gz" avalanchego-$VERSION +aws s3 cp avalanchego-linux-$VERSION.tar.gz s3://$BUCKET/linux/ diff --git a/.github/workflows/build-win-release.yml b/.github/workflows/build-win-release.yml index 26a6caa56bf7..426044243417 100644 --- a/.github/workflows/build-win-release.yml +++ b/.github/workflows/build-win-release.yml @@ -1,4 +1,4 @@ -# Build a windows release from the avalanche repo +# Build a windows release from the avalanchego repo name: build-win-release @@ -26,15 +26,15 @@ jobs: shell: bash # Runs a single command using the runners shell - - name: Build the avalanche binaries + - name: Build the avalanchego binaries run: ./scripts/build.sh shell: bash - name: Create zip run: | - mv .\build\avalanche .\build\avalanche.exe + mv .\build\avalanchego .\build\avalanchego.exe mv .\build\plugins\evm .\build\plugins\evm.exe - Compress-Archive -Path .\build\avalanche.exe,.\build\plugins -DestinationPath .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + Compress-Archive -Path .\build\avalanchego.exe,.\build\plugins -DestinationPath .\build\avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip - name: Install aws cli env: @@ -43,5 +43,5 @@ jobs: run: | Install-Module -Name AWS.Tools.Installer -Force Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Force - Write-S3Object -BucketName ${{ secrets.BUCKET }} -File .\build\avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanche-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + Write-S3Object -BucketName ${{ secrets.BUCKET }} -File .\build\avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip diff --git a/.github/workflows/debian/template/control b/.github/workflows/debian/template/control index 6348c5a99620..ace70c066932 100644 --- a/.github/workflows/debian/template/control +++ b/.github/workflows/debian/template/control @@ -1,4 +1,4 @@ -Package: avalanche +Package: avalanchego Version: 0.1.0 Section: misc Priority: optional