From 8a9d14141ae42bab028654bf5a51d3677684d329 Mon Sep 17 00:00:00 2001 From: draganrakita Date: Thu, 17 Dec 2020 13:59:59 +0100 Subject: [PATCH] Revert "Fix CI problems (#127)" and Remove sscache This reverts commit 12afb13e9b04c0fed06f4a2897a3b22972fab721. --- .github/workflows/build-test.yml | 4 - .github/workflows/build.yml | 285 ++++++++++++++++++++ .github/workflows/check.yml | 37 --- .github/workflows/deploy-docker-nightly.yml | 29 ++ .github/workflows/deploy-docker-tag.yml | 30 +++ scripts/actions/validate-chainspecs.sh | 2 +- 6 files changed, 345 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/deploy-docker-nightly.yml create mode 100644 .github/workflows/deploy-docker-tag.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 4b37985cc..425ec34e5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -9,10 +9,6 @@ on: jobs: build-tests: name: Test and Build - env: - SCCACHE_CACHE_SIZE: "1G" - SCCACHE_IDLE_TIMEOUT: 0 - ACTIONS_ALLOW_UNSECURE_COMMANDS: true strategy: matrix: platform: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..9dda2d4aa --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,285 @@ +name: Build Release Suite + +on: + push: + tags: + - v* + +# Global vars +env: + AWS_REGION: "us-east-1" + AWS_S3_ARTIFACTS_BUCKET: "openethereum-releases" + +jobs: + build: + name: Build Release + strategy: + matrix: + platform: + - ubuntu-16.04 + - macos-latest + - windows2019 + toolchain: + - stable + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout sources + uses: actions/checkout@main + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + profile: minimal + override: true + + # ============================== + # Windows Build + # ============================== + + - name: Install LLVM for Windows + if: matrix.platform == 'windows2019' + run: choco install llvm + + - name: Build OpenEthereum for Windows + if: matrix.platform == 'windows2019' + run: sh scripts/actions/build-windows.sh ${{matrix.platform}} + + - name: Upload Windows build + uses: actions/upload-artifact@v2 + if: matrix.platform == 'windows2019' + with: + name: windows-artifacts + path: artifacts + + # ============================== + # Linux/Macos Build + # ============================== + + - name: Build OpenEthereum for ${{matrix.platform}} + if: matrix.platform != 'windows2019' + run: sh scripts/actions/build-linux.sh ${{matrix.platform}} + + - name: Upload Linux build + uses: actions/upload-artifact@v2 + if: matrix.platform == 'ubuntu-16.04' + with: + name: linux-artifacts + path: artifacts + + - name: Upload MacOS build + uses: actions/upload-artifact@v2 + if: matrix.platform == 'macos-latest' + with: + name: macos-artifacts + path: artifacts + + zip-artifacts-creator: + name: Create zip artifacts + needs: build + runs-on: ubuntu-16.04 + steps: + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + # ============================== + # Create ZIP files + # ============================== + + - name: Download Windows artifacts + uses: actions/download-artifact@v2 + with: + name: windows-artifacts + path: windows-artifacts + + - name: Download Linux artifacts + uses: actions/download-artifact@v2 + with: + name: linux-artifacts + path: linux-artifacts + + - name: Download MacOS artifacts + uses: actions/download-artifact@v2 + with: + name: macos-artifacts + path: macos-artifacts + + - name: Display structure of downloaded files + run: ls + + - name: Create zip Linux + id: create_zip_linux + run: | + cd linux-artifacts/ + zip -rT openethereum-linux-${{ env.RELEASE_VERSION }}.zip * + ls openethereum-linux-${{ env.RELEASE_VERSION }}.zip + cd .. + mv linux-artifacts/openethereum-linux-${{ env.RELEASE_VERSION }}.zip . + + echo "Setting outputs..." + echo ::set-output name=LINUX_ARTIFACT::openethereum-linux-${{ env.RELEASE_VERSION }}.zip + echo ::set-output name=LINUX_SHASUM::$(shasum -a 256 openethereum-linux-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}') + + - name: Create zip MacOS + id: create_zip_macos + run: | + cd macos-artifacts/ + zip -rT openethereum-macos-${{ env.RELEASE_VERSION }}.zip * + ls openethereum-macos-${{ env.RELEASE_VERSION }}.zip + cd .. + mv macos-artifacts/openethereum-macos-${{ env.RELEASE_VERSION }}.zip . + + echo "Setting outputs..." + echo ::set-output name=MACOS_ARTIFACT::openethereum-macos-${{ env.RELEASE_VERSION }}.zip + echo ::set-output name=MACOS_SHASUM::$(shasum -a 256 openethereum-macos-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}') + + - name: Create zip Windows + id: create_zip_windows + run: | + cd windows-artifacts/ + zip -rT openethereum-windows-${{ env.RELEASE_VERSION }}.zip * + ls openethereum-windows-${{ env.RELEASE_VERSION }}.zip + cd .. + mv windows-artifacts/openethereum-windows-${{ env.RELEASE_VERSION }}.zip . + + echo "Setting outputs..." + echo ::set-output name=WINDOWS_ARTIFACT::openethereum-windows-${{ env.RELEASE_VERSION }}.zip + echo ::set-output name=WINDOWS_SHASUM::$(shasum -a 256 openethereum-windows-${{ env.RELEASE_VERSION }}.zip | awk '{print $1}') + + # ======================================================================= + # Upload artifacts + # This is required to share artifacts between different jobs + # ======================================================================= + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip + path: openethereum-linux-${{ env.RELEASE_VERSION }}.zip + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip + path: openethereum-macos-${{ env.RELEASE_VERSION }}.zip + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip + path: openethereum-windows-${{ env.RELEASE_VERSION }}.zip + + # ======================================================================= + # Upload artifacts to S3 + # This is required by some software distribution systems which require + # artifacts to be downloadable, like Brew on MacOS. + # ======================================================================= + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Copy files to S3 with the AWS CLI + run: | + # Deploy zip artifacts to S3 bucket to a directory whose name is the tagged release version. + # Deploy macos binary artifact (if required, add more `aws s3 cp` commands to deploy specific OS versions) + aws s3 cp macos-artifacts/openethereum s3://${{ env.AWS_S3_ARTIFACTS_BUCKET }}/${{ env.RELEASE_VERSION }}/macos/ --region ${{ env.AWS_REGION }} + + outputs: + linux-artifact: ${{ steps.create_zip_linux.outputs.LINUX_ARTIFACT }} + linux-shasum: ${{ steps.create_zip_linux.outputs.LINUX_SHASUM }} + macos-artifact: ${{ steps.create_zip_macos.outputs.MACOS_ARTIFACT }} + macos-shasum: ${{ steps.create_zip_macos.outputs.MACOS_SHASUM }} + windows-artifact: ${{ steps.create_zip_windows.outputs.WINDOWS_ARTIFACT }} + windows-shasum: ${{ steps.create_zip_windows.outputs.WINDOWS_SHASUM }} + + draft-release: + name: Draft Release + needs: zip-artifacts-creator + runs-on: ubuntu-16.04 + steps: + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + # ============================== + # Download artifacts + # ============================== + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip + + - name: Display structure of downloaded files + run: ls + + # ============================== + # Create release draft + # ============================== + + - name: Create Release Draft + id: create_release_draft + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: OpenEthereum ${{ github.ref }} + body: | + This release contains + + | System | Architecture | Binary | Sha256 Checksum | + |:---:|:---:|:---:|:---| + | Apple Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [${{ needs.zip-artifacts-creator.outputs.macos-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.macos-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.macos-shasum }}` | + | Linux Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [${{ needs.zip-artifacts-creator.outputs.linux-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.linux-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.linux-shasum }}` | + | Windows Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | x64 | [${{ needs.zip-artifacts-creator.outputs.windows-artifact }}](https://github.com/openethereum/openethereum/releases/download/${{ env.RELEASE_VERSION }}/${{ needs.zip-artifacts-creator.outputs.windows-artifact }}) | `${{ needs.zip-artifacts-creator.outputs.windows-shasum }}` | + | | | | | + | **System** | **Option** | - | **Resource** | + | Settings Icon by Pixel Perfect from https://www.flaticon.com/authors/pixel-perfect | Docker | - | [hub.docker.com/r/openethereum/openethereum](https://hub.docker.com/r/openethereum/openethereum) | + + draft: true + prerelease: true + + - name: Upload Release Asset - Linux + id: upload_release_asset_linux + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./openethereum-linux-${{ env.RELEASE_VERSION }}.zip + asset_name: openethereum-linux-${{ env.RELEASE_VERSION }}.zip + asset_content_type: application/zip + + - name: Upload Release Asset - MacOS + id: upload_release_asset_macos + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./openethereum-macos-${{ env.RELEASE_VERSION }}.zip + asset_name: openethereum-macos-${{ env.RELEASE_VERSION }}.zip + asset_content_type: application/zip + + - name: Upload Release Asset - Windows + id: upload_release_asset_windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release_draft.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./openethereum-windows-${{ env.RELEASE_VERSION }}.zip + asset_name: openethereum-windows-${{ env.RELEASE_VERSION }}.zip + asset_content_type: application/zip diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index af0e005c5..06d660c1e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,10 +10,6 @@ jobs: check: name: Check runs-on: ubuntu-16.04 - env: - SCCACHE_CACHE_SIZE: "1G" - SCCACHE_IDLE_TIMEOUT: 0 - ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: - name: Checkout sources uses: actions/checkout@main @@ -25,32 +21,6 @@ jobs: toolchain: stable profile: minimal override: true - - name: Cache cargo registry - uses: actions/cache@v1.1.2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo index - uses: actions/cache@v1.1.2 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} - - name: Cache cargo build - uses: actions/cache@v1.1.2 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - # Install sccache based on https://github.com/denoland/rusty_v8/blob/master/.github/workflows/ci.yml#L69 - - name: Cache sccache - uses: actions/cache@v1.1.2 - with: - path: "/home/runner/.cache/sccache" - key: ${{ runner.os }}-sccache-check-${{ hashFiles('**/Cargo.lock') }} - - name: Install sccache for Linux - shell: pwsh - run: pwsh scripts/actions/install-sccache.ps1 ${{ runner.os}} - - name: Sccache statistics - run: sccache --show-stats - name: Run cargo check 1/3 uses: actions-rs/cargo@v1 with: @@ -78,10 +48,3 @@ jobs: args: --locked --all --benches --verbose - name: Run validate chainspecs run: ./scripts/actions/validate-chainspecs.sh - - name: Stop sccache - if: always() - run: sccache --stop-server - continue-on-error: true - - name: Prepare build directory for cache - shell: bash - run: bash scripts/actions/clean-target.sh diff --git a/.github/workflows/deploy-docker-nightly.yml b/.github/workflows/deploy-docker-nightly.yml new file mode 100644 index 000000000..b80691b15 --- /dev/null +++ b/.github/workflows/deploy-docker-nightly.yml @@ -0,0 +1,29 @@ +name: Docker Image Nightly Release + +# Run "nightly" build on each commit to "dev" branch. +on: + push: + branches: + - dev + +jobs: + deploy-docker: + name: Build Release + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@master + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Deploy to docker hub + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: openethereum/openethereum + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + dockerfile: scripts/docker/alpine/Dockerfile + tags: "nightly" diff --git a/.github/workflows/deploy-docker-tag.yml b/.github/workflows/deploy-docker-tag.yml new file mode 100644 index 000000000..84beb5dec --- /dev/null +++ b/.github/workflows/deploy-docker-tag.yml @@ -0,0 +1,30 @@ +name: Docker Image Tag and Latest Release + +on: + push: + tags: + - v* + +jobs: + deploy-docker: + name: Build Release + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@master + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Deploy to docker hub + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: openethereum/openethereum + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + dockerfile: scripts/docker/alpine/Dockerfile + tags: "latest,${{ env.RELEASE_VERSION }}" diff --git a/scripts/actions/validate-chainspecs.sh b/scripts/actions/validate-chainspecs.sh index cf5c126f7..b5501b450 100755 --- a/scripts/actions/validate-chainspecs.sh +++ b/scripts/actions/validate-chainspecs.sh @@ -16,5 +16,5 @@ for spec in ethcore/res/ethereum/*.json; do if ! ./target/release/chainspec "$spec"; then ERR=1; fi done #show sccache statistics -sccache --stop-server +#sccache --stop-server exit $ERR