diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e9dbe9b6de..acec332158 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # Automatically require code review from core-team. -* @sb-anderson @gts2030 @gazzua @syjn99 @qqqeck \ No newline at end of file +* @overprotocol/protocol-dev \ No newline at end of file diff --git a/.github/actions/gomodtidy/Dockerfile b/.github/actions/gomodtidy/Dockerfile index 0a7b6e3329..9ea7e87afd 100644 --- a/.github/actions/gomodtidy/Dockerfile +++ b/.github/actions/gomodtidy/Dockerfile @@ -1,10 +1,5 @@ FROM golang:alpine -RUN apk update -RUN apk add git +COPY entrypoint.sh /entrypoint.sh -ARG CACHEBUST=1 -COPY . /github/workspace -COPY .github/actions/gomodtidy/entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/gomodtidy/action.yml b/.github/actions/gomodtidy/action.yml index 07b7bbf763..27d3d8e9e3 100644 --- a/.github/actions/gomodtidy/action.yml +++ b/.github/actions/gomodtidy/action.yml @@ -1,13 +1,5 @@ -name: "Go mod tidy checker" -description: "Checks that `go mod tidy` has been applied." -on: - workflow_call: - inputs: - github_token: - required: true - type: string +name: 'Go mod tidy checker' +description: 'Checks that `go mod tidy` has been applied.' runs: - using: "docker" - image: "Dockerfile" - args: - - ${{ inputs.github_token }} \ No newline at end of file + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/gomodtidy/entrypoint.sh b/.github/actions/gomodtidy/entrypoint.sh index 95f41fb711..32df725c8d 100755 --- a/.github/actions/gomodtidy/entrypoint.sh +++ b/.github/actions/gomodtidy/entrypoint.sh @@ -1,17 +1,13 @@ #!/bin/sh -l set -e - export PATH="$PATH:/usr/local/go/bin" -cd "/github/workspace" - -go env -w GOPRIVATE=github.com/superblock-dev -git config --global url."https://$1@github.com/superblock-dev".insteadOf "https://github.com/superblock-dev" +cd "$GITHUB_WORKSPACE" cp go.mod go.mod.orig cp go.sum go.sum.orig -go mod tidy -compat=1.21 +go mod tidy -compat=1.17 echo "Checking go.mod and go.sum:" checks=0 diff --git a/.github/workflows/_build-bazel.yml b/.github/workflows/_build-bazel.yml new file mode 100644 index 0000000000..71c59e6793 --- /dev/null +++ b/.github/workflows/_build-bazel.yml @@ -0,0 +1,67 @@ +name: Build binaries with Bazel + +on: + workflow_call: + inputs: + build-type: + required: true + type: string + tag_name: + required: true + type: string + version_name: + required: true + type: string + +jobs: + build-binaries: + runs-on: ubuntu-latest + container: + image: overfoundation/bazel-cross:latest + steps: + - uses: actions/checkout@v3 + - name: Git config + run: | + git config --global --add safe.directory /__w/chronos/chronos + + - name: Build ${{ inputs.build-type }} + run: | + bazel build \ + --config=release \ + --config=${{ inputs.build-type }} \ + //cmd/beacon-chain \ + //cmd/validator \ + //cmd/prysmctl \ + //tools/enr-calculator \ + //tools/bootnode + + - name: Make dist directory + run: | + mkdir -p dist + mkdir -p dist/${{ github.sha }} + + - name: Zip artifact (Windows) + if: ${{ inputs.build-type == 'windows_amd64' }} + run: | + zip -j dist/${{ github.sha }}/chronos_${{ inputs.build-type }}.zip \ + bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain.exe \ + bazel-bin/cmd/validator/validator_/validator.exe \ + bazel-bin/cmd/prysmctl/prysmctl_/prysmctl.exe \ + bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator.exe \ + bazel-bin/tools/bootnode/bootnode_/bootnode.exe + + - name: Zip artifact (Non-Windows) + if: ${{ inputs.build-type != 'windows_amd64' }} + run: | + zip -j dist/${{ github.sha }}/chronos_${{ inputs.build-type }}.zip \ + bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain \ + bazel-bin/cmd/validator/validator_/validator \ + bazel-bin/cmd/prysmctl/prysmctl_/prysmctl \ + bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator \ + bazel-bin/tools/bootnode/bootnode_/bootnode + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: chronos_${{ github.sha }}_${{ inputs.build-type }} + path: dist/${{ github.sha }}/chronos_${{ inputs.build-type }}.zip diff --git a/.github/workflows/_build-docker.yml b/.github/workflows/_build-docker.yml new file mode 100644 index 0000000000..c5a2b08dbe --- /dev/null +++ b/.github/workflows/_build-docker.yml @@ -0,0 +1,78 @@ +name: Build Docker images with Bazel and push to Docker Hub + +on: + workflow_call: + inputs: + tag_name: + required: true + type: string + version_name: + required: true + type: string + secrets: + DOCKERHUB_USERNAME: + required: true + DOCKERHUB_TOKEN: + required: true + +jobs: + build-and-push-images: + runs-on: ubuntu-latest + container: + image: overfoundation/bazel-cross:latest + outputs: + docker_tag: ${{ steps.set-docker-tag.outputs.docker_tag }} + steps: + - uses: actions/checkout@v3 + - name: Git config + run: | + git config --global --add safe.directory /__w/chronos/chronos + + - name: Set Docker Tag + id: set-docker-tag + run: | + echo "docker_tag=${{ inputs.version_name }}_${{ inputs.tag_name }}" >> $GITHUB_OUTPUT + + - name: Login docker hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Run push_images for beacon-chain + run: | + echo "Run push_images(beacon-chain) for ${{ steps.set-docker-tag.outputs.docker_tag }}" + bazel run \ + //cmd/beacon-chain:push_images \ + --config=release \ + -- \ + --tag=${{ steps.set-docker-tag.outputs.docker_tag }} \ + --repository=overfoundation/chronos-beacon-chain + + - name: Run push_images for validator + run: | + echo "Run push_images(validator) for ${{ steps.set-docker-tag.outputs.docker_tag }}" + bazel run \ + //cmd/validator:push_images \ + --config=release \ + -- \ + --tag=${{ steps.set-docker-tag.outputs.docker_tag }} \ + --repository=overfoundation/chronos-validator + + - name: Run push_images for latest + if: ${{ inputs.tag_name == 'stable' }} + run: | + echo "Run push_images(latest) for ${{ steps.set-docker-tag.outputs.docker_tag }}" + bazel run \ + //cmd/beacon-chain:push_images \ + --config=release \ + -- \ + --tag=latest \ + --repository=overfoundation/chronos-beacon-chain + + bazel run \ + //cmd/validator:push_images \ + --config=release \ + -- \ + --tag=latest \ + --repository=overfoundation/chronos-validator diff --git a/.github/workflows/cd.tags.yml b/.github/workflows/cd.tags.yml deleted file mode 100644 index 6a9ec12871..0000000000 --- a/.github/workflows/cd.tags.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: Deploy triggered with tags - -on: - push: - tags: - # parse names from tags v{version}_{name} - - "v*_*" - -env: - S3_BUCKET_NAME: over-protocol-dist - -jobs: - extract_name: - runs-on: [self-hosted, Linux, docker] - outputs: - tag_name: ${{ steps.extract.outputs.tag_name }} - version_name: ${{ steps.extract.outputs.version_name }} - steps: - - uses: actions/checkout@v3 - - name: Extract tag name, version - id: extract - run: | - full_tag="${{ github.ref_name }}" - version_name="${full_tag%%_*}" - tag_name="${full_tag#*_}" - echo "tag_name=$tag_name" >> $GITHUB_OUTPUT - echo "version_name=$version_name" >> $GITHUB_OUTPUT - - build: - needs: extract_name - strategy: - matrix: - symbol-list: - [ - chronos_osx_amd64, - chronos_osx_arm64, - chronos_windows, - chronos_linux_amd64, - chronos_linux_arm64, - ] - uses: ./.github/workflows/dist.upload.yml - name: build - with: - build_type: ${{ matrix.symbol-list }} - tag_name: ${{ needs.extract_name.outputs.tag_name }} - version_name: ${{ needs.extract_name.outputs.version_name }} - secrets: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - node-pack-lipo: - needs: [extract_name, build] - runs-on: [self-hosted, macmini-local] - steps: - - uses: actions/checkout@v3 - - name: Download osx amd64 artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx_amd64 - path: dist/bin - - name: Download osx arm64 artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx_arm64 - path: dist/bin - - run: lipo -create -output dist/bin/mac/chronos dist/bin/mac/amd64/chronos dist/bin/mac/arm64/chronos - - run: lipo -create -output dist/bin/mac/validator dist/bin/mac/amd64/validator dist/bin/mac/arm64/validator - - run: rm -r -f dist/bin/mac/amd64 dist/bin/mac/arm64 - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx - path: dist/bin - - codesign-osx: - needs: [extract_name, build, node-pack-lipo] - runs-on: [self-hosted, macmini-local] - steps: - - uses: actions/checkout@v3 - - name: Download osx artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx - path: dist/bin - - name: Run codesign script for chronos - run: sh ~/codesign/osx/codesign.sh - env: - BINARY_PATH: ${{ github.workspace }}/dist/bin/mac/chronos - - name: Run codesign script for validator - run: sh ~/codesign/osx/codesign.sh - env: - BINARY_PATH: ${{ github.workspace }}/dist/bin/mac/validator - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx_with_codesign - path: dist/bin - - codesign-win: - needs: [extract_name, build] - runs-on: [self-hosted, macmini-local] - steps: - - uses: actions/checkout@v3 - - name: Download windows artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_windows - path: dist/bin - - name: Run codesign script for chronos - run: sh ~/codesign/win/codesign.sh - env: - BINARY_PATH: ${{ github.workspace }}/dist/bin/win/chronos.exe - TOKEN_PASSWORD: ${{ secrets.WINDOWS_SIGN_TOKEN_PASSWORD }} - - name: Run codesign script for validator - run: sh ~/codesign/win/codesign.sh - env: - BINARY_PATH: ${{ github.workspace }}/dist/bin/win/validator.exe - TOKEN_PASSWORD: ${{ secrets.WINDOWS_SIGN_TOKEN_PASSWORD }} - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_windows_with_codesign - path: dist/bin - - node-pack: - needs: [extract_name, build, codesign-osx, codesign-win] - runs-on: [self-hosted, Linux, docker] - steps: - - uses: actions/checkout@v3 - - name: Download windows artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_windows_with_codesign - path: dist/bin - - name: Download linux artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_linux_amd64 - path: dist/bin - - name: Download osx artifact - uses: actions/download-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-chronos_osx_with_codesign - path: dist/bin - - run: mv dist/bin/linux/amd64/chronos dist/bin/linux/chronos - - run: mv dist/bin/linux/amd64/validator dist/bin/linux/validator - - run: rm -rf dist/bin/linux/amd64 - - run: zip -r dist/over-node-chronos.zip dist/bin - - 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: ap-northeast-2 - - name: Upload to AWS S3 - run: | - aws s3 cp ./dist/over-node-chronos.zip \ - ${{ format('s3://{0}/{1}/{2}/over-node-chronos.zip', env.S3_BUCKET_NAME, needs.extract_name.outputs.version_name, needs.extract_name.outputs.tag_name ) }} \ - --acl public-read - - notification: - needs: [extract_name, build, node-pack] - runs-on: [self-hosted, linux, tesseract] - steps: - - name: Drop metadata - run: | - echo "<${{ format('https://{0}.s3.ap-northeast-2.amazonaws.com/{1}/{2}/over-node-chronos.zip', env.S3_BUCKET_NAME, needs.extract_name.outputs.version_name, needs.extract_name.outputs.tag_name ) }}|over-node-chronos.zip>" >> /usr/local/share/notification/chronos/${{ env.S3_BUCKET_NAME }} - - run: sh /usr/local/share/notification/chronos/over_dist_notification.sh ${{ needs.extract_name.outputs.version_name }} ${{ needs.extract_name.outputs.tag_name }} diff --git a/.github/workflows/dist.upload.yml b/.github/workflows/dist.upload.yml deleted file mode 100644 index 7929bd9a63..0000000000 --- a/.github/workflows/dist.upload.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build & Deploy dist to S3 - -on: - workflow_call: - inputs: - build_type: - required: true - type: string - tag_name: - required: true - type: string - version_name: - required: true - type: string - secrets: - GH_TOKEN: - required: true - AWS_ACCESS_KEY_ID: - required: true - AWS_SECRET_ACCESS_KEY: - required: true - -env: - S3_BUCKET_NAME: over-protocol-dist - -permissions: - contents: read - -jobs: - build-ubuntu: - runs-on: [self-hosted, Linux, docker] - name: Build bazel & upload - steps: - - uses: actions/checkout@v3 - - name: Set Github Token - run: | - git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/superblock-dev".insteadOf "https://github.com/superblock-dev" - - name: Run build - run: | - sh dist/build_${{ inputs.build_type }}.sh - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: chronos-dist-${{ github.sha }}-${{ inputs.build_type }} - path: dist/bin - - - 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: ap-northeast-2 - - - name: Upload to AWS S3 - run: | - aws s3 cp ./dist/${{ inputs.build_type }}.zip \ - ${{ format('s3://{0}/{1}/{2}/{3}.zip', env.S3_BUCKET_NAME, inputs.version_name, inputs.tag_name, inputs.build_type ) }} \ - --acl public-read - - drop-metadata: - needs: [build-ubuntu] - runs-on: [self-hosted, linux, tesseract] - steps: - - name: Drop metadata - run: | - echo "<${{ format('https://{0}.s3.ap-northeast-2.amazonaws.com/{1}/{2}/{3}.zip', env.S3_BUCKET_NAME, inputs.version_name, inputs.tag_name, inputs.build_type ) }}|${{ inputs.build_type }}>" >> /usr/local/share/notification/chronos/${{ env.S3_BUCKET_NAME }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 207cbfc174..1488eb8cbe 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,96 +5,71 @@ on: branches: [ master ] pull_request: branches: [ '*' ] + merge_group: + types: [checks_requested] jobs: formatting: name: Formatting - runs-on: [self-hosted, Linux, docker] + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: Go mod tidy checker id: gomodtidy - run: docker build --build-arg CACHEBUST=$(date +%s) -f .github/actions/gomodtidy/Dockerfile -t gomodtidy ${{ github.workspace }} - - name: Run Go mod tidy checker - run: docker run gomodtidy ${{ secrets.GH_TOKEN }} + uses: ./.github/actions/gomodtidy gosec: name: Gosec scan - runs-on: [self-hosted, Linux, docker] + runs-on: ubuntu-latest env: GO111MODULE: on - GOPRIVATE: github.com/superblock-dev - GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }} steps: - name: Checkout - uses: actions/checkout@v3 - - - name: Set Github Token - run: | - git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/superblock-dev".insteadOf "https://github.com/superblock-dev" - + uses: actions/checkout@v4 - name: Set up Go 1.21.5 uses: actions/setup-go@v4 with: go-version: '1.21.5' - # cache: false - id: go - + cache: false - name: Run Gosec Security Scanner run: | # https://github.com/securego/gosec/issues/469 export PATH=$PATH:$(go env GOPATH)/bin go install github.com/securego/gosec/v2/cmd/gosec@v2.15.0 - gosec -exclude=G307 -exclude-dir=crypto/bls/herumi ./... + gosec -exclude-generated -exclude=G307 -exclude-dir=crypto/bls/herumi ./... lint: name: Lint - runs-on: [self-hosted, Linux, docker] - env: - GOPRIVATE: github.com/superblock-dev - GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }} + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - - name: Set Github Token - run: | - git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/superblock-dev".insteadOf "https://github.com/superblock-dev" + uses: actions/checkout@v4 - - name: Set up Go 1.21 - uses: actions/setup-go@v3 + - name: Set up Go 1.21.5 + uses: actions/setup-go@v4 with: go-version: '1.21.5' - id: go + id: go - name: Golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v5 with: version: v1.55.2 args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number - skip-pkg-cache: true - skip-build-cache: true build: name: Build - runs-on: [self-hosted, Linux, docker] - env: - GOPRIVATE: github.com/superblock-dev - GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }} + runs-on: ubuntu-latest steps: - - name: Set Github Token - run: | - git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/superblock-dev".insteadOf "https://github.com/superblock-dev" - - - name: Set up Go 1.21.5 + - name: Set up Go 1.x uses: actions/setup-go@v4 with: go-version: '1.21.5' - # cache: false id: go - - name: Check out code into the Go module directoryrm -rf bo - uses: actions/checkout@v3 + - name: Check out code into the Go module directory + uses: actions/checkout@v4 - name: Get dependencies run: | @@ -104,16 +79,14 @@ jobs: # Use blst tag to allow go and bazel builds for blst. run: go build -v ./... env: - CGO_CFLAGS: "-O2 -D__BLST_PORTABLE__" + CGO_CFLAGS: "-O2 -D__BLST_PORTABLE__" # fuzz leverage go tag based stubs at compile time. # Building and testing with these tags should be checked and enforced at pre-submit. - - name: Test for fuzzing run: go test -tags=fuzz,develop ./... -test.run=^Fuzz env: - CGO_CFLAGS: "-O2 -D__BLST_PORTABLE__" - + CGO_CFLAGS: "-O2 -D__BLST_PORTABLE__" -# # Tests run via Bazel for now... +# Tests run via Bazel for now... # - name: Test # run: go test -v ./... diff --git a/.github/workflows/tag-build.yml b/.github/workflows/tag-build.yml new file mode 100644 index 0000000000..c4ced3b4e8 --- /dev/null +++ b/.github/workflows/tag-build.yml @@ -0,0 +1,174 @@ +name: Build with tag + +on: + push: + tags: + - "v*_*" # Format: v..[_] + +permissions: + contents: write + +jobs: + extract-version: + runs-on: ubuntu-latest + outputs: + tag_name: ${{ steps.extract.outputs.tag_name }} + version_name: ${{ steps.extract.outputs.version_name }} + steps: + - uses: actions/checkout@v3 + - name: Extract tag name, version + id: extract + run: | + full_tag="${{ github.ref_name }}" + version_name="${full_tag%%_*}" + tag_name="${full_tag#*_}" + echo "tag_name=$tag_name" >> $GITHUB_OUTPUT + echo "version_name=$version_name" >> $GITHUB_OUTPUT + + build: + needs: extract-version + strategy: + matrix: + symbol-list: + [osx_amd64, osx_arm64, windows_amd64, linux_amd64, linux_arm64] + uses: ./.github/workflows/_build-bazel.yml + with: + build-type: ${{ matrix.symbol-list }} + tag_name: ${{ needs.extract-version.outputs.tag_name }} + version_name: ${{ needs.extract-version.outputs.version_name }} + + upload-aws: + needs: [build, extract-version] + runs-on: ubuntu-latest + steps: + - 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: ${{ secrets.AWS_REGION }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist/${{ github.sha }} + + - name: Flatten directory structure + run: | + find dist/${{ github.sha }} -name '*.zip' -exec mv {} dist/${{ github.sha }}/ \; + find dist/${{ github.sha }} -mindepth 1 -type d -delete + + - name: Upload to S3 + run: | + aws s3 cp dist/${{ github.sha }} \ + s3://${{ secrets.AWS_BUCKET_NAME }}/${{ needs.extract-version.outputs.version_name }}/${{ needs.extract-version.outputs.tag_name }} \ + --recursive --exclude "*" --include "*.zip" --acl public-read + + upload-aws-latest: + needs: [build, extract-version] + runs-on: ubuntu-latest + if: ${{ needs.extract-version.outputs.tag_name == 'stable' }} + steps: + - 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: ${{ secrets.AWS_REGION }} + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist/${{ github.sha }} + + - name: Flatten directory structure + run: | + find dist/${{ github.sha }} -name '*.zip' -exec mv {} dist/${{ github.sha }}/ \; + find dist/${{ github.sha }} -mindepth 1 -type d -delete + + - name: Download latest.yml from S3 + run: | + aws s3 cp s3://${{ secrets.AWS_BUCKET_NAME }}/latest/latest.yml latest.yml + + - name: Update latest.yml file for chronos + run: | + echo "Updating chronos version and tag in latest.yml" + yq eval '.chronos.version = "${{ needs.extract-version.outputs.version_name }}" | .chronos.tag = "${{ needs.extract-version.outputs.tag_name }}"' -i latest.yml + + - name: Upload updated latest.yml to S3 + run: | + aws s3 cp latest.yml s3://${{ secrets.AWS_BUCKET_NAME }}/latest/latest.yml --acl public-read + + - name: Upload to S3 + run: | + aws s3 cp dist/${{ github.sha }} \ + s3://${{ secrets.AWS_BUCKET_NAME }}/latest/chronos \ + --recursive --exclude "*" --include "*.zip" --acl public-read + + docker: + needs: [extract-version] + uses: ./.github/workflows/_build-docker.yml + with: + tag_name: ${{ needs.extract-version.outputs.tag_name }} + version_name: ${{ needs.extract-version.outputs.version_name }} + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + + create-release: + needs: [build, extract-version] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: "Generate release changelog" + id: changelog + run: | + git fetch --tags + prev_tag=$(git tag --sort=-version:refname | grep -e "^v[0-9.]*$" | head -n 1) + echo "previous release: $prev_tag" + if [ "$prev_tag" ]; then + changelog=$(git log --oneline --no-decorate $prev_tag..HEAD) + else + changelog=$(git log --oneline --no-decorate) + fi + echo "changelog<> $GITHUB_OUTPUT + echo " - ${changelog//$'\n'/$'\n' - }" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: dist + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + files: dist/**/*.zip + draft: true + prerelease: false + body: | + ### Changes + ${{ steps.changelog.outputs.changelog }} + + ### Release Artifacts + Please read through our official [documentation](https://docs.over.network/) for setup instructions. + | Release File | Description | + | ------------- | ------------- | + | [chronos_windows_amd64.zip](https://github.com/overprotocol/chronos/releases/download/${{ github.ref_name }}/chronos_windows_amd64.zip) | chronos executables for windows/amd64 | + | [chronos_linux_amd64.zip](https://github.com/overprotocol/chronos/releases/download/${{ github.ref_name }}/chronos_linux_amd64.zip) | chronos executables for linux/amd64 | + | [chronos_linux_arm64.zip](https://github.com/overprotocol/chronos/releases/download/${{ github.ref_name }}/chronos_linux_arm64.zip) | chronos executables for linux/arm64 | + | [chronos_osx_amd64.zip](https://github.com/overprotocol/chronos/releases/download/${{ github.ref_name }}/chronos_osx_amd64.zip) | chronos executables for macos/amd64 | + | [chronos_osx_arm64.zip](https://github.com/overprotocol/chronos/releases/download/${{ github.ref_name }}/chronos_osx_arm64.zip) | chronos executables for macos/arm64 | + env: + GITHUB_TOKEN: ${{ github.token }} + + clean: + needs: [create-release] + runs-on: ubuntu-latest + steps: + - name: Clean up + run: | + rm -rf dist + rm -rf bazel-bin diff --git a/beacon-chain/sync/checkpoint/BUILD.bazel b/beacon-chain/sync/checkpoint/BUILD.bazel index 4c9f551bfd..a865d5f463 100644 --- a/beacon-chain/sync/checkpoint/BUILD.bazel +++ b/beacon-chain/sync/checkpoint/BUILD.bazel @@ -6,7 +6,6 @@ go_library( "api.go", "common.go", "file.go", - "log.go", ], importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/checkpoint", visibility = ["//visibility:public"], @@ -15,6 +14,5 @@ go_library( "//beacon-chain/db:go_default_library", "//io/file:go_default_library", "@com_github_pkg_errors//:go_default_library", - "@com_github_sirupsen_logrus//:go_default_library", ], ) diff --git a/beacon-chain/sync/checkpoint/common.go b/beacon-chain/sync/checkpoint/common.go index d7f22cf1f7..67e7125d42 100644 --- a/beacon-chain/sync/checkpoint/common.go +++ b/beacon-chain/sync/checkpoint/common.go @@ -28,4 +28,4 @@ func isCheckpointStatePresent(ctx context.Context, d db.Database) (bool, error) return true, nil } return false, nil -} \ No newline at end of file +} diff --git a/beacon-chain/sync/checkpoint/log.go b/beacon-chain/sync/checkpoint/log.go deleted file mode 100644 index 3cf5fad74c..0000000000 --- a/beacon-chain/sync/checkpoint/log.go +++ /dev/null @@ -1,5 +0,0 @@ -package checkpoint - -import "github.com/sirupsen/logrus" - -var log = logrus.WithField("prefix", "checkpoint-sync") diff --git a/cmd/beacon-chain/BUILD.bazel b/cmd/beacon-chain/BUILD.bazel index ad28cf63e8..168ddd57e7 100644 --- a/cmd/beacon-chain/BUILD.bazel +++ b/cmd/beacon-chain/BUILD.bazel @@ -73,7 +73,7 @@ prysm_image_upload( name = "push_images", binary = ":beacon-chain", entrypoint = ["/beacon-chain"], - repository = "gcr.io/prysmaticlabs/prysm/beacon-chain", + repository = "overfoundation/chronos-beacon-chain", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/cmd/beacon-chain/beacon-chain": "/beacon-chain", diff --git a/cmd/prysmctl/BUILD.bazel b/cmd/prysmctl/BUILD.bazel index fdcb9f0080..2db84e67c8 100644 --- a/cmd/prysmctl/BUILD.bazel +++ b/cmd/prysmctl/BUILD.bazel @@ -30,7 +30,7 @@ prysm_image_upload( name = "push_images", binary = ":prysmctl", entrypoint = ["/prysmctl"], - repository = "gcr.io/prysmaticlabs/prysm/cmd/prysmctl", + repository = "overfoundation/chronos-prysmctl", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/cmd/prysmctl/prysmctl": "/prysmctl", diff --git a/cmd/validator/BUILD.bazel b/cmd/validator/BUILD.bazel index bdb258f43c..31a4303676 100644 --- a/cmd/validator/BUILD.bazel +++ b/cmd/validator/BUILD.bazel @@ -60,7 +60,7 @@ prysm_image_upload( name = "push_images", binary = ":validator", entrypoint = ["/validator"], - repository = "gcr.io/prysmaticlabs/prysm/validator", + repository = "overfoundation/chronos-validator", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/cmd/validator/validator": "/validator", diff --git a/dist/build_chronos_linux_amd64.sh b/dist/build_chronos_linux_amd64.sh deleted file mode 100644 index 8f56a33216..0000000000 --- a/dist/build_chronos_linux_amd64.sh +++ /dev/null @@ -1,10 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --config=release --config=linux_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_linux_amd64.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -mkdir -p dist/bin/linux/amd64 -cp bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain dist/bin/linux/amd64/chronos -cp bazel-bin/cmd/validator/validator_/validator dist/bin/linux/amd64/validator -rm -rf bazel-bin diff --git a/dist/build_chronos_linux_amd64_minimal.sh b/dist/build_chronos_linux_amd64_minimal.sh deleted file mode 100644 index 7f59208e2d..0000000000 --- a/dist/build_chronos_linux_amd64_minimal.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --stamp --config=minimal --config=linux_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_linux_amd64_minimal.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -rm -rf bazel-bin diff --git a/dist/build_chronos_linux_arm64.sh b/dist/build_chronos_linux_arm64.sh deleted file mode 100644 index 67e2e168bb..0000000000 --- a/dist/build_chronos_linux_arm64.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --config=release --config=linux_arm64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_linux_arm64.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -rm -rf bazel-bin diff --git a/dist/build_chronos_linux_arm64_minimal.sh b/dist/build_chronos_linux_arm64_minimal.sh deleted file mode 100644 index 7e869efbdc..0000000000 --- a/dist/build_chronos_linux_arm64_minimal.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --stamp --config=minimal --config=linux_arm64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_linux_arm64_minimal.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -rm -rf bazel-bin diff --git a/dist/build_chronos_osx_amd64.sh b/dist/build_chronos_osx_amd64.sh deleted file mode 100644 index c26de98a4f..0000000000 --- a/dist/build_chronos_osx_amd64.sh +++ /dev/null @@ -1,10 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --config=release --config=osx_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_osx_amd64.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -mkdir -p dist/bin/mac/amd64 -cp bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain dist/bin/mac/amd64/chronos -cp bazel-bin/cmd/validator/validator_/validator dist/bin/mac/amd64/validator -rm -rf bazel-bin diff --git a/dist/build_chronos_osx_amd64_minimal.sh b/dist/build_chronos_osx_amd64_minimal.sh deleted file mode 100644 index 954c0dda89..0000000000 --- a/dist/build_chronos_osx_amd64_minimal.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --stamp --config=minimal --config=osx_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_osx_amd64_minimal.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -rm -rf bazel-bin diff --git a/dist/build_chronos_osx_arm64.sh b/dist/build_chronos_osx_arm64.sh deleted file mode 100644 index bd238d059d..0000000000 --- a/dist/build_chronos_osx_arm64.sh +++ /dev/null @@ -1,10 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --config=release --config=osx_arm64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_osx_arm64.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -mkdir -p dist/bin/mac/arm64 -cp bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain dist/bin/mac/arm64/chronos -cp bazel-bin/cmd/validator/validator_/validator dist/bin/mac/arm64/validator -rm -rf bazel-bin diff --git a/dist/build_chronos_osx_arm64_minimal.sh b/dist/build_chronos_osx_arm64_minimal.sh deleted file mode 100644 index 9b4c4b5061..0000000000 --- a/dist/build_chronos_osx_arm64_minimal.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --stamp --config=minimal --config=osx_arm64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_osx_arm64_minimal.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain bazel-bin/cmd/validator/validator_/validator bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator bazel-bin/cmd/prysmctl/prysmctl_/prysmctl bazel-bin/tools/bootnode/bootnode_/bootnode -rm -rf bazel-bin diff --git a/dist/build_chronos_windows.sh b/dist/build_chronos_windows.sh deleted file mode 100644 index 207de2ab40..0000000000 --- a/dist/build_chronos_windows.sh +++ /dev/null @@ -1,10 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --sandbox_debug --verbose_failures --config=release --config=windows_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_windows.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain.exe bazel-bin/cmd/validator/validator_/validator.exe bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator.exe bazel-bin/cmd/prysmctl/prysmctl_/prysmctl.exe bazel-bin/cmd/bootnode/bootnode_/bootnode.exe -mkdir -p dist/bin/win -cp bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain.exe dist/bin/win/chronos.exe -cp bazel-bin/cmd/validator/validator_/validator.exe dist/bin/win/validator.exe -rm -rf bazel-bin diff --git a/dist/build_chronos_windows_minimal.sh b/dist/build_chronos_windows_minimal.sh deleted file mode 100644 index 52d4125b01..0000000000 --- a/dist/build_chronos_windows_minimal.sh +++ /dev/null @@ -1,7 +0,0 @@ -bazel build --remote_cache=http://192.168.2.200:9090 --stamp --config=minimal --config=windows_amd64 //cmd/beacon-chain //cmd/validator //cmd/prysmctl //tools/enr-calculator //tools/bootnode -if [ $? -ne 0 ]; then - echo "Bazel build failed." - exit 1 -fi -zip -j dist/chronos_windows_minimal.zip bazel-bin/cmd/beacon-chain/beacon-chain_/beacon-chain.exe bazel-bin/cmd/validator/validator_/validator.exe bazel-bin/tools/enr-calculator/enr-calculator_/enr-calculator.exe bazel-bin/cmd/prysmctl/prysmctl_/prysmctl.exe bazel-bin/cmd/bootnode/bootnode_/bootnode.exe -rm -rf bazel-bin diff --git a/tools/bootnode/BUILD.bazel b/tools/bootnode/BUILD.bazel index ec50c8803d..1f561645c1 100644 --- a/tools/bootnode/BUILD.bazel +++ b/tools/bootnode/BUILD.bazel @@ -59,7 +59,7 @@ prysm_image_upload( name = "push_images", binary = ":bootnode", entrypoint = ["/bootnode"], - repository = "gcr.io/prysmaticlabs/prysm/bootnode", + repository = "overfoundation/chronos-bootnode", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/tools/bootnode/bootnode": "/bootnode", diff --git a/tools/cross-toolchain/Dockerfile b/tools/cross-toolchain/Dockerfile index d1b7988765..7a33e887d9 100644 --- a/tools/cross-toolchain/Dockerfile +++ b/tools/cross-toolchain/Dockerfile @@ -1,19 +1,27 @@ -# Prysmatic Labs Remote Build Execution Image with Cross Compile Support. +# OverProtocol Remote Build Execution Image with Cross Compile Support. # # See README.md for update instructions. -FROM debian:bullseye-slim as build +FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-jammy # install gnu/gcc cross-build toolchain (gcc 8.3) -ENV DOCKER_CLI_EXPERIMENTAL=enabled -RUN apt-get update && \ - apt-get install -y \ - curl xz-utils \ - gcc g++ mingw-w64 \ - gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ - cmake libssl-dev libxml2-dev vim apt-transport-https \ - zip unzip libtinfo5 patch zlib1g-dev autoconf libtool \ - pkg-config make docker.io gnupg2 libgmp-dev python3 openjdk-17-jdk-headless +RUN apt-get update -y \ + && apt-get install -y \ + sudo lsb-release nodejs npm libtool libyaml-dev unzip curl git gcc-multilib xz-utils gcc g++ mingw-w64 \ + cmake libssl-dev libxml2-dev vim apt-transport-https \ + zip libtinfo5 patch zlib1g-dev autoconf pkg-config make docker.io gnupg2 libgmp-dev python3 \ + openjdk-17-jdk-headless tini \ + && rm -rf /var/lib/apt/lists/* +RUN apt-get update -y \ + && apt-get install -y \ + gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ + && rm -rf /var/lib/apt/lists/* + +# install bazel +RUN npm install -g yarn @bazel/bazelisk + +# install aws cli +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install # install llvm/clang cross-build toolchains ENV INSTALL_LLVM_VERSION=12.0.0 @@ -25,11 +33,4 @@ ADD install_osxcross.sh /tmp/install_osxcross.sh ADD common_osxcross.sh /tmp/common_osxcross.sh RUN /tmp/install_osxcross.sh ADD link_osxcross.sh /tmp/link_osxcross.sh -RUN /tmp/link_osxcross.sh - -# containerized development environment -FROM build as devel - -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ - -RUN echo 'PS1="\[$(tput setaf 3)$(tput bold)[\]devel@\\h:\\W]#\[$(tput sgr0) \]"' >> /root/.bashrc +RUN /tmp/link_osxcross.sh \ No newline at end of file diff --git a/tools/cross-toolchain/README.md b/tools/cross-toolchain/README.md index f61d094e5a..a8b634b24d 100644 --- a/tools/cross-toolchain/README.md +++ b/tools/cross-toolchain/README.md @@ -16,18 +16,18 @@ This toolchain suite describes cross compile configuration with a Dockerfile wit 1) Build and push the worker docker image, if necessary. ```bash -docker build -t gcr.io/prysmaticlabs/rbe-worker:latest tools/cross-toolchain/. -docker push gcr.io/prysmaticlabs/rbe-worker:latest +docker buildx build --platform linux/amd64 -t overfoundation/bazel-cross:latest tools/cross-toolchain/. +docker push overfoundation/bazel-cross:latest ``` -Note: You must configured your gcr access credentials to push to gcr.io/prysmaticlabs. Run `gcloud auth configure-docker` or contact SRE team for push access. +Note: You must configured your ghcr access credentials to push to OverFoundation Docker Hub. Contact SRE team for push access. -2) Note the docker image sha256 digest from the recently pushed image or use the latest one available. +1) Note the docker image sha256 digest from the recently pushed image or use the latest one available. -3) Download and run [rbe_configs_gen](https://github.com/bazelbuild/bazel-toolchains#rbe_configs_gen---cli-tool-to-generate-configs) CLI tool. +2) Download and run [rbe_configs_gen](https://github.com/bazelbuild/bazel-toolchains#rbe_configs_gen---cli-tool-to-generate-configs) CLI tool. ```bash -# Run from the root of the Prysm repo. +# Run from the root of the Chronos repo. rbe_configs_gen \ --bazel_version=$(cat .bazelversion) \ --target_os=linux \ @@ -36,7 +36,7 @@ rbe_configs_gen \ --generate_cpp_configs=true \ --generate_java_configs=true \ --cpp_env_json=tools/cross-toolchain/cpp_env_clang.json \ - --toolchain_container=gcr.io/prysmaticlabs/rbe-worker@sha256:90d490709a0fb0c817569f37408823a0490e5502cbecc36415caabfc36a0c2e8 # The sha256 digest from step 2. + --toolchain_container=overfoundation/bazel-cross@sha256:662e9fc2eee120b09fc67ad320a08cfab3609787827af005a0b9f49145cd1d6a # The sha256 digest from step 2. ``` 4) Test the builds work locally for all supported platforms. @@ -62,7 +62,7 @@ bazel run //:gazelle ### Cross compile target support | target | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 | -|------------------|--------------------------------------------------------------------|--------------------------------------------|------------------------------------|------------------------------------|------------------------------------| +| ---------------- | ------------------------------------------------------------------ | ------------------------------------------ | ---------------------------------- | ---------------------------------- | ---------------------------------- | | `//beacon-chain` | :heavy_check_mark: docker-sandbox and RBE, supported locally only | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | | `//validator` | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | :heavy_check_mark: | @@ -73,7 +73,7 @@ The configurations above are enforced via pull request presubmit checks. Use these values with `--config=`, multiple times if more than one value is defined in the table. Example: `bazel build //beacon-chain --config=windows_amd64_docker` to build windows binary in a docker sandbox. | Config | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 | -|-------------------------------|----------------------------|-----------------------------|---------------------------|---------------------------|-------------------------------| +| ----------------------------- | -------------------------- | --------------------------- | ------------------------- | ------------------------- | ----------------------------- | | Local run | `linux_amd64` | `linux_arm64` | `osx_amd64` | `osx_arm64` | `windows_amd64` | | Docker sandbox | `linux_amd64_docker` | `linux_arm64_docker` | `osx_amd64_docker` | `osx_arm64_docker` | `windows_amd64_docker ` | | RBE (See [Caveats](#caveats)) | `linux_amd64` and `remote` | `linux_arm64` and `remote` | `osx_amd64` and `remote` | `osx_arm64` and `remote` | `windows_amd64` and `remote` | @@ -84,4 +84,4 @@ There are a few caveats to each of these strategies. - Local runs require clang compiler and the appropriate cross compilers installed. These runs should only be considered for a power user or user with specific build requirements. See the Dockerfile setup scripts to understand what dependencies must be installed and where. - Docker sandbox is *slow*. Like really slow! The purpose of the docker sandbox is to test RBE builds without deploying a full RBE system. Each build action is executed in its own container. Given the large number of small targets in this project, the overhead of creating docker containers makes this strategy the slowest of all, but requires zero additional setup. -- Remote Build Execution is by far the fastest, if you have a RBE backend available. This is another advanced use case which will require two config flags above as well as additional flags to specify the `--remote_executor`. Some of these flags are present in the project `.bazelrc` with example values, but commented out. +- Remote Build Execution is by far the fastest, if you have a RBE backend available. This is another advanced use case which will require two config flags above as well as additional flags to specify the `--remote_executor`. Some of these flags are present in the project `.bazelrc` with example values, but commented out. \ No newline at end of file diff --git a/tools/cross-toolchain/install_clang_cross.sh b/tools/cross-toolchain/install_clang_cross.sh index eef3a5a807..2e6238c916 100755 --- a/tools/cross-toolchain/install_clang_cross.sh +++ b/tools/cross-toolchain/install_clang_cross.sh @@ -1,23 +1,33 @@ #!/bin/sh set -eu + +# Download and install LLVM for x86_64 curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-"${INSTALL_LLVM_VERSION}"/clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz \ - -o clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz -tar xf clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz --strip-components=1 -C /usr -rm -f clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz -# arm64 + -o clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz \ + && tar xf clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz --strip-components=1 -C /usr \ + && rm -f clang+llvm-"${INSTALL_LLVM_VERSION}"-x86_64-linux-gnu-ubuntu-20.04.tar.xz + +# Download and install LLVM for aarch64 curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-"${INSTALL_LLVM_VERSION}"/clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz \ - -o clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz -tar xf clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz -rm -f clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz + -o clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz \ + && tar xf clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz \ + && rm -f clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu.tar.xz + +# Move necessary files for aarch64 to the correct locations mkdir -p /usr/aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}" mkdir -p /usr/aarch64-linux-gnu/include/c++ + mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/include/c++/v1 /usr/aarch64-linux-gnu/include/c++/ mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}"/include /usr/aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}" + mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/libc++.a /usr/aarch64-linux-gnu/lib/ mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/libc++abi.a /usr/aarch64-linux-gnu/lib/ mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/libunwind.a /usr/aarch64-linux-gnu/lib/ + mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/libclang_rt.builtins-aarch64.a /usr/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/ mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/clang_rt.crtbegin-aarch64.o /usr/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/ mv /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/clang_rt.crtend-aarch64.o /usr/lib/clang/"${INSTALL_LLVM_VERSION}"/lib/linux/ -rm -rf /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu + +# Clean up +rm -rf /clang+llvm-"${INSTALL_LLVM_VERSION}"-aarch64-linux-gnu \ No newline at end of file diff --git a/tools/enr-calculator/BUILD.bazel b/tools/enr-calculator/BUILD.bazel index 674d695148..e04d4e6b25 100644 --- a/tools/enr-calculator/BUILD.bazel +++ b/tools/enr-calculator/BUILD.bazel @@ -28,7 +28,7 @@ prysm_image_upload( name = "push_images", binary = ":enr-calculator", entrypoint = ["/enr-calculator"], - repository = "gcr.io/prysmaticlabs/prysm/enr-calculator", + repository = "overfoundation/chronos-enr-calculator", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/tools/enr-calculator/enr-calculator": "/enr-calculator", diff --git a/tools/eth1exporter/BUILD.bazel b/tools/eth1exporter/BUILD.bazel index 80bfe0989c..02530ea280 100644 --- a/tools/eth1exporter/BUILD.bazel +++ b/tools/eth1exporter/BUILD.bazel @@ -26,7 +26,7 @@ prysm_image_upload( name = "push_images", binary = ":eth1exporter", entrypoint = ["/eth1exporter"], - repository = "gcr.io/prysmaticlabs/prysm/eth1monitor", + repository = "overfoundation/chronos-eth1monitor", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/tools/eth1exporter/eth1exporter": "/eth1exporter", diff --git a/tools/http-request-sink/BUILD.bazel b/tools/http-request-sink/BUILD.bazel index 362b9b4457..155f881904 100644 --- a/tools/http-request-sink/BUILD.bazel +++ b/tools/http-request-sink/BUILD.bazel @@ -30,7 +30,7 @@ prysm_image_upload( name = "push_images", binary = ":http-request-sink", entrypoint = ["/http-request-sink"], - repository = "gcr.io/prysmaticlabs/prysm/http-request-sink", + repository = "overfoundation/chronos-http-request-sink", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/tools/http-request-sink/http-request-sink": "/http-request-sink", diff --git a/tools/pcli/BUILD.bazel b/tools/pcli/BUILD.bazel index a3386f17f9..1abcf4537c 100644 --- a/tools/pcli/BUILD.bazel +++ b/tools/pcli/BUILD.bazel @@ -38,7 +38,7 @@ prysm_image_upload( name = "push_images", binary = ":pcli", entrypoint = ["/pcli"], - repository = "gcr.io/prysmaticlabs/prysm/pcli", + repository = "overfoundation/chronos-pcli", symlinks = { # Backwards compatibility for images that depended on the old filepath. "/app/tools/pcli/pcli": "/pcli",