From 60aad86fc1399ea33a4c87493c27d070e8364723 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 14:57:34 +0300 Subject: [PATCH 001/141] [DEV-1096] Play with releases Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2638f7c89..dee0aa8f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,11 @@ name: Release on: + workflow_run: + types: + - completed + workflows: + - "Build and Test" push: tags: - "v[0-9]+.[0-9]+.[0-9]+" From 4bc6d8a018df2106c3f46d56e080c22cb97f11c0 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 15:52:40 +0300 Subject: [PATCH 002/141] [DEV-1096] Add file for pointing the end of linting Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4377cc28f..9a76f1840 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -69,3 +69,17 @@ jobs: VALIDATE_PYTHON_PYLINT: true VALIDATE_XML: true VALIDATE_YAML: true + + end-linting: + name: End for all checks + runs-on: ubuntu-20.04 + needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] + steps: + - name: Create a simple file + run: touch finished.txt + + - name: Store artifact + uses: actions/upload-artifact@v2 + with: + name: result + path: finished.txt \ No newline at end of file From ba1078fe003da7f2fc98558b60391f675704cd74 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 16:00:52 +0300 Subject: [PATCH 003/141] [DEV-1096] Move to another action Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9a76f1840..08ccd92d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -71,15 +71,8 @@ jobs: VALIDATE_YAML: true end-linting: - name: End for all checks + name: Linter finished runs-on: ubuntu-20.04 needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] steps: - - name: Create a simple file - run: touch finished.txt - - - name: Store artifact - uses: actions/upload-artifact@v2 - with: - name: result - path: finished.txt \ No newline at end of file + - name: Wait for all jobs to finish From a0b04e4005c15980087cf6705bf283c4d718aa70 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 16:02:37 +0300 Subject: [PATCH 004/141] [DEV-1096] fix linter workflow Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 08ccd92d9..e505521c3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -76,3 +76,4 @@ jobs: needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] steps: - name: Wait for all jobs to finish + run: echo "Mark workflow finished" From 8acd74c6868f73c76e5cbb820daa566fa3d23783 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 16:26:15 +0300 Subject: [PATCH 005/141] [DEV-1096] Move to regexp Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e505521c3..53ea01c74 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,10 +70,10 @@ jobs: VALIDATE_XML: true VALIDATE_YAML: true - end-linting: - name: Linter finished - runs-on: ubuntu-20.04 - needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] - steps: - - name: Wait for all jobs to finish - run: echo "Mark workflow finished" +# end-linting: +# name: Linter finished +# runs-on: ubuntu-20.04 +# needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] +# steps: +# - name: Wait for all jobs to finish +# run: echo "Mark workflow finished" From 8f471c202982a34616e1f2ac5e42bc7134e6b61e Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 17:03:49 +0300 Subject: [PATCH 006/141] [DEV-1096] Wait for tests for release Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 53ea01c74..4377cc28f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -69,11 +69,3 @@ jobs: VALIDATE_PYTHON_PYLINT: true VALIDATE_XML: true VALIDATE_YAML: true - -# end-linting: -# name: Linter finished -# runs-on: ubuntu-20.04 -# needs: [super-lint, sh-euox-pipefail-check, md-link-check, go-lint] -# steps: -# - name: Wait for all jobs to finish -# run: echo "Mark workflow finished" From 2a020a56c687542df6897b6b585a37e413b7c5bc Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 17:11:45 +0300 Subject: [PATCH 007/141] [DEV-1096] fix deps Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 505 ++++++++++++++++------------------ 1 file changed, 238 insertions(+), 267 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dee0aa8f5..8655b3692 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,288 +1,259 @@ name: Release on: - workflow_run: - types: - - completed - workflows: - - "Build and Test" +# workflow_run: +# types: +# - completed +# workflows: +# - "Build and Test" +# tags: +# - "v*" +# branches: +# - main push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" +# tags: +# - "v*" jobs: wait-for-all-previous: - name: Wait for test and lint workflows + name: Wait for all previous jobs runs-on: ubuntu-20.04 steps: - - name: Wait for all jobs finished on workflow Test and Lint + - name: Wait for all jobs finished on workflow Test uses: lewagon/wait-on-check-action@v1.0.0 with: - ref: ${{ github.sha }} - running-workflow-name: 'Wait for test and lint workflows' + ref: ${{ github.ref }} + running-workflow-name: 'Wait for all previous jobs' repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 30 - - # ToDo: Get rid of it while moving test images to volumes - # This duplicating is needed because we have to pass GID and UID params - # while building docker images for tests - build-node-images: - name: Build cheqd-node and cheqd-cli images - runs-on: ubuntu-20.04 - needs: wait-for-all-previous - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint - run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - - - name: Build cheqd-node with 'node-start' as entrypoint - run: docker build --target node -t cheqd-node -f docker/Dockerfile . - - - name: Save cheqd-cli - run: docker save -o cheqd-cli-image.tar cheqd-cli - - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-cli-image.tar - path: cheqd-cli-image.tar - - - name: Store cheqd-node artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node-image.tar - path: cheqd-node-image.tar + wait-interval: 10 pre-release: - name: Pre-release + name: Run a pre-release runs-on: ubuntu-20.04 environment: Pre-Release - needs: build-node-images - outputs: - RCVERSION: ${{ steps.set-version.outputs.RCVERSION }} - steps: - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 - with: - workflow: test.yml - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Set RC version - id: set-version - run: | - VERSION=$(./cheqd-noded version 2>&1) - echo "::set-output name=RCVERSION::$VERSION-rc" - - push-rc-images: - name: Push RC images - runs-on: ubuntu-20.04 - needs: pre-release - env: - RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} - REGISTRY: ghcr.io - steps: - - name: Get cheqd-cli image from tests - uses: actions/download-artifact@v2 - with: - name: cheqd-cli-image.tar - - - name: Get cheqd-node image from tests - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push cheqd-node image - run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest - - - name: Push cheqd-cli image - run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - - push-rc-debs: - name: Push RC packages - runs-on: ubuntu-20.04 - needs: pre-release - env: - RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 - with: - workflow: test.yml - name: cheqd-noded - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Install fpm - run: | - sudo apt-get install ruby ruby-dev rubygems build-essential - sudo gem install --no-document fpm - - - name: Build RC deb - working-directory: ./build-tools - run: | - ./build-deb.sh "../cheqd-noded" "${{ env.RCVERSION }}" - - - name: Store RC deb package artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node_${{ env.RCVERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" "${{ env.RCVERSION }}" - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" - prerelease: true - draft: true - title: "v${{ env.RCVERSION }}" - files: | - build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb - build-tools/output/cheqd-node_${{ env.RCVERSION }}.tar.gz - - release: - name: Release - runs-on: ubuntu-20.04 - environment: Release - needs: [ push-rc-debs, push-rc-images] - outputs: - VERSION: ${{ steps.set-version.outputs.VERSION }} + needs: wait-for-all-previous steps: - name: Get artifact from tests uses: dawidd6/action-download-artifact@v2 with: workflow: test.yml - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Set release version - id: set-version - run: | - VERSION=$(./cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" - - push-release-debs: - name: Push release packages - runs-on: ubuntu-20.04 - needs: release - env: - VERSION: ${{ needs.release.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 - with: - workflow: test.yml - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Install fpm - run: | - sudo apt-get install ruby ruby-dev rubygems build-essential - sudo gem install --no-document fpm - - - name: Build release deb - working-directory: ./build-tools - run: | - ./build-deb.sh "../cheqd-noded" - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" - prerelease: true - title: "v${{ env.VERSION }}" - files: | - build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - push-release-images: - name: Push release images - runs-on: ubuntu-20.04 - needs: release - env: - VERSION: ${{ needs.release.outputs.VERSION }} - REGISTRY: ghcr.io - steps: - - name: Get cheqd-cli image from tests - uses: actions/download-artifact@v2 - with: - name: cheqd-cli-image.tar - - - name: Get cheqd-node image from tests - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push cheqd-node image - run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest - - - name: Push cheqd-cli image - run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + - name: Check artifacts + run: ls -la + + + +# build-binary: +# name: Build binary +# runs-on: ubuntu-20.04 +# outputs: +# VERSION: ${{ steps.set-version.outputs.VERSION }} +# steps: +# - name: Set up Go 1.17 +# uses: actions/setup-go@v2 +# with: +# go-version: 1.17 +# +# - name: Get Go protoc compiler plugins +# env: +# GOLANG_PROTOBUF_VERSION: 1.3.5 +# GOGO_PROTOBUF_VERSION: 1.3.2 +# GRPC_GATEWAY_VERSION: 1.14.7 +# # Taken from: tendermintdev/sdk-proto-gen:v0.2 +# run: | +# go get \ +# github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ +# github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ +# github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ +# github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ +# github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ +# github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ +# github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest +# +# - name: Install buf +# env: +# PREFIX: "/usr/local" +# VERSION: "1.0.0-rc8" +# run: | +# curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ +# sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 +# +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # Required to fetch version +# +# - name: Build +# run: | +# make proto-gen build +# +# - name: Store artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-noded +# path: build/cheqd-noded +# +# - name: Set version +# id: set-version +# run: | +# VERSION=$(build/cheqd-noded version 2>&1) +# echo "::set-output name=VERSION::$VERSION" +# +# build-tar-package: +# name: Build tar package +# runs-on: ubuntu-20.04 +# needs: build-binary +# env: +# VERSION: ${{ needs.build-binary.outputs.VERSION }} +# steps: +# - uses: actions/checkout@v2 +# +# - name: Load binary artifact +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-noded +# +# - name: Restore binary permissions +# run: sudo chmod +x cheqd-noded +# +# - name: Build tar +# working-directory: ./build-tools +# run: | +# ./build-tar.sh "../cheqd-noded" +# +# - name: Store tar package artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}.tar.gz +# path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz +# +# build-deb-package: +# name: Build Debian package +# runs-on: ubuntu-20.04 +# needs: [ build-binary ] +# env: +# VERSION: ${{ needs.build-binary.outputs.VERSION }} +# steps: +# - uses: actions/checkout@v2 +# +# - name: Load binary artifact +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-noded +# +# - name: Restore binary permissions +# run: sudo chmod +x cheqd-noded +# +# - name: Install fpm +# run: | +# sudo apt-get install ruby ruby-dev rubygems build-essential +# sudo gem install --no-document fpm +# +# - name: Build deb +# working-directory: ./build-tools +# run: | +# ./build-deb.sh "../cheqd-noded" +# +# - name: Store Debian package artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}_amd64.deb +# path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb +# +# build-node-images: +# name: Build cheqd-node and cheqd-cli images +# runs-on: ubuntu-20.04 +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # Required to fetch version +# +# - name: Build cheqd-cli with 'cheqd-noded' as entrypoint +# run: docker build --target base -t cheqd-cli -f docker/Dockerfile . +# +# - name: Build cheqd-node with 'node-start' as entrypoint +# run: docker build --target node -t cheqd-node -f docker/Dockerfile . +# +# - name: Save cheqd-cli +# run: docker save -o cheqd-cli-image.tar cheqd-cli +# +# - name: Save cheqd-node +# run: docker save -o cheqd-node-image.tar cheqd-node +# +# - name: Store cheqd-cli artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-cli-image.tar +# path: cheqd-cli-image.tar +# +# - name: Store cheqd-node artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-node-image.tar +# path: cheqd-node-image.tar + +# publish: +# name: "Publish images and release" +# # Reference to workflow-setup job is required to access its various outputs. +# needs: [ build-binary, build-node-images, build-deb-package, build-tar-package ] +# runs-on: ubuntu-latest +# env: +# VERSION: ${{ needs.build-binary.outputs.VERSION }} +# REGISTRY: ghcr.io +# steps: +# - name: Git checkout +# uses: actions/checkout@v2 +# +# - name: Download cheqd-cli image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-cli-image.tar +# +# - name: Download cheqd-node image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node-image.tar +# +# - name: Load cheqd-cli image +# run: docker load -i cheqd-cli-image.tar +# +# - name: Load cheqd-node image +# run: docker load -i cheqd-node-image.tar +# +# - name: Log in to the Container registry +# uses: docker/login-action@v1 +# with: +# registry: ${{ env.REGISTRY }} +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Push cheqd-node image +# run: | +# docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest +# docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} +# docker push ghcr.io/${{ github.repository }}:latest +# +# - name: Push cheqd-cli image +# run: | +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# +# - name: Download deb +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}_amd64.deb +# +# - name: Download tar +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}.tar.gz +# +# - uses: "marvinpinto/action-automatic-releases@latest" +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" +# prerelease: true +# files: | +# cheqd-node_${{ env.VERSION }}_amd64.deb +# cheqd-node_${{ env.VERSION }}.tar.gz From 380ecd54e99debb99d2aa44d128bb51c1ee34a36 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 17:55:58 +0300 Subject: [PATCH 008/141] [DEV-1096] Debug debian passing Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 60 ++-- .github/workflows/release.yml | 11 +- .github/workflows/test.yml | 553 +++++++++++++++++----------------- 3 files changed, 313 insertions(+), 311 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4377cc28f..b5abf21ed 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,56 +1,58 @@ name: Lint -on: workflow_call -defaults: - run: - shell: bash -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +#on: [push] +on: + push: + branches: + - master jobs: - sh-euox-pipefail-check: - name: "Lint: Check for 'set -euox pipefail' in shell scripts" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check that all shell scripts use 'set -euox pipefail' - run: bash .github/scripts/ensure_set_euox_pipefail.sh - # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 go-lint: - name: "Lint: Golang" - runs-on: ubuntu-latest + name: "Lint: lint Go" + runs-on: ubuntu-20.04 steps: - - uses: actions/setup-go@v2 - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: latest + version: v1.43.0 args: --timeout 5m0s md-link-check: - name: "Lint: Check for broken Markdown links" + name: "Lint: Check Markdown links" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 + - name: Check if Markdown links are valid uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: + with: config-file: '.github/linters/mlc_config.json' - use-quiet-mode: 'yes' - use-verbose-mode: 'yes' + folder-path: "." + + sh-euox-pipefail-check: + name: "Lint: Check for 'set -euox pipefail' in shell scripts" + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check that all shell scripts use 'set -euox pipefail' + run: bash .github/scripts/ensure_set_euox_pipefail.sh super-lint: - name: "Lint: Super Linter" + name: "Lint: Run super linter" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 with: fetch-depth: 0 # Required to fetch version - - name: Run Super Linter + + - name: Super-Linter uses: github/super-linter/slim@v4 env: IGNORE_GITIGNORED_FILES: true @@ -61,7 +63,7 @@ jobs: MULTI_STATUS: true VALIDATE_BASH: true - VALIDATE_GITHUB_ACTIONS: true + # VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8655b3692..ffef96909 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,6 @@ name: Release on: -# workflow_run: -# types: -# - completed -# workflows: -# - "Build and Test" -# tags: -# - "v*" -# branches: -# - main push: # tags: # - "v*" @@ -38,7 +29,7 @@ jobs: with: workflow: test.yml - name: Check artifacts - run: ls -la + run: ls -la cheqd-node_0.5.0.* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ecd1b4f8d..a54ac9278 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: "Build and Test" on: - workflow_call: + push: paths-ignore: - '**.md' - 'docs/**' @@ -11,27 +11,38 @@ on: env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" -jobs: - - run-unit-test: - name: Run unit tests - runs-on: ubuntu-20.04 - needs: wait-for-lint - steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - uses: actions/checkout@v2 - - - name: Run tests - run: go test -v ./... +#jobs: +# wait-for-lint: +# name: Wait for linter +# runs-on: ubuntu-20.04 +# steps: +# - name: Wait for jobs finished on lint workflow +# uses: lewagon/wait-on-check-action@v1.0.0 +# with: +# ref: ${{ github.ref }} +# check-regexp: Lint:.? +# repo-token: ${{ secrets.GITHUB_TOKEN }} +# wait-interval: 10 + +# run-unit-test: +# name: Run unit tests +# runs-on: ubuntu-20.04 +# needs: wait-for-lint +# steps: +# - name: Set up Go 1.17 +# uses: actions/setup-go@v2 +# with: +# go-version: 1.17 +# +# - uses: actions/checkout@v2 +# +# - name: Run tests +# run: go test -v ./... build-binary: name: "Build: binary" runs-on: ubuntu-20.04 - needs: wait-for-lint +# needs: wait-for-lint outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -84,33 +95,33 @@ jobs: VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - build-tar-package: - name: "Build: tar package" - runs-on: ubuntu-20.04 - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" - - - name: Store tar package artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz +# build-tar-package: +# name: "Build: tar package" +# runs-on: ubuntu-20.04 +# needs: build-binary +# env: +# VERSION: ${{ needs.build-binary.outputs.VERSION }} +# steps: +# - uses: actions/checkout@v2 +# +# - name: Load binary artifact +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-noded +# +# - name: Restore binary permissions +# run: sudo chmod +x cheqd-noded +# +# - name: Build tar +# working-directory: ./build-tools +# run: | +# ./build-tar.sh "../cheqd-noded" +# +# - name: Store tar package artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}.tar.gz +# path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz build-deb-package: name: "Build: deb package" @@ -145,230 +156,228 @@ jobs: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - build-node-images: - name: "Build: cheqd-node and cheqd-cli images" - runs-on: ubuntu-20.04 - needs: wait-for-lint - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint - # TODO: Get rid of UID and GID - run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - - name: Build cheqd-node with 'node-start' as entrypoint - run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - - name: Save cheqd-cli - run: docker save -o cheqd-cli-image.tar cheqd-cli - - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-cli-image.tar - path: cheqd-cli-image.tar - - - name: Store cheqd-node artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node-image.tar - path: cheqd-node-image.tar - - test-new-node-setup-from-deb: - name: "Test: New node setup from deb" - runs-on: ubuntu-20.04 - needs: [build-binary, build-deb-package, build-node-images] - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - name: Download deb - uses: actions/download-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Install deb - run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Add observer node - working-directory: ./tests/e2e-complex/deb-install - run: | - ./add-observer.sh - cheqd-noded status -n tcp://localhost:26677 2>&1 - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - - - name: Promote observer to validator - working-directory: ./tests/e2e-complex/deb-install - run: | - ./promote-validator.sh - cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - - - name: Gather logs on failure - if: ${{ failure() }} - run: | - journalctl -ex | grep cheqd - - run-python-based-integration-tests: - name: "Test: Run python based cosmos and identity tests" - runs-on: ubuntu-20.04 - needs: [build-node-images, build-binary] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Set up test environment - working-directory: ./tests/e2e-pytest - run: | - pip3 install -r requirements.txt >> /dev/null - cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode - cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode - sudo chmod -R 777 /home/runner - - - name: Run cosmos-related tests - working-directory: ./tests/e2e-pytest - run: | - set -euxo pipefail - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_cosmos.py - - - name: Run identity-related tests # TODO: Move into separate stage? - working-directory: ./tests/e2e-pytest - run: | - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_identity.py - - run-bash-based-integration-tests: - name: "Test: Run bash based identity tests" - runs-on: ubuntu-20.04 - needs: [build-binary, build-node-images] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Import keys - working-directory: docker/localnet - run: | - bash import_keys.sh - - - name: Set up and run tests - working-directory: tests/e2e-bash - run: | - bash run_all.sh - - run-upgrade-test-positive-case: - name: "Test: Run positive case for upgrade" - runs-on: ubuntu-20.04 - needs: build-node-images - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # It's needed for getting the full version of package by `git describe` - - - name: Download cli image - uses: actions/download-artifact@v2 - with: - name: cheqd-cli-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Chown for current user - run: sudo chown "$USER":"$USER" . - - - name: Prepare nodes for checking upgrade - working-directory: ./tests/e2e-complex/upgrade - run: bash prepare.sh - - - name: Initiate the upgrade process - working-directory: ./tests/e2e-complex/upgrade - run: bash initiate_upgrade.sh - - - name: Make the upgrade and check results - working-directory: ./tests/e2e-complex/upgrade - run: bash upgrade_and_check.sh +# build-node-images: +# name: "Build: cheqd-node and cheqd-cli images" +# runs-on: ubuntu-20.04 +# needs: wait-for-lint +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # Required to fetch version +# +# - name: Build cheqd-cli with 'cheqd-noded' as entrypoint +# # TODO: Get rid of UID and GID +# run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . +# +# - name: Build cheqd-node with 'node-start' as entrypoint +# run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . +# +# - name: Save cheqd-cli +# run: docker save -o cheqd-cli-image.tar cheqd-cli +# +# - name: Save cheqd-node +# run: docker save -o cheqd-node-image.tar cheqd-node +# +# - name: Store cheqd-cli artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-cli-image.tar +# path: cheqd-cli-image.tar +# +# - name: Store cheqd-node artifact +# uses: actions/upload-artifact@v2 +# with: +# name: cheqd-node-image.tar +# path: cheqd-node-image.tar + +# test-new-node-setup-from-deb: +# name: "Test: New node setup from deb" +# runs-on: ubuntu-20.04 +# needs: [build-binary, build-deb-package, build-node-images] +# env: +# VERSION: ${{ needs.build-binary.outputs.VERSION }} +# steps: +# - name: Download deb +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node_${{ env.VERSION }}_amd64.deb +# +# - name: Install deb +# run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb +# +# - name: Download node image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node-image.tar +# +# - name: Load node image +# run: docker load -i cheqd-node-image.tar +# +# - name: Check out +# uses: actions/checkout@v2 +# +# - name: Set up 4 validators + 2 observers node docker pool +# working-directory: ./docker/localnet +# run: | +# bash gen-network-config.sh +# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d +# +# - name: Wait for chain +# run: bash tests/tools/wait-for-chain.sh +# +# - name: Add observer node +# working-directory: ./tests/e2e-complex/deb-install +# run: | +# ./add-observer.sh +# cheqd-noded status -n tcp://localhost:26677 2>&1 +# ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" +# +# - name: Promote observer to validator +# working-directory: ./tests/e2e-complex/deb-install +# run: | +# ./promote-validator.sh +# cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done +# ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' +# ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' +# +# - name: Gather logs on failure +# if: ${{ failure() }} +# run: | +# journalctl -ex | grep cheqd +# +# run-python-based-integration-tests: +# name: "Test: Run python based cosmos and identity tests" +# runs-on: ubuntu-20.04 +# needs: [build-node-images, build-binary] +# steps: +# - name: Load binary artifact +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-noded +# path: /home/runner/.local/bin +# +# - name: Restore binary permissions +# run: sudo chmod +x /home/runner/.local/bin/cheqd-noded +# +# - name: Download node image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node-image.tar +# +# - name: Load node image +# run: docker load -i cheqd-node-image.tar +# +# - name: Check out +# uses: actions/checkout@v2 +# +# - name: Set up 4 validators + 2 observers node docker pool +# working-directory: ./docker/localnet +# run: | +# bash gen-network-config.sh +# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d +# +# - name: Wait for chain +# run: bash tests/tools/wait-for-chain.sh +# +# - name: Set up test environment +# working-directory: ./tests/e2e-pytest +# run: | +# pip3 install -r requirements.txt >> /dev/null +# cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode +# cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode +# sudo chmod -R 777 /home/runner +# +# - name: Run cosmos-related tests +# working-directory: ./tests/e2e-pytest +# run: | +# set -euxo pipefail +# OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') +# export OP0_ADDRESS +# OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') +# export OP1_ADDRESS +# pytest -v -rP test_cosmos.py +# +# - name: Run identity-related tests # TODO: Move into separate stage? +# working-directory: ./tests/e2e-pytest +# run: | +# OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') +# export OP0_ADDRESS +# OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') +# export OP1_ADDRESS +# pytest -v -rP test_identity.py +# +# run-bash-based-integration-tests: +# name: "Test: Run bash based identity tests" +# runs-on: ubuntu-20.04 +# needs: [build-binary, build-node-images] +# steps: +# - name: Load binary artifact +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-noded +# path: /home/runner/.local/bin +# +# - name: Restore binary permissions +# run: sudo chmod +x /home/runner/.local/bin/cheqd-noded +# +# - name: Download node image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-node-image.tar +# +# - name: Load node image +# run: docker load -i cheqd-node-image.tar +# +# - name: Check out +# uses: actions/checkout@v2 +# +# - name: Set up 4 validators + 2 observers node docker pool +# working-directory: ./docker/localnet +# run: | +# bash gen-network-config.sh +# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d +# +# - name: Wait for chain +# run: bash tests/tools/wait-for-chain.sh +# +# - name: Import keys +# working-directory: docker/localnet +# run: | +# bash import_keys.sh +# +# - name: Set up and run tests +# working-directory: tests/e2e-bash +# run: | +# bash run_all.sh +# +# run-upgrade-test-positive-case: +# name: "Test: Run positive case for upgrade" +# runs-on: ubuntu-20.04 +# needs: build-node-images +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # It's needed for getting the full version of package by `git describe` +# +# - name: Download cli image +# uses: actions/download-artifact@v2 +# with: +# name: cheqd-cli-image.tar +# +# - name: Load cli image +# run: docker load -i cheqd-cli-image.tar +# +# - name: Chown for current user +# run: sudo chown "$USER":"$USER" . +# +# - name: Prepare nodes for checking upgrade +# working-directory: ./tests/e2e-complex/upgrade +# run: bash prepare.sh +# +# - name: Initiate the upgrade process +# working-directory: ./tests/e2e-complex/upgrade +# run: bash initiate_upgrade.sh +# +# - name: Make the upgrade and check results +# working-directory: ./tests/e2e-complex/upgrade +# run: bash upgrade_and_check.sh From 1e6a2abb1735db3b144bb92bbbfe731ccceb8d9a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 17:59:54 +0300 Subject: [PATCH 009/141] [DEV-1096] Fix jobs in tests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a54ac9278..5805f8105 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ on: env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" -#jobs: +jobs: # wait-for-lint: # name: Wait for linter # runs-on: ubuntu-20.04 From 023ab73074386832b66391cb334bf696b4ca4924 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 19:22:39 +0300 Subject: [PATCH 010/141] [DEV-1096] Make release jobs Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 198 +++++++++++++++++++++++++++++++++- .github/workflows/test.yml | 66 ++++++------ build-tools/build-deb.sh | 2 + 3 files changed, 230 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffef96909..fd8173658 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,19 +19,211 @@ jobs: wait-interval: 10 pre-release: - name: Run a pre-release + name: Create pre-release runs-on: ubuntu-20.04 environment: Pre-Release needs: wait-for-all-previous + outputs: + RCVERSION: ${{ steps.set-version.outputs.RCVERSION }} steps: - name: Get artifact from tests uses: dawidd6/action-download-artifact@v2 with: workflow: test.yml - - name: Check artifacts - run: ls -la cheqd-node_0.5.0.* + name: cheqd-noded + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + - name: Set RC version + id: set-version + run: | + VERSION=$(build/cheqd-noded version 2>&1) + echo "::set-output name=RCVERSION::$VERSION-rc" + + + + push-rc-images: + name: Tag release candidate images + runs-on: ubuntu-20.04 + needs: pre-release + env: + RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} + steps: + - name: Get cheqd-cli image from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-cli-image.tar + + - name: Get cheqd-node image from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-node-image.tar + + - name: Load cli image + run: docker load -i cheqd-cli-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push cheqd-node image + run: | + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest +# docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} +# docker push ghcr.io/${{ github.repository }}:latest + + - name: Push cheqd-cli image + run: | + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + + + + build-rc-debs: + name: Create release candidate debian packages + runs-on: ubuntu-20.04 + needs: pre-release + env: + RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }}} + steps: + - name: Get artifact from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-noded + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Install fpm + run: | + sudo apt-get install ruby ruby-dev rubygems build-essential + sudo gem install --no-document fpm + + - name: Build RC deb + working-directory: ./build-tools + run: | + ./build-deb.sh "../cheqd-noded" "${{ env.RCVERSION }}" + + - name: Store RC deb package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.RCVERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb + + + release: + name: Create Release + runs-on: ubuntu-20.04 + environment: Release + needs: [ build-rc-debs, push-rc-images] + outputs: + VERSION: ${{ steps.set-version.outputs.VERSION }} + steps: + - name: Get artifact from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Set release version + id: set-version + run: | + VERSION=$(build/cheqd-noded version 2>&1) + echo "::set-output name=VERSION::$VERSION-rc" + + + build-release-debs: + name: Create release debian packages + runs-on: ubuntu-20.04 + needs: release + outputs: + VERSION: ${{ steps.release.outputs.VERSION }} + steps: + - name: Get artifact from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Install fpm + run: | + sudo apt-get install ruby ruby-dev rubygems build-essential + sudo gem install --no-document fpm + + - name: Build release deb + working-directory: ./build-tools + run: | + ./build-deb.sh "../cheqd-noded" + + - name: Store release deb package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb + + push-release-images: + name: Tag release candidate images + runs-on: ubuntu-20.04 + needs: release + env: + VERSION: ${{ needs.release.outputs.VERSION }} + steps: + - name: Get cheqd-cli image from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-cli-image.tar + + - name: Get cheqd-node image from tests + uses: dawidd6/action-download-artifact@v2 + with: + workflow: test.yml + name: cheqd-node-image.tar + + - name: Load cli image + run: docker load -i cheqd-cli-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push cheqd-node image + run: | + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + # docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} + # docker push ghcr.io/${{ github.repository }}:latest + + - name: Push cheqd-cli image + run: | + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest # build-binary: # name: Build binary diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5805f8105..b1ea19bbe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -156,39 +156,39 @@ jobs: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb -# build-node-images: -# name: "Build: cheqd-node and cheqd-cli images" -# runs-on: ubuntu-20.04 -# needs: wait-for-lint -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # Required to fetch version -# -# - name: Build cheqd-cli with 'cheqd-noded' as entrypoint -# # TODO: Get rid of UID and GID -# run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . -# -# - name: Build cheqd-node with 'node-start' as entrypoint -# run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . -# -# - name: Save cheqd-cli -# run: docker save -o cheqd-cli-image.tar cheqd-cli -# -# - name: Save cheqd-node -# run: docker save -o cheqd-node-image.tar cheqd-node -# -# - name: Store cheqd-cli artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-cli-image.tar -# path: cheqd-cli-image.tar -# -# - name: Store cheqd-node artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-node-image.tar -# path: cheqd-node-image.tar + build-node-images: + name: "Build: cheqd-node and cheqd-cli images" + runs-on: ubuntu-20.04 + needs: wait-for-lint + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to fetch version + + - name: Build cheqd-cli with 'cheqd-noded' as entrypoint + # TODO: Get rid of UID and GID + run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . + + - name: Build cheqd-node with 'node-start' as entrypoint + run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . + + - name: Save cheqd-cli + run: docker save -o cheqd-cli-image.tar cheqd-cli + + - name: Save cheqd-node + run: docker save -o cheqd-node-image.tar cheqd-node + + - name: Store cheqd-cli artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-cli-image.tar + path: cheqd-cli-image.tar + + - name: Store cheqd-node artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node-image.tar + path: cheqd-node-image.tar # test-new-node-setup-from-deb: # name: "Test: New node setup from deb" diff --git a/build-tools/build-deb.sh b/build-tools/build-deb.sh index 4cc055599..0070fb00e 100755 --- a/build-tools/build-deb.sh +++ b/build-tools/build-deb.sh @@ -17,6 +17,8 @@ fi PKG_NAME="cheqd-node" +echo $VERSION +exit 1 BUILD_DIR="build" OUTPUT_DIR="output" From fdb9998f6b180a2f1bb418a31a768c89f7038d20 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 22:29:42 +0300 Subject: [PATCH 011/141] [DEV-1096] Get rid of debug Signed-off-by: Andrew Nikitin --- build-tools/build-deb.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build-tools/build-deb.sh b/build-tools/build-deb.sh index 0070fb00e..4cc055599 100755 --- a/build-tools/build-deb.sh +++ b/build-tools/build-deb.sh @@ -17,8 +17,6 @@ fi PKG_NAME="cheqd-node" -echo $VERSION -exit 1 BUILD_DIR="build" OUTPUT_DIR="output" From 68e6aa1a77cba5ef4372a9bc24c6481429e17ba4 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 22:24:44 +0300 Subject: [PATCH 012/141] [DEV-1096] No needs --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1ea19bbe..7d244a76c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -159,7 +159,7 @@ jobs: build-node-images: name: "Build: cheqd-node and cheqd-cli images" runs-on: ubuntu-20.04 - needs: wait-for-lint + # needs: wait-for-lint steps: - uses: actions/checkout@v2 with: From 3bfdb89dfd8c896e56f473ec4369029cf9faf599 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 22:39:47 +0300 Subject: [PATCH 013/141] [DEV-1096] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd8173658..421da6820 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: - name: Set RC version id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) + VERSION=$(cheqd-noded version 2>&1) echo "::set-output name=RCVERSION::$VERSION-rc" @@ -143,7 +143,7 @@ jobs: - name: Set release version id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) + VERSION=$(cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION-rc" From f7b623925b552f89148d3c569d537f2b5143a8aa Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 22:45:59 +0300 Subject: [PATCH 014/141] [DEV-1096] Debug Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 421da6820..8144c4f9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,11 @@ jobs: - name: Restore binary permissions run: sudo chmod +x cheqd-noded + - name: Debug + run: | + ls -la cheqd-noded + ./cheqd-noded version + - name: Set RC version id: set-version run: | From 2e157215c5c823bac5fe1cb1085d4f52e27c34e8 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 22:51:54 +0300 Subject: [PATCH 015/141] [DEV-1096] Fix VERSION setting Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8144c4f9e..938c4e3ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,15 +35,10 @@ jobs: - name: Restore binary permissions run: sudo chmod +x cheqd-noded - - name: Debug - run: | - ls -la cheqd-noded - ./cheqd-noded version - - name: Set RC version id: set-version run: | - VERSION=$(cheqd-noded version 2>&1) + VERSION=$(./cheqd-noded version 2>&1) echo "::set-output name=RCVERSION::$VERSION-rc" @@ -148,7 +143,7 @@ jobs: - name: Set release version id: set-version run: | - VERSION=$(cheqd-noded version 2>&1) + VERSION=$(./cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION-rc" From 73ecdf2581086871e51b5b879e75b6392fa3c7d9 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 23:02:04 +0300 Subject: [PATCH 016/141] [DEV-1096] Add checkout Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 938c4e3ad..c0b29415b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,6 +49,7 @@ jobs: needs: pre-release env: RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} + REGISTRY: ghcr.io steps: - name: Get cheqd-cli image from tests uses: dawidd6/action-download-artifact@v2 @@ -98,6 +99,8 @@ jobs: env: RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }}} steps: + - uses: actions/checkout@v2 + - name: Get artifact from tests uses: dawidd6/action-download-artifact@v2 with: @@ -154,6 +157,8 @@ jobs: outputs: VERSION: ${{ steps.release.outputs.VERSION }} steps: + - uses: actions/checkout@v2 + - name: Get artifact from tests uses: dawidd6/action-download-artifact@v2 with: @@ -185,6 +190,7 @@ jobs: needs: release env: VERSION: ${{ needs.release.outputs.VERSION }} + REGISTRY: ghcr.io steps: - name: Get cheqd-cli image from tests uses: dawidd6/action-download-artifact@v2 From df47a0608a3bdb6bebdfe85a7373623b018131ef Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Thu, 24 Mar 2022 23:19:12 +0300 Subject: [PATCH 017/141] [DEV-1096] Fix RCVERSION Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0b29415b..ad67d403b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-20.04 needs: pre-release env: - RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }}} + RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} steps: - uses: actions/checkout@v2 From 3374f47eec4ff2041e515f625f88109214882f8c Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 09:46:28 +0300 Subject: [PATCH 018/141] [DEV-1096] Add all the steps Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 10 +- .github/workflows/release.yml | 57 ++-- .github/workflows/test.yml | 492 +++++++++++++++++----------------- 3 files changed, 293 insertions(+), 266 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b5abf21ed..c2156a4ed 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,9 @@ name: Lint -#on: [push] -on: - push: - branches: - - master +on: [push] +#on: +# push: +# branches: +# - master jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad67d403b..2a429d9d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: wait-interval: 10 pre-release: - name: Create pre-release + name: Pre-release runs-on: ubuntu-20.04 environment: Pre-Release needs: wait-for-all-previous @@ -43,8 +43,9 @@ jobs: + push-rc-images: - name: Tag release candidate images + name: Push RC images runs-on: ubuntu-20.04 needs: pre-release env: @@ -90,10 +91,8 @@ jobs: # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - - build-rc-debs: - name: Create release candidate debian packages + name: Push RC packages runs-on: ubuntu-20.04 needs: pre-release env: @@ -125,9 +124,26 @@ jobs: name: cheqd-node_${{ env.RCVERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb + - name: Build tar + working-directory: ./build-tools + run: | + ./build-tar.sh "../cheqd-noded" "${{ env.RCVERSION }}" + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" + prerelease: true + title: "${{ env.RCVERSION }}" + files: | + build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb + build-tools/output/cheqd-node_${{ env.RCVERSION }}.tar.gz + + + release: - name: Create Release + name: Release runs-on: ubuntu-20.04 environment: Release needs: [ build-rc-debs, push-rc-images] @@ -147,15 +163,16 @@ jobs: id: set-version run: | VERSION=$(./cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION-rc" + echo "::set-output name=VERSION::$VERSION" + build-release-debs: - name: Create release debian packages + name: Push release packages runs-on: ubuntu-20.04 needs: release - outputs: - VERSION: ${{ steps.release.outputs.VERSION }} + env: + VERSION: ${{ needs.release.outputs.VERSION }} steps: - uses: actions/checkout@v2 @@ -178,14 +195,24 @@ jobs: run: | ./build-deb.sh "../cheqd-noded" - - name: Store release deb package artifact - uses: actions/upload-artifact@v2 + - name: Build tar + working-directory: ./build-tools + run: | + ./build-tar.sh "../cheqd-noded" "${{ env.VERSION }}" + + - uses: "marvinpinto/action-automatic-releases@latest" with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" + prerelease: true + title: "${{ env.VERSION }}" + files: | + build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb + build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + push-release-images: - name: Tag release candidate images + name: Push release images runs-on: ubuntu-20.04 needs: release env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d244a76c..739dcd42c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,37 +12,37 @@ env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" jobs: -# wait-for-lint: -# name: Wait for linter -# runs-on: ubuntu-20.04 -# steps: -# - name: Wait for jobs finished on lint workflow -# uses: lewagon/wait-on-check-action@v1.0.0 -# with: -# ref: ${{ github.ref }} -# check-regexp: Lint:.? -# repo-token: ${{ secrets.GITHUB_TOKEN }} -# wait-interval: 10 - -# run-unit-test: -# name: Run unit tests -# runs-on: ubuntu-20.04 -# needs: wait-for-lint -# steps: -# - name: Set up Go 1.17 -# uses: actions/setup-go@v2 -# with: -# go-version: 1.17 -# -# - uses: actions/checkout@v2 -# -# - name: Run tests -# run: go test -v ./... + wait-for-lint: + name: Wait for linter + runs-on: ubuntu-20.04 + steps: + - name: Wait for jobs finished on lint workflow + uses: lewagon/wait-on-check-action@v1.0.0 + with: + ref: ${{ github.ref }} + check-regexp: Lint:.? + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + run-unit-test: + name: Run unit tests + runs-on: ubuntu-20.04 + needs: wait-for-lint + steps: + - name: Set up Go 1.17 + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - uses: actions/checkout@v2 + + - name: Run tests + run: go test -v ./... build-binary: name: "Build: binary" runs-on: ubuntu-20.04 -# needs: wait-for-lint + needs: wait-for-lint outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -95,33 +95,33 @@ jobs: VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" -# build-tar-package: -# name: "Build: tar package" -# runs-on: ubuntu-20.04 -# needs: build-binary -# env: -# VERSION: ${{ needs.build-binary.outputs.VERSION }} -# steps: -# - uses: actions/checkout@v2 -# -# - name: Load binary artifact -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-noded -# -# - name: Restore binary permissions -# run: sudo chmod +x cheqd-noded -# -# - name: Build tar -# working-directory: ./build-tools -# run: | -# ./build-tar.sh "../cheqd-noded" -# -# - name: Store tar package artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}.tar.gz -# path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + build-tar-package: + name: "Build: tar package" + runs-on: ubuntu-20.04 + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - uses: actions/checkout@v2 + + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Build tar + working-directory: ./build-tools + run: | + ./build-tar.sh "../cheqd-noded" + + - name: Store tar package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz build-deb-package: name: "Build: deb package" @@ -159,7 +159,7 @@ jobs: build-node-images: name: "Build: cheqd-node and cheqd-cli images" runs-on: ubuntu-20.04 - # needs: wait-for-lint + needs: wait-for-lint steps: - uses: actions/checkout@v2 with: @@ -190,194 +190,194 @@ jobs: name: cheqd-node-image.tar path: cheqd-node-image.tar -# test-new-node-setup-from-deb: -# name: "Test: New node setup from deb" -# runs-on: ubuntu-20.04 -# needs: [build-binary, build-deb-package, build-node-images] -# env: -# VERSION: ${{ needs.build-binary.outputs.VERSION }} -# steps: -# - name: Download deb -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}_amd64.deb -# -# - name: Install deb -# run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb -# -# - name: Download node image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node-image.tar -# -# - name: Load node image -# run: docker load -i cheqd-node-image.tar -# -# - name: Check out -# uses: actions/checkout@v2 -# -# - name: Set up 4 validators + 2 observers node docker pool -# working-directory: ./docker/localnet -# run: | -# bash gen-network-config.sh -# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d -# -# - name: Wait for chain -# run: bash tests/tools/wait-for-chain.sh -# -# - name: Add observer node -# working-directory: ./tests/e2e-complex/deb-install -# run: | -# ./add-observer.sh -# cheqd-noded status -n tcp://localhost:26677 2>&1 -# ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" -# -# - name: Promote observer to validator -# working-directory: ./tests/e2e-complex/deb-install -# run: | -# ./promote-validator.sh -# cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done -# ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' -# ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' -# -# - name: Gather logs on failure -# if: ${{ failure() }} -# run: | -# journalctl -ex | grep cheqd -# -# run-python-based-integration-tests: -# name: "Test: Run python based cosmos and identity tests" -# runs-on: ubuntu-20.04 -# needs: [build-node-images, build-binary] -# steps: -# - name: Load binary artifact -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-noded -# path: /home/runner/.local/bin -# -# - name: Restore binary permissions -# run: sudo chmod +x /home/runner/.local/bin/cheqd-noded -# -# - name: Download node image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node-image.tar -# -# - name: Load node image -# run: docker load -i cheqd-node-image.tar -# -# - name: Check out -# uses: actions/checkout@v2 -# -# - name: Set up 4 validators + 2 observers node docker pool -# working-directory: ./docker/localnet -# run: | -# bash gen-network-config.sh -# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d -# -# - name: Wait for chain -# run: bash tests/tools/wait-for-chain.sh -# -# - name: Set up test environment -# working-directory: ./tests/e2e-pytest -# run: | -# pip3 install -r requirements.txt >> /dev/null -# cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode -# cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode -# sudo chmod -R 777 /home/runner -# -# - name: Run cosmos-related tests -# working-directory: ./tests/e2e-pytest -# run: | -# set -euxo pipefail -# OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') -# export OP0_ADDRESS -# OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') -# export OP1_ADDRESS -# pytest -v -rP test_cosmos.py -# -# - name: Run identity-related tests # TODO: Move into separate stage? -# working-directory: ./tests/e2e-pytest -# run: | -# OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') -# export OP0_ADDRESS -# OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') -# export OP1_ADDRESS -# pytest -v -rP test_identity.py -# -# run-bash-based-integration-tests: -# name: "Test: Run bash based identity tests" -# runs-on: ubuntu-20.04 -# needs: [build-binary, build-node-images] -# steps: -# - name: Load binary artifact -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-noded -# path: /home/runner/.local/bin -# -# - name: Restore binary permissions -# run: sudo chmod +x /home/runner/.local/bin/cheqd-noded -# -# - name: Download node image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node-image.tar -# -# - name: Load node image -# run: docker load -i cheqd-node-image.tar -# -# - name: Check out -# uses: actions/checkout@v2 -# -# - name: Set up 4 validators + 2 observers node docker pool -# working-directory: ./docker/localnet -# run: | -# bash gen-network-config.sh -# CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d -# -# - name: Wait for chain -# run: bash tests/tools/wait-for-chain.sh -# -# - name: Import keys -# working-directory: docker/localnet -# run: | -# bash import_keys.sh -# -# - name: Set up and run tests -# working-directory: tests/e2e-bash -# run: | -# bash run_all.sh -# -# run-upgrade-test-positive-case: -# name: "Test: Run positive case for upgrade" -# runs-on: ubuntu-20.04 -# needs: build-node-images -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # It's needed for getting the full version of package by `git describe` -# -# - name: Download cli image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-cli-image.tar -# -# - name: Load cli image -# run: docker load -i cheqd-cli-image.tar -# -# - name: Chown for current user -# run: sudo chown "$USER":"$USER" . -# -# - name: Prepare nodes for checking upgrade -# working-directory: ./tests/e2e-complex/upgrade -# run: bash prepare.sh -# -# - name: Initiate the upgrade process -# working-directory: ./tests/e2e-complex/upgrade -# run: bash initiate_upgrade.sh -# -# - name: Make the upgrade and check results -# working-directory: ./tests/e2e-complex/upgrade -# run: bash upgrade_and_check.sh + test-new-node-setup-from-deb: + name: "Test: New node setup from deb" + runs-on: ubuntu-20.04 + needs: [build-binary, build-deb-package, build-node-images] + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - name: Download deb + uses: actions/download-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Install deb + run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Add observer node + working-directory: ./tests/e2e-complex/deb-install + run: | + ./add-observer.sh + cheqd-noded status -n tcp://localhost:26677 2>&1 + ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + + - name: Promote observer to validator + working-directory: ./tests/e2e-complex/deb-install + run: | + ./promote-validator.sh + cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + + - name: Gather logs on failure + if: ${{ failure() }} + run: | + journalctl -ex | grep cheqd + + run-python-based-integration-tests: + name: "Test: Run python based cosmos and identity tests" + runs-on: ubuntu-20.04 + needs: [build-node-images, build-binary] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Set up test environment + working-directory: ./tests/e2e-pytest + run: | + pip3 install -r requirements.txt >> /dev/null + cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode + cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode + sudo chmod -R 777 /home/runner + + - name: Run cosmos-related tests + working-directory: ./tests/e2e-pytest + run: | + set -euxo pipefail + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_cosmos.py + + - name: Run identity-related tests # TODO: Move into separate stage? + working-directory: ./tests/e2e-pytest + run: | + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_identity.py + + run-bash-based-integration-tests: + name: "Test: Run bash based identity tests" + runs-on: ubuntu-20.04 + needs: [build-binary, build-node-images] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Import keys + working-directory: docker/localnet + run: | + bash import_keys.sh + + - name: Set up and run tests + working-directory: tests/e2e-bash + run: | + bash run_all.sh + + run-upgrade-test-positive-case: + name: "Test: Run positive case for upgrade" + runs-on: ubuntu-20.04 + needs: build-node-images + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # It's needed for getting the full version of package by `git describe` + + - name: Download cli image + uses: actions/download-artifact@v2 + with: + name: cheqd-cli-image.tar + + - name: Load cli image + run: docker load -i cheqd-cli-image.tar + + - name: Chown for current user + run: sudo chown "$USER":"$USER" . + + - name: Prepare nodes for checking upgrade + working-directory: ./tests/e2e-complex/upgrade + run: bash prepare.sh + + - name: Initiate the upgrade process + working-directory: ./tests/e2e-complex/upgrade + run: bash initiate_upgrade.sh + + - name: Make the upgrade and check results + working-directory: ./tests/e2e-complex/upgrade + run: bash upgrade_and_check.sh From 62028590c97aa87c9e69286a472b14506089512a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 10:52:04 +0300 Subject: [PATCH 019/141] [DEV-1096] Small fixes Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a429d9d9..aae818eb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,9 +41,6 @@ jobs: VERSION=$(./cheqd-noded version 2>&1) echo "::set-output name=RCVERSION::$VERSION-rc" - - - push-rc-images: name: Push RC images runs-on: ubuntu-20.04 @@ -139,9 +136,6 @@ jobs: build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb build-tools/output/cheqd-node_${{ env.RCVERSION }}.tar.gz - - - release: name: Release runs-on: ubuntu-20.04 @@ -165,8 +159,6 @@ jobs: VERSION=$(./cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - - build-release-debs: name: Push release packages runs-on: ubuntu-20.04 @@ -198,7 +190,7 @@ jobs: - name: Build tar working-directory: ./build-tools run: | - ./build-tar.sh "../cheqd-noded" "${{ env.VERSION }}" + ./build-tar.sh "../cheqd-noded" - uses: "marvinpinto/action-automatic-releases@latest" with: @@ -210,7 +202,6 @@ jobs: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - push-release-images: name: Push release images runs-on: ubuntu-20.04 From d46dce6d6a99a76cb1c55133adbf55bac2a3cc9a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 12:43:29 +0300 Subject: [PATCH 020/141] [DEV-1096] Test real release Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 240 ++-------------------------------- 1 file changed, 12 insertions(+), 228 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aae818eb3..04ff45045 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,15 +2,15 @@ name: Release on: push: -# tags: -# - "v*" + tags: + - "v*" jobs: wait-for-all-previous: - name: Wait for all previous jobs + name: Wait for test and lint workflows runs-on: ubuntu-20.04 steps: - - name: Wait for all jobs finished on workflow Test + - name: Wait for all jobs finished on workflow Test and Lint uses: lewagon/wait-on-check-action@v1.0.0 with: ref: ${{ github.ref }} @@ -77,15 +77,15 @@ jobs: - name: Push cheqd-node image run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} # docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest build-rc-debs: @@ -238,229 +238,13 @@ jobs: - name: Push cheqd-node image run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - # docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} - # docker push ghcr.io/${{ github.repository }}:latest +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} +# docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - -# build-binary: -# name: Build binary -# runs-on: ubuntu-20.04 -# outputs: -# VERSION: ${{ steps.set-version.outputs.VERSION }} -# steps: -# - name: Set up Go 1.17 -# uses: actions/setup-go@v2 -# with: -# go-version: 1.17 -# -# - name: Get Go protoc compiler plugins -# env: -# GOLANG_PROTOBUF_VERSION: 1.3.5 -# GOGO_PROTOBUF_VERSION: 1.3.2 -# GRPC_GATEWAY_VERSION: 1.14.7 -# # Taken from: tendermintdev/sdk-proto-gen:v0.2 -# run: | -# go get \ -# github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ -# github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ -# github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ -# github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ -# github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ -# github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ -# github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest -# -# - name: Install buf -# env: -# PREFIX: "/usr/local" -# VERSION: "1.0.0-rc8" -# run: | -# curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ -# sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 -# -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # Required to fetch version -# -# - name: Build -# run: | -# make proto-gen build -# -# - name: Store artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-noded -# path: build/cheqd-noded -# -# - name: Set version -# id: set-version -# run: | -# VERSION=$(build/cheqd-noded version 2>&1) -# echo "::set-output name=VERSION::$VERSION" -# -# build-tar-package: -# name: Build tar package -# runs-on: ubuntu-20.04 -# needs: build-binary -# env: -# VERSION: ${{ needs.build-binary.outputs.VERSION }} -# steps: -# - uses: actions/checkout@v2 -# -# - name: Load binary artifact -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-noded -# -# - name: Restore binary permissions -# run: sudo chmod +x cheqd-noded -# -# - name: Build tar -# working-directory: ./build-tools -# run: | -# ./build-tar.sh "../cheqd-noded" -# -# - name: Store tar package artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}.tar.gz -# path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz -# -# build-deb-package: -# name: Build Debian package -# runs-on: ubuntu-20.04 -# needs: [ build-binary ] -# env: -# VERSION: ${{ needs.build-binary.outputs.VERSION }} -# steps: -# - uses: actions/checkout@v2 -# -# - name: Load binary artifact -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-noded -# -# - name: Restore binary permissions -# run: sudo chmod +x cheqd-noded -# -# - name: Install fpm -# run: | -# sudo apt-get install ruby ruby-dev rubygems build-essential -# sudo gem install --no-document fpm -# -# - name: Build deb -# working-directory: ./build-tools -# run: | -# ./build-deb.sh "../cheqd-noded" -# -# - name: Store Debian package artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}_amd64.deb -# path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb -# -# build-node-images: -# name: Build cheqd-node and cheqd-cli images -# runs-on: ubuntu-20.04 -# steps: -# - uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # Required to fetch version -# -# - name: Build cheqd-cli with 'cheqd-noded' as entrypoint -# run: docker build --target base -t cheqd-cli -f docker/Dockerfile . -# -# - name: Build cheqd-node with 'node-start' as entrypoint -# run: docker build --target node -t cheqd-node -f docker/Dockerfile . -# -# - name: Save cheqd-cli -# run: docker save -o cheqd-cli-image.tar cheqd-cli -# -# - name: Save cheqd-node -# run: docker save -o cheqd-node-image.tar cheqd-node -# -# - name: Store cheqd-cli artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-cli-image.tar -# path: cheqd-cli-image.tar -# -# - name: Store cheqd-node artifact -# uses: actions/upload-artifact@v2 -# with: -# name: cheqd-node-image.tar -# path: cheqd-node-image.tar - -# publish: -# name: "Publish images and release" -# # Reference to workflow-setup job is required to access its various outputs. -# needs: [ build-binary, build-node-images, build-deb-package, build-tar-package ] -# runs-on: ubuntu-latest -# env: -# VERSION: ${{ needs.build-binary.outputs.VERSION }} -# REGISTRY: ghcr.io -# steps: -# - name: Git checkout -# uses: actions/checkout@v2 -# -# - name: Download cheqd-cli image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-cli-image.tar -# -# - name: Download cheqd-node image -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node-image.tar -# -# - name: Load cheqd-cli image -# run: docker load -i cheqd-cli-image.tar -# -# - name: Load cheqd-node image -# run: docker load -i cheqd-node-image.tar -# -# - name: Log in to the Container registry -# uses: docker/login-action@v1 -# with: -# registry: ${{ env.REGISTRY }} -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Push cheqd-node image -# run: | -# docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} -# docker push ghcr.io/${{ github.repository }}:latest -# -# - name: Push cheqd-cli image -# run: | -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} # docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# -# - name: Download deb -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}_amd64.deb -# -# - name: Download tar -# uses: actions/download-artifact@v2 -# with: -# name: cheqd-node_${{ env.VERSION }}.tar.gz -# -# - uses: "marvinpinto/action-automatic-releases@latest" -# with: -# repo_token: "${{ secrets.GITHUB_TOKEN }}" -# automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" -# prerelease: true -# files: | -# cheqd-node_${{ env.VERSION }}_amd64.deb -# cheqd-node_${{ env.VERSION }}.tar.gz From 174cfcbfa3ed29dd288e2c65424f33955155be54 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 12:49:36 +0300 Subject: [PATCH 021/141] [DEV-1096] Debug release Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04ff45045..d5a5c9cd5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: Release on: push: - tags: - - "v*" +# tags: +# - "v*" jobs: wait-for-all-previous: @@ -77,15 +77,15 @@ jobs: - name: Push cheqd-node image run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest # docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest build-rc-debs: From 7cdcc7b56f5e5d1516ed0b97ba04abf7b8e4f5eb Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 12:51:48 +0300 Subject: [PATCH 022/141] [DEV-1096] Fix image publishing Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5a5c9cd5..8481a8038 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: Release on: push: -# tags: -# - "v*" + tags: + - "v*" jobs: wait-for-all-previous: @@ -238,13 +238,13 @@ jobs: - name: Push cheqd-node image run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest # docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest From 136b48a9838a5a9374499a64fe5b8b4b6fc317b4 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 13:35:27 +0300 Subject: [PATCH 023/141] [DEV-1096] Fix "wait" jobs Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8481a8038..5bb6f6dc5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,9 +14,9 @@ jobs: uses: lewagon/wait-on-check-action@v1.0.0 with: ref: ${{ github.ref }} - running-workflow-name: 'Wait for all previous jobs' + running-workflow-name: 'Wait for test and lint workflows' repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 10 + wait-interval: 30 pre-release: name: Pre-release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 739dcd42c..c98bdbb93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ref: ${{ github.ref }} check-regexp: Lint:.? repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 10 + wait-interval: 30 run-unit-test: name: Run unit tests From 0f3b95dfaa2837ae0094585bec9623bff4cf0b7b Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Fri, 25 Mar 2022 17:25:29 +0300 Subject: [PATCH 024/141] [DEV-1096] Small improvements Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5bb6f6dc5..a45ffe6a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: # docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest # docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - build-rc-debs: + push-rc-debs: name: Push RC packages runs-on: ubuntu-20.04 needs: pre-release @@ -131,7 +131,8 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" prerelease: true - title: "${{ env.RCVERSION }}" + draft: true + title: "v${{ env.RCVERSION }}" files: | build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb build-tools/output/cheqd-node_${{ env.RCVERSION }}.tar.gz @@ -140,7 +141,7 @@ jobs: name: Release runs-on: ubuntu-20.04 environment: Release - needs: [ build-rc-debs, push-rc-images] + needs: [ push-rc-debs, push-rc-images] outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -159,7 +160,7 @@ jobs: VERSION=$(./cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - build-release-debs: + push-release-debs: name: Push release packages runs-on: ubuntu-20.04 needs: release @@ -197,7 +198,7 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" prerelease: true - title: "${{ env.VERSION }}" + title: "v${{ env.VERSION }}" files: | build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz From ab3fd6189105acb53a24fca57c19f7a4f2850a95 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 15:20:33 +0300 Subject: [PATCH 025/141] [DEV-1096] Debug linetr Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c2156a4ed..c9ce5f8b1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -63,7 +63,7 @@ jobs: MULTI_STATUS: true VALIDATE_BASH: true - # VALIDATE_GITHUB_ACTIONS: true + VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c98bdbb93..afabadcbb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,8 @@ name: "Build and Test" on: push: + branches: + - main1234 paths-ignore: - '**.md' - 'docs/**' From 07767982c48dbb89ba47b6876f2d7c688668ca34 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 15:35:54 +0300 Subject: [PATCH 026/141] [DEV-1096] Fix shellcheck Signed-off-by: Andrew Nikitin --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index afabadcbb..91ce1cf28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,6 @@ name: "Build and Test" on: push: - branches: - - main1234 paths-ignore: - '**.md' - 'docs/**' @@ -239,8 +237,8 @@ jobs: run: | ./promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr ''s/.*signature": (.*?).*/\1/p'' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr ''s/.*(signature": null).*/\1/p'' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - name: Gather logs on failure if: ${{ failure() }} From bfc2092383c52cb5baef86b190b028b9b20c719e Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 15:57:07 +0300 Subject: [PATCH 027/141] [DEV-1096] Remove another quotes Signed-off-by: Andrew Nikitin --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91ce1cf28..b20bd163d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -237,8 +237,8 @@ jobs: run: | ./promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr ''s/.*signature": (.*?).*/\1/p'' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr ''s/.*(signature": null).*/\1/p'' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + ./wait.sh "[[ $(curl -s localhost:26657/block | sed -nr 's/.*signature\": (.*?).*/\1/p' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"" + ./wait.sh "[[ $(curl -s localhost:26657/block | sed -nr 's/.*(signature\": null).*/\1/p' | wc -l) == 0 ]] && echo "There are no null signatures in block!"" - name: Gather logs on failure if: ${{ failure() }} From 562810cfe924706594537212578ef649a337ca5a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 16:46:20 +0300 Subject: [PATCH 028/141] [DEV-1096] Fix quotes expanding Signed-off-by: Andrew Nikitin --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b20bd163d..17c2168b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -237,8 +237,10 @@ jobs: run: | ./promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - ./wait.sh "[[ $(curl -s localhost:26657/block | sed -nr 's/.*signature\": (.*?).*/\1/p' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"" - ./wait.sh "[[ $(curl -s localhost:26657/block | sed -nr 's/.*(signature\": null).*/\1/p' | wc -l) == 0 ]] && echo "There are no null signatures in block!"" + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - name: Gather logs on failure if: ${{ failure() }} From 5e63ac0e33e5fef88ee0b2df11fa08a59f0d7dc6 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 16:51:36 +0300 Subject: [PATCH 029/141] [DEV-1096] Finalize release checks Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 4 ---- .github/workflows/release.yml | 16 ++++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c9ce5f8b1..b97bdb795 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,5 @@ name: Lint on: [push] -#on: -# push: -# branches: -# - master jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a45ffe6a6..510c8ccfc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,15 +78,15 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:latest + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest push-rc-debs: name: Push RC packages @@ -240,12 +240,12 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:latest + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest From 4c0bb9a6dd1b58ab726a1aad25ba03b06565277c Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 18:35:41 +0300 Subject: [PATCH 030/141] [DEV-1096] Add images building for release pipelines too Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 66 ++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 510c8ccfc..d3ffa11e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,11 +18,47 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 30 + # ToDo: Get rid of it while moving test images to volumes + # This duplicating is needed because we have to pass GID and UID params + # while building docker images for tests + build-node-images: + name: Build cheqd-node and cheqd-cli images + runs-on: ubuntu-20.04 + needs: wait-for-all-previous + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to fetch version + + - name: Build cheqd-cli with 'cheqd-noded' as entrypoint + run: docker build --target base -t cheqd-cli -f docker/Dockerfile . + + - name: Build cheqd-node with 'node-start' as entrypoint + run: docker build --target node -t cheqd-node -f docker/Dockerfile . + + - name: Save cheqd-cli + run: docker save -o cheqd-cli-image.tar cheqd-cli + + - name: Save cheqd-node + run: docker save -o cheqd-node-image.tar cheqd-node + + - name: Store cheqd-cli artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-cli-image.tar + path: cheqd-cli-image.tar + + - name: Store cheqd-node artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node-image.tar + path: cheqd-node-image.tar + pre-release: name: Pre-release runs-on: ubuntu-20.04 environment: Pre-Release - needs: wait-for-all-previous + needs: build-node-images outputs: RCVERSION: ${{ steps.set-version.outputs.RCVERSION }} steps: @@ -50,15 +86,13 @@ jobs: REGISTRY: ghcr.io steps: - name: Get cheqd-cli image from tests - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v2 with: - workflow: test.yml name: cheqd-cli-image.tar - name: Get cheqd-node image from tests - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v2 with: - workflow: test.yml name: cheqd-node-image.tar - name: Load cli image @@ -78,15 +112,15 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest +# docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest push-rc-debs: name: Push RC packages @@ -212,15 +246,13 @@ jobs: REGISTRY: ghcr.io steps: - name: Get cheqd-cli image from tests - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v2 with: - workflow: test.yml name: cheqd-cli-image.tar - name: Get cheqd-node image from tests - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v2 with: - workflow: test.yml name: cheqd-node-image.tar - name: Load cli image @@ -240,12 +272,12 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest +# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest +# docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest +# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest From f8a127f694a4455e5154d9da21012cb1053a8b9a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Mon, 28 Mar 2022 20:10:38 +0300 Subject: [PATCH 031/141] [DEV-1096] Move to sha of commit Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3ffa11e4..bea2fe594 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Wait for all jobs finished on workflow Test and Lint uses: lewagon/wait-on-check-action@v1.0.0 with: - ref: ${{ github.ref }} + ref: ${{ github.sha }} running-workflow-name: 'Wait for test and lint workflows' repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 30 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17c2168b7..dbfcd0dad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - name: Wait for jobs finished on lint workflow uses: lewagon/wait-on-check-action@v1.0.0 with: - ref: ${{ github.ref }} + ref: ${{ github.sha }} check-regexp: Lint:.? repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 30 From 149217a42411f524183447743971a432a616844b Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Tue, 29 Mar 2022 11:48:10 +0300 Subject: [PATCH 032/141] [DEV-1096] Return back gihutb.ref for tests Signed-off-by: Andrew Nikitin --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbfcd0dad..17c2168b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - name: Wait for jobs finished on lint workflow uses: lewagon/wait-on-check-action@v1.0.0 with: - ref: ${{ github.sha }} + ref: ${{ github.ref }} check-regexp: Lint:.? repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 30 From f50da5b200fe9ec4502f442f0a417ade7327b71a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Tue, 29 Mar 2022 12:23:16 +0300 Subject: [PATCH 033/141] [DEV-1096] Comment links checking for debugging Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b97bdb795..35cfcd128 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,18 +16,18 @@ jobs: version: v1.43.0 args: --timeout 5m0s - md-link-check: - name: "Lint: Check Markdown links" - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Check if Markdown links are valid - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - config-file: '.github/linters/mlc_config.json' - folder-path: "." +# md-link-check: +# name: "Lint: Check Markdown links" +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v2 +# +# - name: Check if Markdown links are valid +# uses: gaurav-nelson/github-action-markdown-link-check@v1 +# with: +# config-file: '.github/linters/mlc_config.json' +# folder-path: "." sh-euox-pipefail-check: name: "Lint: Check for 'set -euox pipefail' in shell scripts" From bf29de6119eccba99842cb5271263f9261308327 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Tue, 29 Mar 2022 13:14:13 +0300 Subject: [PATCH 034/141] [DEV-1096] Make it ready to merge Signed-off-by: Andrew Nikitin --- .github/workflows/release.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bea2fe594..33a17905d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,15 +112,15 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:latest + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest push-rc-debs: name: Push RC packages @@ -272,12 +272,12 @@ jobs: run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} -# docker tag cheqd-node ghcr.io/${{ github.repository }}:latest -# docker push ghcr.io/${{ github.repository }}:latest + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} -# docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest -# docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest From 5de48ff92e9962fc6cbb5f0233c08cab6be0ee21 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Wed, 30 Mar 2022 18:51:44 +0300 Subject: [PATCH 035/141] [DEV-1096] Get links chaeckings back Signed-off-by: Andrew Nikitin --- .github/workflows/lint.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 35cfcd128..503a97764 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,18 +16,18 @@ jobs: version: v1.43.0 args: --timeout 5m0s -# md-link-check: -# name: "Lint: Check Markdown links" -# runs-on: ubuntu-latest -# steps: -# - name: Checkout code -# uses: actions/checkout@v2 -# -# - name: Check if Markdown links are valid -# uses: gaurav-nelson/github-action-markdown-link-check@v1 -# with: -# config-file: '.github/linters/mlc_config.json' -# folder-path: "." + md-link-check: + name: "Lint: Check Markdown links" + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check if Markdown links are valid + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: '.github/linters/mlc_config.json' + folder-path: "." sh-euox-pipefail-check: name: "Lint: Check for 'set -euox pipefail' in shell scripts" From 1a2a9f1ee657af23750b408c8be5d1cab87e05b6 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 5 Apr 2022 17:56:28 +0100 Subject: [PATCH 036/141] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33a17905d..2638f7c89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - "v*" + - "v[0-9]+.[0-9]+.[0-9]+" jobs: wait-for-all-previous: From 6bfe01a2ab421e0e4a518593e92a036da8b07eba Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Thu, 7 Apr 2022 23:32:06 +0100 Subject: [PATCH 037/141] fix: Only run one instance of linter for specific ref --- .github/workflows/lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 503a97764..2fb091a6e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,8 @@ name: Lint on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: From de38d0d619b804e6e4a85d791387af4768f6b038 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Thu, 7 Apr 2022 23:39:36 +0100 Subject: [PATCH 038/141] chore: Bump Checkout action version --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2fb091a6e..988d92ce3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: name: "Lint: lint Go" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: From 1e8d5dab84a379074dc881760bffd02ac2b31cd9 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Thu, 7 Apr 2022 23:50:45 +0100 Subject: [PATCH 039/141] fix: Remove broken timeout argument --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 988d92ce3..5ffd9f1e9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,14 +10,14 @@ jobs: # https://github.com/github/super-linter/issues/143 go-lint: name: "Lint: lint Go" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: + - uses: actions/setup-go@v2 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: version: v1.43.0 - args: --timeout 5m0s md-link-check: name: "Lint: Check Markdown links" From f2d5e451832b3704b07a8e10035f8f8d665dd1c8 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Thu, 7 Apr 2022 23:55:37 +0100 Subject: [PATCH 040/141] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5ffd9f1e9..a6fa826bd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.43.0 + version: latest md-link-check: name: "Lint: Check Markdown links" From 19616828669039012da9d2c3856af5641177e9a1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 00:16:01 +0100 Subject: [PATCH 041/141] Update lint.yml --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a6fa826bd..9251fc300 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,6 +18,7 @@ jobs: uses: golangci/golangci-lint-action@v2 with: version: latest + args: --timeout 5m0s md-link-check: name: "Lint: Check Markdown links" From b1f2c37d6e767c21ca9d0f706580048bfe3fa154 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 00:56:44 +0100 Subject: [PATCH 042/141] Made style consistent throughout Lint action --- .github/workflows/lint.yml | 44 ++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9251fc300..d973b7a8a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,15 +1,26 @@ name: Lint -on: [push] +on: push +defaults: + run: + shell: bash concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + sh-euox-pipefail-check: + name: "Lint: Check for 'set -euox pipefail' in shell scripts" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check that all shell scripts use 'set -euox pipefail' + run: bash .github/scripts/ensure_set_euox_pipefail.sh + # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 go-lint: - name: "Lint: lint Go" + name: "Lint: Golang" runs-on: ubuntu-latest steps: - uses: actions/setup-go@v2 @@ -21,38 +32,25 @@ jobs: args: --timeout 5m0s md-link-check: - name: "Lint: Check Markdown links" + name: "Lint: Check for broken Markdown links" runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - + - uses: actions/checkout@v3 - name: Check if Markdown links are valid uses: gaurav-nelson/github-action-markdown-link-check@v1 with: config-file: '.github/linters/mlc_config.json' - folder-path: "." - - sh-euox-pipefail-check: - name: "Lint: Check for 'set -euox pipefail' in shell scripts" - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Check that all shell scripts use 'set -euox pipefail' - run: bash .github/scripts/ensure_set_euox_pipefail.sh + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' super-lint: - name: "Lint: Run super linter" + name: "Lint: Super Linter" runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Required to fetch version - - - name: Super-Linter + - name: Run Super Linter uses: github/super-linter/slim@v4 env: IGNORE_GITIGNORED_FILES: true @@ -61,7 +59,7 @@ jobs: LOG_LEVEL: WARN VALIDATE_ALL_CODEBASE: true MULTI_STATUS: true - + VALIDATE_BASH: true VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true From ebf40666d5b420a6730430a159e4c0e5c56fa816 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 01:24:02 +0100 Subject: [PATCH 043/141] Create dispatcher workflow --- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d973b7a8a..cf3936f46 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,5 @@ name: Lint -on: push +on: workflow_call defaults: run: shell: bash @@ -59,7 +59,7 @@ jobs: LOG_LEVEL: WARN VALIDATE_ALL_CODEBASE: true MULTI_STATUS: true - + VALIDATE_BASH: true VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17c2168b7..ecd1b4f8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: "Build and Test" on: - push: + workflow_call: paths-ignore: - '**.md' - 'docs/**' @@ -12,17 +12,6 @@ env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" jobs: - wait-for-lint: - name: Wait for linter - runs-on: ubuntu-20.04 - steps: - - name: Wait for jobs finished on lint workflow - uses: lewagon/wait-on-check-action@v1.0.0 - with: - ref: ${{ github.ref }} - check-regexp: Lint:.? - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 30 run-unit-test: name: Run unit tests From bb1fe96d170633954908a912baf3afeb0404ee19 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 01:25:44 +0100 Subject: [PATCH 044/141] Splitting out build --- .github/workflows/build.yml | 374 ++++++++++++++++++++++++++++++++++++ 1 file changed, 374 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..ecd1b4f8d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,374 @@ +name: "Build and Test" + +on: + workflow_call: + paths-ignore: + - '**.md' + - 'docs/**' + - 'architecture/**' + - '.gitbook/**' + +env: + NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" + +jobs: + + run-unit-test: + name: Run unit tests + runs-on: ubuntu-20.04 + needs: wait-for-lint + steps: + - name: Set up Go 1.17 + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - uses: actions/checkout@v2 + + - name: Run tests + run: go test -v ./... + + build-binary: + name: "Build: binary" + runs-on: ubuntu-20.04 + needs: wait-for-lint + outputs: + VERSION: ${{ steps.set-version.outputs.VERSION }} + steps: + - name: Set up Go 1.17 + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Get go protoc compiler plugins + env: + GOLANG_PROTOBUF_VERSION: 1.3.5 + GOGO_PROTOBUF_VERSION: 1.3.2 + GRPC_GATEWAY_VERSION: 1.14.7 + # Taken from: tendermintdev/sdk-proto-gen:v0.2 + run: | + go get \ + github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ + github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest + + - name: Install buf + env: + PREFIX: "/usr/local" + VERSION: "1.0.0-rc8" + run: | + curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ + sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to fetch version + + - name: Build + run: | + make proto-gen build + + - name: Store artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-noded + path: build/cheqd-noded + + - name: Set version + id: set-version + run: | + VERSION=$(build/cheqd-noded version 2>&1) + echo "::set-output name=VERSION::$VERSION" + + build-tar-package: + name: "Build: tar package" + runs-on: ubuntu-20.04 + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - uses: actions/checkout@v2 + + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Build tar + working-directory: ./build-tools + run: | + ./build-tar.sh "../cheqd-noded" + + - name: Store tar package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + + build-deb-package: + name: "Build: deb package" + runs-on: ubuntu-20.04 + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - uses: actions/checkout@v2 + + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Install fpm + run: | + sudo apt-get install ruby ruby-dev rubygems build-essential + sudo gem install --no-document fpm + + - name: Build deb + working-directory: ./build-tools + run: | + ./build-deb.sh "../cheqd-noded" + + - name: Store deb package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb + + build-node-images: + name: "Build: cheqd-node and cheqd-cli images" + runs-on: ubuntu-20.04 + needs: wait-for-lint + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required to fetch version + + - name: Build cheqd-cli with 'cheqd-noded' as entrypoint + # TODO: Get rid of UID and GID + run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . + + - name: Build cheqd-node with 'node-start' as entrypoint + run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . + + - name: Save cheqd-cli + run: docker save -o cheqd-cli-image.tar cheqd-cli + + - name: Save cheqd-node + run: docker save -o cheqd-node-image.tar cheqd-node + + - name: Store cheqd-cli artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-cli-image.tar + path: cheqd-cli-image.tar + + - name: Store cheqd-node artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node-image.tar + path: cheqd-node-image.tar + + test-new-node-setup-from-deb: + name: "Test: New node setup from deb" + runs-on: ubuntu-20.04 + needs: [build-binary, build-deb-package, build-node-images] + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - name: Download deb + uses: actions/download-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Install deb + run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Add observer node + working-directory: ./tests/e2e-complex/deb-install + run: | + ./add-observer.sh + cheqd-noded status -n tcp://localhost:26677 2>&1 + ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + + - name: Promote observer to validator + working-directory: ./tests/e2e-complex/deb-install + run: | + ./promote-validator.sh + cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + + - name: Gather logs on failure + if: ${{ failure() }} + run: | + journalctl -ex | grep cheqd + + run-python-based-integration-tests: + name: "Test: Run python based cosmos and identity tests" + runs-on: ubuntu-20.04 + needs: [build-node-images, build-binary] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Set up test environment + working-directory: ./tests/e2e-pytest + run: | + pip3 install -r requirements.txt >> /dev/null + cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode + cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode + sudo chmod -R 777 /home/runner + + - name: Run cosmos-related tests + working-directory: ./tests/e2e-pytest + run: | + set -euxo pipefail + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_cosmos.py + + - name: Run identity-related tests # TODO: Move into separate stage? + working-directory: ./tests/e2e-pytest + run: | + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_identity.py + + run-bash-based-integration-tests: + name: "Test: Run bash based identity tests" + runs-on: ubuntu-20.04 + needs: [build-binary, build-node-images] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v2 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v2 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v2 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Import keys + working-directory: docker/localnet + run: | + bash import_keys.sh + + - name: Set up and run tests + working-directory: tests/e2e-bash + run: | + bash run_all.sh + + run-upgrade-test-positive-case: + name: "Test: Run positive case for upgrade" + runs-on: ubuntu-20.04 + needs: build-node-images + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # It's needed for getting the full version of package by `git describe` + + - name: Download cli image + uses: actions/download-artifact@v2 + with: + name: cheqd-cli-image.tar + + - name: Load cli image + run: docker load -i cheqd-cli-image.tar + + - name: Chown for current user + run: sudo chown "$USER":"$USER" . + + - name: Prepare nodes for checking upgrade + working-directory: ./tests/e2e-complex/upgrade + run: bash prepare.sh + + - name: Initiate the upgrade process + working-directory: ./tests/e2e-complex/upgrade + run: bash initiate_upgrade.sh + + - name: Make the upgrade and check results + working-directory: ./tests/e2e-complex/upgrade + run: bash upgrade_and_check.sh From de86a4ad50b5ad33c023b8cd6be7dc4d481cff0f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 01:47:03 +0100 Subject: [PATCH 045/141] Fix YAML formatting errors --- .github/workflows/lint.yml | 15 +++++++++------ .github/workflows/test.yml | 12 +++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cf3936f46..202adf3bb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,11 @@ name: Lint + on: workflow_call + defaults: run: shell: bash + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -10,12 +13,12 @@ concurrency: jobs: sh-euox-pipefail-check: - name: "Lint: Check for 'set -euox pipefail' in shell scripts" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check that all shell scripts use 'set -euox pipefail' - run: bash .github/scripts/ensure_set_euox_pipefail.sh + name: "Lint: Check for 'set -euox pipefail' in shell scripts" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check that all shell scripts use 'set -euox pipefail' + run: bash .github/scripts/ensure_set_euox_pipefail.sh # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ecd1b4f8d..3e603466f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,6 @@ -name: "Build and Test" - -on: - workflow_call: - paths-ignore: - - '**.md' - - 'docs/**' - - 'architecture/**' - - '.gitbook/**' +name: Test + +on: workflow_call env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" From 33425817956d1c8d59d8c7a356d65f4c54d6f8fd Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 01:48:37 +0100 Subject: [PATCH 046/141] Remove wait on lint --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e603466f..0c30ab86c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,6 @@ jobs: run-unit-test: name: Run unit tests runs-on: ubuntu-20.04 - needs: wait-for-lint steps: - name: Set up Go 1.17 uses: actions/setup-go@v2 @@ -25,7 +24,6 @@ jobs: build-binary: name: "Build: binary" runs-on: ubuntu-20.04 - needs: wait-for-lint outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -142,7 +140,6 @@ jobs: build-node-images: name: "Build: cheqd-node and cheqd-cli images" runs-on: ubuntu-20.04 - needs: wait-for-lint steps: - uses: actions/checkout@v2 with: From 64ffa15917fcbde9ae4fee37616c9514a26cefa0 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 01:59:54 +0100 Subject: [PATCH 047/141] Formatting fix --- .github/workflows/dispatch.yml | 2 ++ .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 129f4e713..3d23ec718 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -4,8 +4,10 @@ on: push jobs: call-lint: + name: "Dispatch Lint workflow" uses: ./.github/workflows/lint.yml call-test: + name: "Dispatch Test workflow" needs: call-lint uses: ./.github/workflows/test.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 202adf3bb..4e99ffcb2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Lint +name: "Lint" on: workflow_call diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c30ab86c..00882d28a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: "Test" on: workflow_call From aaa325a27453f8611c8c9025095b0c5fb4c544f7 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:14:01 +0100 Subject: [PATCH 048/141] Specify Go version for linting --- .github/workflows/dispatch.yml | 9 +++++++-- .github/workflows/lint.yml | 12 +++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 3d23ec718..d9ec5a1f3 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -2,12 +2,17 @@ name: "Workflow Dispatch" on: push +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: + call-lint: - name: "Dispatch Lint workflow" + name: "Lint workflow" uses: ./.github/workflows/lint.yml call-test: - name: "Dispatch Test workflow" + name: "Test workflow" needs: call-lint uses: ./.github/workflows/test.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4e99ffcb2..4f55ee370 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,12 +13,12 @@ concurrency: jobs: sh-euox-pipefail-check: - name: "Lint: Check for 'set -euox pipefail' in shell scripts" + name: "Lint: Shell script pipefail check" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Check that all shell scripts use 'set -euox pipefail' - run: bash .github/scripts/ensure_set_euox_pipefail.sh + - name: Run 'set -euox pipefail' check + run: bash ./.github/scripts/ensure_set_euox_pipefail.sh # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 @@ -27,8 +27,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/setup-go@v2 + with: + go-version: 1.17 - uses: actions/checkout@v3 - - name: golangci-lint + - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: version: latest @@ -39,7 +41,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Check if Markdown links are valid + - name: Run Markdown link check uses: gaurav-nelson/github-action-markdown-link-check@v1 with: config-file: '.github/linters/mlc_config.json' From 184b807db2e2bd95ff25e943d5ee4d0677240bb9 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:15:33 +0100 Subject: [PATCH 049/141] Update lint.yml --- .github/workflows/lint.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4f55ee370..812187789 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,10 +6,6 @@ defaults: run: shell: bash -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: sh-euox-pipefail-check: From b40792f287e96255998becd81fbdee061bc59804 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:17:47 +0100 Subject: [PATCH 050/141] Update lint.yml --- .github/workflows/lint.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 812187789..430f0b1d2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,8 +23,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/setup-go@v2 - with: - go-version: 1.17 - uses: actions/checkout@v3 - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 From 1e1559855c58f3795e9d8272a4747c8b49d3b5e0 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:19:19 +0100 Subject: [PATCH 051/141] Update lint.yml --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 430f0b1d2..95ead270f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ defaults: jobs: sh-euox-pipefail-check: - name: "Lint: Shell script pipefail check" + name: "Lint: Shell pipefail check" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,7 +31,7 @@ jobs: args: --timeout 5m0s md-link-check: - name: "Lint: Check for broken Markdown links" + name: "Lint: Broken Markdown links" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From ce026a01ebd31d4825bdf420a5b077c0b5e85a40 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:25:44 +0100 Subject: [PATCH 052/141] Make Ubuntu version consistent --- .github/workflows/test.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00882d28a..5197baf24 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,9 @@ env: jobs: - run-unit-test: + run-go-unit-tests: name: Run unit tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Set up Go 1.17 uses: actions/setup-go@v2 @@ -23,7 +23,7 @@ jobs: build-binary: name: "Build: binary" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -78,7 +78,7 @@ jobs: build-tar-package: name: "Build: tar package" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -106,7 +106,7 @@ jobs: build-deb-package: name: "Build: deb package" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -139,7 +139,7 @@ jobs: build-node-images: name: "Build: cheqd-node and cheqd-cli images" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: @@ -172,7 +172,7 @@ jobs: test-new-node-setup-from-deb: name: "Test: New node setup from deb" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-binary, build-deb-package, build-node-images] env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -229,7 +229,7 @@ jobs: run-python-based-integration-tests: name: "Test: Run python based cosmos and identity tests" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-node-images, build-binary] steps: - name: Load binary artifact @@ -290,7 +290,7 @@ jobs: run-bash-based-integration-tests: name: "Test: Run bash based identity tests" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-binary, build-node-images] steps: - name: Load binary artifact @@ -334,7 +334,7 @@ jobs: run-upgrade-test-positive-case: name: "Test: Run positive case for upgrade" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-node-images steps: - uses: actions/checkout@v2 From 97904f706a60986fe6ea1cfeac35493e8c7a1b98 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:36:51 +0100 Subject: [PATCH 053/141] Change test.yml to build.yml --- .github/workflows/build.yml | 44 ++-- .github/workflows/dispatch.yml | 6 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 365 --------------------------------- 4 files changed, 20 insertions(+), 397 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecd1b4f8d..4c0620e32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,37 +1,26 @@ name: "Build and Test" -on: - workflow_call: - paths-ignore: - - '**.md' - - 'docs/**' - - 'architecture/**' - - '.gitbook/**' +on: workflow_call env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" jobs: - run-unit-test: - name: Run unit tests - runs-on: ubuntu-20.04 - needs: wait-for-lint + run-go-unit-tests: + name: Golang unit tests + runs-on: ubuntu-latest steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: - go-version: 1.17 - - - uses: actions/checkout@v2 - - - name: Run tests + go-version: '1.17' + - name: Run Golang unit tests run: go test -v ./... build-binary: name: "Build: binary" - runs-on: ubuntu-20.04 - needs: wait-for-lint + runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: @@ -86,7 +75,7 @@ jobs: build-tar-package: name: "Build: tar package" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -114,7 +103,7 @@ jobs: build-deb-package: name: "Build: deb package" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -147,8 +136,7 @@ jobs: build-node-images: name: "Build: cheqd-node and cheqd-cli images" - runs-on: ubuntu-20.04 - needs: wait-for-lint + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: @@ -181,7 +169,7 @@ jobs: test-new-node-setup-from-deb: name: "Test: New node setup from deb" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-binary, build-deb-package, build-node-images] env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -238,7 +226,7 @@ jobs: run-python-based-integration-tests: name: "Test: Run python based cosmos and identity tests" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-node-images, build-binary] steps: - name: Load binary artifact @@ -299,7 +287,7 @@ jobs: run-bash-based-integration-tests: name: "Test: Run bash based identity tests" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [build-binary, build-node-images] steps: - name: Load binary artifact @@ -343,7 +331,7 @@ jobs: run-upgrade-test-positive-case: name: "Test: Run positive case for upgrade" - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: build-node-images steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index d9ec5a1f3..c5d87b7d4 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -12,7 +12,7 @@ jobs: name: "Lint workflow" uses: ./.github/workflows/lint.yml - call-test: - name: "Test workflow" + call-build: + name: "Build workflow" needs: call-lint - uses: ./.github/workflows/test.yml + uses: ./.github/workflows/build.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 95ead270f..0c44bda74 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: "Lint" +name: Lint on: workflow_call diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 5197baf24..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,365 +0,0 @@ -name: "Test" - -on: workflow_call - -env: - NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" - -jobs: - - run-go-unit-tests: - name: Run unit tests - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - uses: actions/checkout@v2 - - - name: Run tests - run: go test -v ./... - - build-binary: - name: "Build: binary" - runs-on: ubuntu-latest - outputs: - VERSION: ${{ steps.set-version.outputs.VERSION }} - steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Get go protoc compiler plugins - env: - GOLANG_PROTOBUF_VERSION: 1.3.5 - GOGO_PROTOBUF_VERSION: 1.3.2 - GRPC_GATEWAY_VERSION: 1.14.7 - # Taken from: tendermintdev/sdk-proto-gen:v0.2 - run: | - go get \ - github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ - github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest - - - name: Install buf - env: - PREFIX: "/usr/local" - VERSION: "1.0.0-rc8" - run: | - curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ - sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build - run: | - make proto-gen build - - - name: Store artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-noded - path: build/cheqd-noded - - - name: Set version - id: set-version - run: | - VERSION=$(build/cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" - - build-tar-package: - name: "Build: tar package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" - - - name: Store tar package artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - build-deb-package: - name: "Build: deb package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Install fpm - run: | - sudo apt-get install ruby ruby-dev rubygems build-essential - sudo gem install --no-document fpm - - - name: Build deb - working-directory: ./build-tools - run: | - ./build-deb.sh "../cheqd-noded" - - - name: Store deb package artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - - build-node-images: - name: "Build: cheqd-node and cheqd-cli images" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint - # TODO: Get rid of UID and GID - run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - - name: Build cheqd-node with 'node-start' as entrypoint - run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - - name: Save cheqd-cli - run: docker save -o cheqd-cli-image.tar cheqd-cli - - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-cli-image.tar - path: cheqd-cli-image.tar - - - name: Store cheqd-node artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-node-image.tar - path: cheqd-node-image.tar - - test-new-node-setup-from-deb: - name: "Test: New node setup from deb" - runs-on: ubuntu-latest - needs: [build-binary, build-deb-package, build-node-images] - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - name: Download deb - uses: actions/download-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Install deb - run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Add observer node - working-directory: ./tests/e2e-complex/deb-install - run: | - ./add-observer.sh - cheqd-noded status -n tcp://localhost:26677 2>&1 - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - - - name: Promote observer to validator - working-directory: ./tests/e2e-complex/deb-install - run: | - ./promote-validator.sh - cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - - - name: Gather logs on failure - if: ${{ failure() }} - run: | - journalctl -ex | grep cheqd - - run-python-based-integration-tests: - name: "Test: Run python based cosmos and identity tests" - runs-on: ubuntu-latest - needs: [build-node-images, build-binary] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Set up test environment - working-directory: ./tests/e2e-pytest - run: | - pip3 install -r requirements.txt >> /dev/null - cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode - cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode - sudo chmod -R 777 /home/runner - - - name: Run cosmos-related tests - working-directory: ./tests/e2e-pytest - run: | - set -euxo pipefail - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_cosmos.py - - - name: Run identity-related tests # TODO: Move into separate stage? - working-directory: ./tests/e2e-pytest - run: | - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_identity.py - - run-bash-based-integration-tests: - name: "Test: Run bash based identity tests" - runs-on: ubuntu-latest - needs: [build-binary, build-node-images] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v2 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Import keys - working-directory: docker/localnet - run: | - bash import_keys.sh - - - name: Set up and run tests - working-directory: tests/e2e-bash - run: | - bash run_all.sh - - run-upgrade-test-positive-case: - name: "Test: Run positive case for upgrade" - runs-on: ubuntu-latest - needs: build-node-images - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # It's needed for getting the full version of package by `git describe` - - - name: Download cli image - uses: actions/download-artifact@v2 - with: - name: cheqd-cli-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Chown for current user - run: sudo chown "$USER":"$USER" . - - - name: Prepare nodes for checking upgrade - working-directory: ./tests/e2e-complex/upgrade - run: bash prepare.sh - - - name: Initiate the upgrade process - working-directory: ./tests/e2e-complex/upgrade - run: bash initiate_upgrade.sh - - - name: Make the upgrade and check results - working-directory: ./tests/e2e-complex/upgrade - run: bash upgrade_and_check.sh From f1f2fd8181c8aa4aa5df9ddb3db3f626cb1132f5 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:43:36 +0100 Subject: [PATCH 054/141] Add a cache for Go setup --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c0620e32..39453bd3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,14 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Run Golang unit tests run: go test -v ./... From fe82fb39b0708bbe316a1f67b9d7f4446a85bb93 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:49:49 +0100 Subject: [PATCH 055/141] Add cache to linter --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39453bd3a..ac328ebf8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ env: jobs: run-go-unit-tests: - name: Golang unit tests + name: "Test: Golang unit tests" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0c44bda74..883f23830 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,8 +22,18 @@ jobs: name: "Lint: Golang" runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v2 - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: '1.17' + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: From 8b25805771a2052d71847a3cec79811cfda1f741 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 02:50:42 +0100 Subject: [PATCH 056/141] Update lint.yml --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 883f23830..88810a2a9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,8 +24,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 - with: - go-version: '1.17' + with: + go-version: '1.17' - uses: actions/cache@v3 with: path: | From 2edf22c2f9827c5596114f350712fb1047f43a63 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 03:00:05 +0100 Subject: [PATCH 057/141] Test removing go setup from build --- .github/workflows/build.yml | 10 +++------- .github/workflows/lint.yml | 10 ---------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac328ebf8..6c3e1f5d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,17 +27,13 @@ jobs: run: go test -v ./... build-binary: - name: "Build: binary" + name: "Build: Node binary" + needs: run-go-unit-tests runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Get go protoc compiler plugins + - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 GOGO_PROTOBUF_VERSION: 1.3.2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88810a2a9..41b204ce2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,16 +24,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 - with: - go-version: '1.17' - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: From 5df966121d006e1bd13cf576d17d6febe27a3122 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 03:04:06 +0100 Subject: [PATCH 058/141] Update build.yml --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c3e1f5d8..4e280f6d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,14 @@ jobs: outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 From f6595b3e545c1cd03ff63f97b927a776e50880bf Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 03:12:07 +0100 Subject: [PATCH 059/141] Restore Go setup --- .github/workflows/build.yml | 25 +++++++++++++++---------- .github/workflows/lint.yml | 31 ++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e280f6d2..59b35fc5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,14 +33,10 @@ jobs: outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: - - uses: actions/cache@v3 + - uses: actions/setup-go@v3 with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: '1.17' + - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 @@ -64,8 +60,17 @@ jobs: run: | curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - - - uses: actions/checkout@v2 + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - uses: actions/checkout@v3 with: fetch-depth: 0 # Required to fetch version @@ -74,7 +79,7 @@ jobs: make proto-gen build - name: Store artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: cheqd-noded path: build/cheqd-noded diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 41b204ce2..362883266 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,17 +18,25 @@ jobs: # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 - go-lint: - name: "Lint: Golang" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: latest - args: --timeout 5m0s + # go-lint: + # name: "Lint: Golang" + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v3 + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- + # - name: Run golangci-lint + # uses: golangci/golangci-lint-action@v2 + # with: + # version: latest + # args: --timeout 5m0s md-link-check: name: "Lint: Broken Markdown links" @@ -61,6 +69,7 @@ jobs: VALIDATE_BASH: true VALIDATE_GITHUB_ACTIONS: true + VALIDATE_GO: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true From 1964ea9a392bc8ef4c639ad3ca88bcbf792ca06f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 12:13:13 +0100 Subject: [PATCH 060/141] Combine build tarball and Debian into single job --- .github/workflows/build.yml | 105 +++++++++++++++--------------------- .github/workflows/lint.yml | 39 +++++++------- 2 files changed, 61 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59b35fc5f..710f413f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,9 +33,20 @@ jobs: outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to fetch version - uses: actions/setup-go@v3 with: go-version: '1.17' + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Fetch Golang protoc compiler plugins env: @@ -60,21 +71,8 @@ jobs: run: | curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Required to fetch version - - name: Build + - name: Build proto-gen run: | make proto-gen build @@ -84,86 +82,67 @@ jobs: name: cheqd-noded path: build/cheqd-noded - - name: Set version + - name: Set version number id: set-version run: | VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - build-tar-package: - name: "Build: tar package" + build-packages: + name: "Build: Debian and Tarball packages" runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Load binary artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-noded - name: Restore binary permissions run: sudo chmod +x cheqd-noded - - name: Build tar + - name: Build tarball working-directory: ./build-tools run: | ./build-tar.sh "../cheqd-noded" - - name: Store tar package artifact - uses: actions/upload-artifact@v2 + - name: Store tarball artifact + uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}.tar.gz path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - build-deb-package: - name: "Build: deb package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 - - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - + - name: Install fpm run: | sudo apt-get install ruby ruby-dev rubygems build-essential sudo gem install --no-document fpm - - name: Build deb + - name: Build Debian package working-directory: ./build-tools run: | ./build-deb.sh "../cheqd-noded" - name: Store deb package artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - build-node-images: - name: "Build: cheqd-node and cheqd-cli images" + build-docker-images: + name: "Build: Docker images" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint + - uses: actions/checkout@v3 + + - name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint # TODO: Get rid of UID and GID run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - name: Build cheqd-node with 'node-start' as entrypoint + - name: Build cheqd-node Docker image with 'node-start' as entrypoint run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - name: Save cheqd-cli @@ -173,13 +152,13 @@ jobs: run: docker save -o cheqd-node-image.tar cheqd-node - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: cheqd-cli-image.tar path: cheqd-cli-image.tar - name: Store cheqd-node artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: cheqd-node-image.tar path: cheqd-node-image.tar @@ -192,7 +171,7 @@ jobs: VERSION: ${{ needs.build-binary.outputs.VERSION }} steps: - name: Download deb - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb @@ -200,7 +179,7 @@ jobs: run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb - name: Download node image - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar @@ -208,7 +187,7 @@ jobs: run: docker load -i cheqd-node-image.tar - name: Check out - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up 4 validators + 2 observers node docker pool working-directory: ./docker/localnet @@ -247,7 +226,7 @@ jobs: needs: [build-node-images, build-binary] steps: - name: Load binary artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-noded path: /home/runner/.local/bin @@ -256,7 +235,7 @@ jobs: run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - name: Download node image - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar @@ -264,7 +243,7 @@ jobs: run: docker load -i cheqd-node-image.tar - name: Check out - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up 4 validators + 2 observers node docker pool working-directory: ./docker/localnet @@ -308,7 +287,7 @@ jobs: needs: [build-binary, build-node-images] steps: - name: Load binary artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-noded path: /home/runner/.local/bin @@ -317,7 +296,7 @@ jobs: run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - name: Download node image - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar @@ -325,7 +304,7 @@ jobs: run: docker load -i cheqd-node-image.tar - name: Check out - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up 4 validators + 2 observers node docker pool working-directory: ./docker/localnet @@ -351,12 +330,12 @@ jobs: runs-on: ubuntu-latest needs: build-node-images steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # It's needed for getting the full version of package by `git describe` - name: Download cli image - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: cheqd-cli-image.tar diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 362883266..5fbae90d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,25 +18,25 @@ jobs: # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 - # go-lint: - # name: "Lint: Golang" - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-go@v3 - # - uses: actions/cache@v3 - # with: - # path: | - # ~/.cache/go-build - # ~/go/pkg/mod - # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - # restore-keys: | - # ${{ runner.os }}-go- - # - name: Run golangci-lint - # uses: golangci/golangci-lint-action@v2 - # with: - # version: latest - # args: --timeout 5m0s + go-lint: + name: "Lint: Golang" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: --timeout 5m0s md-link-check: name: "Lint: Broken Markdown links" @@ -69,7 +69,6 @@ jobs: VALIDATE_BASH: true VALIDATE_GITHUB_ACTIONS: true - VALIDATE_GO: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true From 099463cdaa4c09fd657a6b02a1fd82ef6db54fdc Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 12:16:02 +0100 Subject: [PATCH 061/141] Split out tests --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 202 ++++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 710f413f5..37d1efed5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: "Build and Test" +name: "Build" on: workflow_call diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fbae90d9..c8cd8eeab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Lint +name: "Lint" on: workflow_call diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..38febb916 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,202 @@ +name: "Test" + +on: workflow_call + +env: + NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" + +jobs: + + test-new-node-setup-from-deb: + name: "Test: New node setup from deb" + runs-on: ubuntu-latest + needs: [build-binary, build-deb-package, build-node-images] + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: + - name: Download deb + uses: actions/download-artifact@v3 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Install deb + run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Download node image + uses: actions/download-artifact@v3 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v3 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Add observer node + working-directory: ./tests/e2e-complex/deb-install + run: | + ./add-observer.sh + cheqd-noded status -n tcp://localhost:26677 2>&1 + ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + + - name: Promote observer to validator + working-directory: ./tests/e2e-complex/deb-install + run: | + ./promote-validator.sh + cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + # shellcheck disable=SC2016 + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + + - name: Gather logs on failure + if: ${{ failure() }} + run: | + journalctl -ex | grep cheqd + + run-python-based-integration-tests: + name: "Test: Run python based cosmos and identity tests" + runs-on: ubuntu-latest + needs: [build-node-images, build-binary] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v3 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v3 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Set up test environment + working-directory: ./tests/e2e-pytest + run: | + pip3 install -r requirements.txt >> /dev/null + cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode + cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode + sudo chmod -R 777 /home/runner + + - name: Run cosmos-related tests + working-directory: ./tests/e2e-pytest + run: | + set -euxo pipefail + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_cosmos.py + + - name: Run identity-related tests # TODO: Move into separate stage? + working-directory: ./tests/e2e-pytest + run: | + OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') + export OP0_ADDRESS + OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') + export OP1_ADDRESS + pytest -v -rP test_identity.py + + run-bash-based-integration-tests: + name: "Test: Run bash based identity tests" + runs-on: ubuntu-latest + needs: [build-binary, build-node-images] + steps: + - name: Load binary artifact + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + path: /home/runner/.local/bin + + - name: Restore binary permissions + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + + - name: Download node image + uses: actions/download-artifact@v3 + with: + name: cheqd-node-image.tar + + - name: Load node image + run: docker load -i cheqd-node-image.tar + + - name: Check out + uses: actions/checkout@v3 + + - name: Set up 4 validators + 2 observers node docker pool + working-directory: ./docker/localnet + run: | + bash gen-network-config.sh + CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d + + - name: Wait for chain + run: bash tests/tools/wait-for-chain.sh + + - name: Import keys + working-directory: docker/localnet + run: | + bash import_keys.sh + + - name: Set up and run tests + working-directory: tests/e2e-bash + run: | + bash run_all.sh + + run-upgrade-test-positive-case: + name: "Test: Run positive case for upgrade" + runs-on: ubuntu-latest + needs: build-node-images + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # It's needed for getting the full version of package by `git describe` + + - name: Download cli image + uses: actions/download-artifact@v3 + with: + name: cheqd-cli-image.tar + + - name: Load cli image + run: docker load -i cheqd-cli-image.tar + + - name: Chown for current user + run: sudo chown "$USER":"$USER" . + + - name: Prepare nodes for checking upgrade + working-directory: ./tests/e2e-complex/upgrade + run: bash prepare.sh + + - name: Initiate the upgrade process + working-directory: ./tests/e2e-complex/upgrade + run: bash initiate_upgrade.sh + + - name: Make the upgrade and check results + working-directory: ./tests/e2e-complex/upgrade + run: bash upgrade_and_check.sh From 4947dc5259beb75f31ae34fda63f6f5253bc124f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 12:16:57 +0100 Subject: [PATCH 062/141] Update build.yml --- .github/workflows/build.yml | 194 ------------------------------------ 1 file changed, 194 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37d1efed5..6e52eb548 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,197 +162,3 @@ jobs: with: name: cheqd-node-image.tar path: cheqd-node-image.tar - - test-new-node-setup-from-deb: - name: "Test: New node setup from deb" - runs-on: ubuntu-latest - needs: [build-binary, build-deb-package, build-node-images] - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - name: Download deb - uses: actions/download-artifact@v3 - with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Install deb - run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb - - - name: Download node image - uses: actions/download-artifact@v3 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v3 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Add observer node - working-directory: ./tests/e2e-complex/deb-install - run: | - ./add-observer.sh - cheqd-noded status -n tcp://localhost:26677 2>&1 - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - - - name: Promote observer to validator - working-directory: ./tests/e2e-complex/deb-install - run: | - ./promote-validator.sh - cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' - # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - - - name: Gather logs on failure - if: ${{ failure() }} - run: | - journalctl -ex | grep cheqd - - run-python-based-integration-tests: - name: "Test: Run python based cosmos and identity tests" - runs-on: ubuntu-latest - needs: [build-node-images, build-binary] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v3 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v3 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Set up test environment - working-directory: ./tests/e2e-pytest - run: | - pip3 install -r requirements.txt >> /dev/null - cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode - cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode - sudo chmod -R 777 /home/runner - - - name: Run cosmos-related tests - working-directory: ./tests/e2e-pytest - run: | - set -euxo pipefail - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_cosmos.py - - - name: Run identity-related tests # TODO: Move into separate stage? - working-directory: ./tests/e2e-pytest - run: | - OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') - export OP0_ADDRESS - OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') - export OP1_ADDRESS - pytest -v -rP test_identity.py - - run-bash-based-integration-tests: - name: "Test: Run bash based identity tests" - runs-on: ubuntu-latest - needs: [build-binary, build-node-images] - steps: - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - path: /home/runner/.local/bin - - - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - - name: Download node image - uses: actions/download-artifact@v3 - with: - name: cheqd-node-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar - - - name: Check out - uses: actions/checkout@v3 - - - name: Set up 4 validators + 2 observers node docker pool - working-directory: ./docker/localnet - run: | - bash gen-network-config.sh - CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh - - - name: Import keys - working-directory: docker/localnet - run: | - bash import_keys.sh - - - name: Set up and run tests - working-directory: tests/e2e-bash - run: | - bash run_all.sh - - run-upgrade-test-positive-case: - name: "Test: Run positive case for upgrade" - runs-on: ubuntu-latest - needs: build-node-images - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # It's needed for getting the full version of package by `git describe` - - - name: Download cli image - uses: actions/download-artifact@v3 - with: - name: cheqd-cli-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Chown for current user - run: sudo chown "$USER":"$USER" . - - - name: Prepare nodes for checking upgrade - working-directory: ./tests/e2e-complex/upgrade - run: bash prepare.sh - - - name: Initiate the upgrade process - working-directory: ./tests/e2e-complex/upgrade - run: bash initiate_upgrade.sh - - - name: Make the upgrade and check results - working-directory: ./tests/e2e-complex/upgrade - run: bash upgrade_and_check.sh From c5a9c247a94a0c05cb5f5de72c4413ad844253d9 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 12:28:48 +0100 Subject: [PATCH 063/141] Temporarily turning off Github Actions --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c8cd8eeab..be367feca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -68,7 +68,7 @@ jobs: MULTI_STATUS: true VALIDATE_BASH: true - VALIDATE_GITHUB_ACTIONS: true + # VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true From 3bfb6a18234c321a3e55c96be45609aad166d503 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 13:44:45 +0100 Subject: [PATCH 064/141] Go lint cache debug --- .github/workflows/build.yml | 16 ++++++++-------- .github/workflows/lint.yml | 28 +++++++++++++++------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e52eb548..5d7b2f5ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,14 +39,14 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - name: Fetch Golang protoc compiler plugins env: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index be367feca..8bd915a0e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,19 @@ jobs: - uses: actions/checkout@v3 - name: Run 'set -euox pipefail' check run: bash ./.github/scripts/ensure_set_euox_pipefail.sh - + + md-link-check: + name: "Lint: Broken Markdown links" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run Markdown link check + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: '.github/linters/mlc_config.json' + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 go-lint: @@ -24,6 +36,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 + with: + go-version: '1.17' - uses: actions/cache@v3 with: path: | @@ -38,18 +52,6 @@ jobs: version: latest args: --timeout 5m0s - md-link-check: - name: "Lint: Broken Markdown links" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Run Markdown link check - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - config-file: '.github/linters/mlc_config.json' - use-quiet-mode: 'yes' - use-verbose-mode: 'yes' - super-lint: name: "Lint: Super Linter" runs-on: ubuntu-latest From 0cf5897912c06e2cef6ebf6d6162220318a920c5 Mon Sep 17 00:00:00 2001 From: jay-dee7 Date: Thu, 24 Mar 2022 16:14:53 +0530 Subject: [PATCH 065/141] Chore: Added Github CodeQL Action --- .github/workflows/codeql.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..0b1b347ac --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '15 3 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # this covers a larger portion of checks but are experimental right now + queries: security-and-quality + - run: | + make build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + From 9c55ba1a1d8673d58454aef39bcb8653443f3020 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 13:57:58 +0100 Subject: [PATCH 066/141] Incorporating CodeQL into build --- .github/workflows/build.yml | 26 ++++++++++++++++------- .github/workflows/codeql.yml | 41 ------------------------------------ .github/workflows/lint.yml | 8 ------- 3 files changed, 18 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d7b2f5ef..736e43a95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,16 @@ jobs: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + language: [ 'go' ] + steps: - uses: actions/checkout@v3 with: @@ -39,14 +49,14 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - # - uses: actions/cache@v3 - # with: - # path: | - # ~/.cache/go-build - # ~/go/pkg/mod - # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - # restore-keys: | - # ${{ runner.os }}-go- + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Fetch Golang protoc compiler plugins env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 0b1b347ac..000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '15 3 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go', 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # this covers a larger portion of checks but are experimental right now - queries: security-and-quality - - run: | - make build - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8bd915a0e..ea1d198f6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -38,14 +38,6 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: From 52ca9c1efc35f6e179e5b71faa17e5f0595f9997 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 14:08:01 +0100 Subject: [PATCH 067/141] Update build.yml --- .github/workflows/build.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 736e43a95..ecdd2be53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,14 +15,14 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - name: Run Golang unit tests run: go test -v ./... @@ -49,14 +49,14 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - name: Fetch Golang protoc compiler plugins env: From 1a2b88994bdee96f98b87abd407233965206d9a1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 14:18:22 +0100 Subject: [PATCH 068/141] Update build.yml --- .github/workflows/build.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecdd2be53..af65b9827 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,14 +15,6 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '1.17' - # - uses: actions/cache@v3 - # with: - # path: | - # ~/.cache/go-build - # ~/go/pkg/mod - # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - # restore-keys: | - # ${{ runner.os }}-go- - name: Run Golang unit tests run: go test -v ./... @@ -48,16 +40,7 @@ jobs: fetch-depth: 0 # Required to fetch version - uses: actions/setup-go@v3 with: - go-version: '1.17' - # - uses: actions/cache@v3 - # with: - # path: | - # ~/.cache/go-build - # ~/go/pkg/mod - # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - # restore-keys: | - # ${{ runner.os }}-go- - + go-version: '1.17' - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 From 74ac1eb511dfe00e6cc8d432f026fce2a72968ba Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 14:24:41 +0100 Subject: [PATCH 069/141] Update build.yml --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af65b9827..8f78414cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,9 +35,6 @@ jobs: language: [ 'go' ] steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Required to fetch version - uses: actions/setup-go@v3 with: go-version: '1.17' @@ -64,7 +61,10 @@ jobs: run: | curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to fetch version - name: Build proto-gen run: | make proto-gen build From 08a5df38ec044945f48874a3d6b8f7745e3cb24a Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 15:18:11 +0100 Subject: [PATCH 070/141] Update build-deb.sh --- build-tools/build-deb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/build-deb.sh b/build-tools/build-deb.sh index 4cc055599..88c7bf84c 100755 --- a/build-tools/build-deb.sh +++ b/build-tools/build-deb.sh @@ -20,8 +20,8 @@ PKG_NAME="cheqd-node" BUILD_DIR="build" OUTPUT_DIR="output" -mkdir "${BUILD_DIR}" -mkdir "${OUTPUT_DIR}" +mkdir -p "${BUILD_DIR}" +mkdir -p "${OUTPUT_DIR}" # Prepare content PACKAGE_CONTENT="${BUILD_DIR}/deb-package-content" From 338c1ce2db79751118df228d45146fcf1b772016 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:02:31 +0100 Subject: [PATCH 071/141] Added CodeQL test --- .github/workflows/build.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f78414cf..e3003b49d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,16 +28,11 @@ jobs: actions: read contents: read security-events: write - strategy: - fail-fast: false - matrix: - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - language: [ 'go' ] steps: - uses: actions/setup-go@v3 with: - go-version: '1.17' + go-version: '1.17' - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 @@ -65,9 +60,17 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Required to fetch version - - name: Build proto-gen + + - name: Build node binary + uses: github/codeql-action/init@v2 + with: + languages: 'go' + queries: security-and-quality run: | make proto-gen build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 - name: Store artifact uses: actions/upload-artifact@v3 From e50ac1ecf64ce511aa01de55b94a124bf48c80da Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:10:37 +0100 Subject: [PATCH 072/141] Shift CodeQL to test --- .github/workflows/build.yml | 16 +++------------- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3003b49d..55eb51d58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ env: jobs: run-go-unit-tests: - name: "Test: Golang unit tests" + name: "Build: Golang unit tests" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,15 +24,12 @@ jobs: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} - permissions: - actions: read - contents: read - security-events: write steps: - uses: actions/setup-go@v3 with: go-version: '1.17' + - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 @@ -62,15 +59,8 @@ jobs: fetch-depth: 0 # Required to fetch version - name: Build node binary - uses: github/codeql-action/init@v2 - with: - languages: 'go' - queries: security-and-quality run: | make proto-gen build - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - name: Store artifact uses: actions/upload-artifact@v3 @@ -83,7 +73,7 @@ jobs: run: | VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - + build-packages: name: "Build: Debian and Tarball packages" runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38febb916..b90f2a949 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,32 @@ env: jobs: + codeql-analysis: + name: "Test: CodeQL Analysis" + permissions: + actions: read + contents: read + security-events: write + + steps: + - uses: actions/checkout@v3 + + - name: Load binary artifact from build + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + + - name: Setup CodeQL + uses: github/codeql-action/init@v2 + with: + languages: 'go' + queries: security-and-quality + + - name + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + test-new-node-setup-from-deb: name: "Test: New node setup from deb" runs-on: ubuntu-latest From 34dac41346bdb9db197036c00e5250ac3c053c75 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:30:46 +0100 Subject: [PATCH 073/141] Add workflow output --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++------- .github/workflows/dispatch.yml | 3 +-- .github/workflows/lint.yml | 9 +++++-- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55eb51d58..959d191e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,20 +1,26 @@ name: "Build" - on: workflow_call - +defaults: + run: + shell: bash +outputs: + VERSION: ${{ jobs.build-binary.outputs.VERSION }} env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" + jobs: run-go-unit-tests: name: "Build: Golang unit tests" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: '1.17' + - name: Run Golang unit tests run: go test -v ./... @@ -74,12 +80,13 @@ jobs: VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - build-packages: - name: "Build: Debian and Tarball packages" + build-tarball-package: + name: "Build: Tarball package" runs-on: ubuntu-latest needs: build-binary env: VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: - uses: actions/checkout@v3 @@ -101,6 +108,24 @@ jobs: with: name: cheqd-node_${{ env.VERSION }}.tar.gz path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + + build-debian-package: + name: "Build: Debian package" + runs-on: ubuntu-latest + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + + steps: + - uses: actions/checkout@v3 + + - name: Load binary artifact + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded - name: Install fpm run: | @@ -112,7 +137,7 @@ jobs: run: | ./build-deb.sh "../cheqd-noded" - - name: Store deb package artifact + - name: Store Debian package artifact uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb @@ -131,18 +156,18 @@ jobs: - name: Build cheqd-node Docker image with 'node-start' as entrypoint run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - name: Save cheqd-cli + - name: Save and store cheqd-cli run: docker save -o cheqd-cli-image.tar cheqd-cli - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - name: Store cheqd-cli artifact uses: actions/upload-artifact@v3 with: name: cheqd-cli-image.tar path: cheqd-cli-image.tar + - name: Save cheqd-node + run: docker save -o cheqd-node-image.tar cheqd-node + - name: Store cheqd-node artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index c5d87b7d4..e8d61a22d 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -1,11 +1,10 @@ name: "Workflow Dispatch" - on: push - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: call-lint: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea1d198f6..82bc69d19 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,16 +1,16 @@ name: "Lint" - on: workflow_call - defaults: run: shell: bash + jobs: sh-euox-pipefail-check: name: "Lint: Shell pipefail check" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - name: Run 'set -euox pipefail' check @@ -19,6 +19,7 @@ jobs: md-link-check: name: "Lint: Broken Markdown links" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - name: Run Markdown link check @@ -33,11 +34,13 @@ jobs: go-lint: name: "Lint: Golang" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: '1.17' + - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: @@ -47,10 +50,12 @@ jobs: super-lint: name: "Lint: Super Linter" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # Required to fetch version + - name: Run Super Linter uses: github/super-linter/slim@v4 env: From 96394f10e4c86f828e2a8a1ffaf4e33c194d119c Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:31:41 +0100 Subject: [PATCH 074/141] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 959d191e1..5dcd4c8c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ name: "Build" on: workflow_call + outputs: + VERSION: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash -outputs: - VERSION: ${{ jobs.build-binary.outputs.VERSION }} env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" From f3a35ac05002ec0de50c2abb568010379886946b Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:32:16 +0100 Subject: [PATCH 075/141] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dcd4c8c3..ae40c1611 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: "Build" on: workflow_call outputs: - VERSION: ${{ jobs.build-binary.outputs.VERSION }} + VERSION: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash From c8d7ff6d759d8f1cbb154c31f9e049cf966847a3 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:33:27 +0100 Subject: [PATCH 076/141] Update build.yml --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae40c1611..6c3a5d973 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,9 @@ name: "Build" on: workflow_call outputs: - VERSION: ${{ jobs.build-binary.outputs.VERSION }} + VERSION: + description: "Build version number" + value: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash From 8daec0f72c42e2b27f1cc689d7fc6a41f4bb9acb Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:35:01 +0100 Subject: [PATCH 077/141] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c3a5d973..d629f6db9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: "Build" on: workflow_call outputs: - VERSION: + BUILD_VERSION: description: "Build version number" value: ${{ jobs.build-binary.outputs.VERSION }} defaults: From 6141784b99880df58023b5cef7189c08338ee392 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:36:23 +0100 Subject: [PATCH 078/141] Update build.yml --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d629f6db9..44b586b49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,9 @@ name: "Build" on: workflow_call - outputs: - BUILD_VERSION: - description: "Build version number" - value: ${{ jobs.build-binary.outputs.VERSION }} +outputs: + BUILD_VERSION: + description: "Build version number" + value: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash From da5e4ebd489ba7c4fd42a18e626706e6aa3ff096 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:37:35 +0100 Subject: [PATCH 079/141] Update build.yml --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44b586b49..7768cf799 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,9 @@ name: "Build" on: workflow_call -outputs: - BUILD_VERSION: - description: "Build version number" - value: ${{ jobs.build-binary.outputs.VERSION }} + outputs: + version: + description: "Build version number" + value: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash From d2e00f320cccdce27bc14828c6f9c2a3d344b144 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:44:04 +0100 Subject: [PATCH 080/141] Update build.yml --- .github/workflows/build.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7768cf799..264e6c732 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,11 @@ name: "Build" -on: workflow_call - outputs: - version: - description: "Build version number" - value: ${{ jobs.build-binary.outputs.VERSION }} +on: + workflow_call: + outputs: + VERSION: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash -env: - NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" jobs: From c62c64fa2c733b3fdaa1ae63662ce5ffa9b92191 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 18:46:06 +0100 Subject: [PATCH 081/141] Update build.yml --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 264e6c732..8f3e643e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,9 @@ name: "Build" on: workflow_call: outputs: - VERSION: ${{ jobs.build-binary.outputs.VERSION }} + VERSION: + description: "Build version number" + value: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash From f65493bfd91eb0fd88027c9c359fae392a41080f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 19:40:59 +0100 Subject: [PATCH 082/141] Calling test.yml --- .github/workflows/dispatch.yml | 7 +++++++ .github/workflows/test.yml | 13 ++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index e8d61a22d..455f943c4 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -15,3 +15,10 @@ jobs: name: "Build workflow" needs: call-lint uses: ./.github/workflows/build.yml + + call-test: + name: "Test workflow" + needs: call-build + uses: ./.github/workflows/test.yml + with: + VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b90f2a949..156c2bd70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,14 @@ name: "Test" - -on: workflow_call - +on: + workflow_call: + inputs: + VERSION: + description: "Build version number" + required: true + type: string +defaults: + run: + shell: bash env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" From 7e914936cc5aaf7b769d54c702d81e67c385244f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 19:57:54 +0100 Subject: [PATCH 083/141] Update test.yml --- .github/workflows/test.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 156c2bd70..dba29b039 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,31 +12,29 @@ defaults: env: NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" + jobs: codeql-analysis: name: "Test: CodeQL Analysis" + runs-on: ubuntu-latest permissions: - actions: read - contents: read - security-events: write - - steps: - - uses: actions/checkout@v3 + actions: read + contents: read + security-events: write - - name: Load binary artifact from build - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - + steps: - name: Setup CodeQL uses: github/codeql-action/init@v2 with: languages: 'go' queries: security-and-quality - - - name + - name: Load binary artifact from build + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 From 5e794430dd256e0a0d7a98aecb39f52617253159 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 20:36:11 +0100 Subject: [PATCH 084/141] Update test.yml --- .github/workflows/test.yml | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dba29b039..2a3f98f5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,6 @@ on: inputs: VERSION: description: "Build version number" - required: true type: string defaults: run: @@ -38,27 +37,25 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 - test-new-node-setup-from-deb: - name: "Test: New node setup from deb" + test-new-node-setup: + name: "Test: Node setup" runs-on: ubuntu-latest - needs: [build-binary, build-deb-package, build-node-images] - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} + steps: - - name: Download deb + - name: Download Debian package uses: actions/download-artifact@v3 with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.VERSION }}_amd64.deb - - name: Install deb - run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb + - name: Install Debian package + run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ inputs.VERSION }}_amd64.deb - - name: Download node image + - name: Download node Docker image uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar - - name: Load node image + - name: Load node Docker image run: docker load -i cheqd-node-image.tar - name: Check out @@ -95,10 +92,10 @@ jobs: run: | journalctl -ex | grep cheqd - run-python-based-integration-tests: - name: "Test: Run python based cosmos and identity tests" + python-integration-tests: + name: "Test: Cosmos SDK and identity integration" runs-on: ubuntu-latest - needs: [build-node-images, build-binary] + steps: - name: Load binary artifact uses: actions/download-artifact@v3 @@ -156,10 +153,10 @@ jobs: export OP1_ADDRESS pytest -v -rP test_identity.py - run-bash-based-integration-tests: + bash-integration-tests: name: "Test: Run bash based identity tests" runs-on: ubuntu-latest - needs: [build-binary, build-node-images] + steps: - name: Load binary artifact uses: actions/download-artifact@v3 @@ -200,14 +197,12 @@ jobs: run: | bash run_all.sh - run-upgrade-test-positive-case: + node-upgrade-test: name: "Test: Run positive case for upgrade" runs-on: ubuntu-latest - needs: build-node-images + steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 # It's needed for getting the full version of package by `git describe` - name: Download cli image uses: actions/download-artifact@v3 From 4411684dcbdc6012b8ce22601d89813b4140bdb3 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 21:00:37 +0100 Subject: [PATCH 085/141] CodeQL fix --- .github/workflows/build.yml | 15 +++++++++++-- .github/workflows/dispatch.yml | 8 +++---- .github/workflows/test.yml | 40 ++++++++++++++++++++++------------ 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f3e643e0..0a90e1bcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ defaults: jobs: - run-go-unit-tests: + go-unit-tests: name: "Build: Golang unit tests" runs-on: ubuntu-latest @@ -27,7 +27,7 @@ jobs: build-binary: name: "Build: Node binary" - needs: run-go-unit-tests + needs: go-unit-tests runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} @@ -65,6 +65,15 @@ jobs: with: fetch-depth: 0 # Required to fetch version + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Build node binary run: | make proto-gen build @@ -147,6 +156,8 @@ jobs: build-docker-images: name: "Build: Docker images" runs-on: ubuntu-latest + needs: go-unit-tests + steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 455f943c4..14ae3e886 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,13 +7,13 @@ concurrency: jobs: - call-lint: - name: "Lint workflow" - uses: ./.github/workflows/lint.yml + # call-lint: + # name: "Lint workflow" + # uses: ./.github/workflows/lint.yml call-build: name: "Build workflow" - needs: call-lint + # needs: call-lint uses: ./.github/workflows/build.yml call-test: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a3f98f5b..f82480857 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,17 +22,30 @@ jobs: contents: read security-events: write - steps: + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Setup CodeQL uses: github/codeql-action/init@v2 with: languages: 'go' queries: security-and-quality - - name: Load binary artifact from build - uses: actions/download-artifact@v3 - with: - name: cheqd-noded + - name: Build + run: | + make proto-gen build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 @@ -58,26 +71,25 @@ jobs: - name: Load node Docker image run: docker load -i cheqd-node-image.tar - - name: Check out - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up 4 validators + 2 observers node docker pool + - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | bash gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - name: Wait for chain + - name: Check all Docker localnet nodes are active run: bash tests/tools/wait-for-chain.sh - - name: Add observer node + - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | ./add-observer.sh cheqd-noded status -n tcp://localhost:26677 2>&1 ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - - name: Promote observer to validator + - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | ./promote-validator.sh @@ -185,15 +197,15 @@ jobs: CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - name: Wait for chain - run: bash tests/tools/wait-for-chain.sh + run: bash ./tests/tools/wait-for-chain.sh - name: Import keys - working-directory: docker/localnet + working-directory: ./docker/localnet run: | bash import_keys.sh - name: Set up and run tests - working-directory: tests/e2e-bash + working-directory: ./tests/e2e-bash run: | bash run_all.sh From 90e81d3a1211a21e055a24c7e543d854b9fd93a2 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 21:22:33 +0100 Subject: [PATCH 086/141] Testing runner permissions --- .github/workflows/dispatch.yml | 8 +++--- .github/workflows/test.yml | 28 ++++++++++++------- tests/e2e-complex/deb-install/add-observer.sh | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 14ae3e886..50eaff428 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -8,17 +8,17 @@ concurrency: jobs: # call-lint: - # name: "Lint workflow" + # name: "Lint" # uses: ./.github/workflows/lint.yml call-build: - name: "Build workflow" + name: "Build" # needs: call-lint uses: ./.github/workflows/build.yml call-test: - name: "Test workflow" + name: "Test" needs: call-build uses: ./.github/workflows/test.yml with: - VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file + VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f82480857..a6728bf82 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ defaults: run: shell: bash env: - NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" + NODE_CONFIGS_BASE: "/home/runner/cheqd/docker/localnet/network-config" jobs: @@ -43,6 +43,14 @@ jobs: languages: 'go' queries: security-and-quality + - name: Install buf + env: + PREFIX: "/usr/local" + VERSION: "1.0.0-rc8" + run: | + curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ + sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 + - name: Build run: | make proto-gen build @@ -105,7 +113,7 @@ jobs: journalctl -ex | grep cheqd python-integration-tests: - name: "Test: Cosmos SDK and identity integration" + name: "Test: Python-based Cosmos and identity tests" runs-on: ubuntu-latest steps: @@ -113,10 +121,10 @@ jobs: uses: actions/download-artifact@v3 with: name: cheqd-noded - path: /home/runner/.local/bin + path: /home/runner/local/bin - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + run: sudo chmod +x /home/runner/local/bin/cheqd-noded - name: Download node image uses: actions/download-artifact@v3 @@ -142,9 +150,9 @@ jobs: working-directory: ./tests/e2e-pytest run: | pip3 install -r requirements.txt >> /dev/null - cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode - cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode - sudo chmod -R 777 /home/runner + cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/cheqd/ + cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/cheqd/ + sudo chmod -R 755 /home/runner/cheqd/ - name: Run cosmos-related tests working-directory: ./tests/e2e-pytest @@ -166,7 +174,7 @@ jobs: pytest -v -rP test_identity.py bash-integration-tests: - name: "Test: Run bash based identity tests" + name: "Test: Bash-based identity tests" runs-on: ubuntu-latest steps: @@ -174,10 +182,10 @@ jobs: uses: actions/download-artifact@v3 with: name: cheqd-noded - path: /home/runner/.local/bin + path: /home/runner/local/bin - name: Restore binary permissions - run: sudo chmod +x /home/runner/.local/bin/cheqd-noded + run: sudo chmod +x /home/runner/local/bin/cheqd-noded - name: Download node image uses: actions/download-artifact@v3 diff --git a/tests/e2e-complex/deb-install/add-observer.sh b/tests/e2e-complex/deb-install/add-observer.sh index 345009d69..aee89961c 100755 --- a/tests/e2e-complex/deb-install/add-observer.sh +++ b/tests/e2e-complex/deb-install/add-observer.sh @@ -11,7 +11,7 @@ sudo -u cheqd cheqd-noded configure p2p persistent-peers "${PERSISTENT_PEERS}" sudo cp "${NODE_CONFIGS_BASE}/validator-0/config/genesis.json" "/home/runner/cheqd/.cheqdnode/config" -sudo chmod -R 777 "/home/runner/cheqd/.cheqdnode" +sudo chmod -R 755 "/home/runner/cheqd/.cheqdnode" # Configure ports because they conflict with localnet sudo -u cheqd cheqd-noded configure p2p laddr "tcp://0.0.0.0:26676" From 093346aa3dbedf0a7de558ccd4ae6a10222b6283 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 22:34:02 +0100 Subject: [PATCH 087/141] Trying to fix setup test --- .github/workflows/build.yml | 10 ++--- .github/workflows/lint.yml | 10 ++--- .github/workflows/test.yml | 41 ++++++++++++++------- docker/localnet/docker-compose.env | 6 +-- docker/persistent-chains/docker-compose.env | 4 +- tests/e2e-pytest/helpers.py | 8 ++-- 6 files changed, 47 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a90e1bcd..314cec16e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ defaults: jobs: go-unit-tests: - name: "Build: Golang unit tests" + name: "Golang unit tests" runs-on: ubuntu-latest steps: @@ -26,7 +26,7 @@ jobs: run: go test -v ./... build-binary: - name: "Build: Node binary" + name: "Node binary" needs: go-unit-tests runs-on: ubuntu-latest outputs: @@ -91,7 +91,7 @@ jobs: echo "::set-output name=VERSION::$VERSION" build-tarball-package: - name: "Build: Tarball package" + name: "Tarball package" runs-on: ubuntu-latest needs: build-binary env: @@ -120,7 +120,7 @@ jobs: path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz build-debian-package: - name: "Build: Debian package" + name: "Debian package" runs-on: ubuntu-latest needs: build-binary env: @@ -154,7 +154,7 @@ jobs: path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb build-docker-images: - name: "Build: Docker images" + name: "Docker images" runs-on: ubuntu-latest needs: go-unit-tests diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 82bc69d19..9213558dd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ defaults: jobs: sh-euox-pipefail-check: - name: "Lint: Shell pipefail check" + name: "Shell pipefail check" runs-on: ubuntu-latest steps: @@ -17,7 +17,7 @@ jobs: run: bash ./.github/scripts/ensure_set_euox_pipefail.sh md-link-check: - name: "Lint: Broken Markdown links" + name: "Broken Markdown links" runs-on: ubuntu-latest steps: @@ -32,7 +32,7 @@ jobs: # We can't use VALIDATE_GO from super linter because of this issue: # https://github.com/github/super-linter/issues/143 go-lint: - name: "Lint: Golang" + name: "Golang" runs-on: ubuntu-latest steps: @@ -48,7 +48,7 @@ jobs: args: --timeout 5m0s super-lint: - name: "Lint: Super Linter" + name: "Super Linter" runs-on: ubuntu-latest steps: @@ -72,6 +72,6 @@ jobs: VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true # VALIDATE_PROTOBUF: true - VALIDATE_PYTHON_PYLINT: true + VALIDATE_PYTHON_PYtrue VALIDATE_XML: true VALIDATE_YAML: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6728bf82..a1a03fcab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,13 +9,13 @@ defaults: run: shell: bash env: - NODE_CONFIGS_BASE: "/home/runner/cheqd/docker/localnet/network-config" + NODE_CONFIGS_BASE: "/home/runner/cheqd/network-config" jobs: codeql-analysis: - name: "Test: CodeQL Analysis" + name: "CodeQL Analysis" runs-on: ubuntu-latest permissions: actions: read @@ -27,7 +27,7 @@ jobs: - uses: actions/setup-go@v2 with: go-version: '1.17' - + - uses: actions/cache@v3 with: path: | @@ -43,6 +43,22 @@ jobs: languages: 'go' queries: security-and-quality + - name: Fetch Golang protoc compiler plugins + env: + GOLANG_PROTOBUF_VERSION: 1.3.5 + GOGO_PROTOBUF_VERSION: 1.3.2 + GRPC_GATEWAY_VERSION: 1.14.7 + # Taken from: tendermintdev/sdk-proto-gen:v0.2 + run: | + go get \ + github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ + github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest + - name: Install buf env: PREFIX: "/usr/local" @@ -59,7 +75,7 @@ jobs: uses: github/codeql-action/analyze@v2 test-new-node-setup: - name: "Test: Node setup" + name: "New node setup" runs-on: ubuntu-latest steps: @@ -113,11 +129,11 @@ jobs: journalctl -ex | grep cheqd python-integration-tests: - name: "Test: Python-based Cosmos and identity tests" + name: "Python-based Cosmos and identity tests" runs-on: ubuntu-latest steps: - - name: Load binary artifact + - name: Load node binary artifact uses: actions/download-artifact@v3 with: name: cheqd-noded @@ -126,18 +142,17 @@ jobs: - name: Restore binary permissions run: sudo chmod +x /home/runner/local/bin/cheqd-noded - - name: Download node image + - name: Download node Docker image uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar - - name: Load node image + - name: Load node Docker image run: docker load -i cheqd-node-image.tar - - name: Check out - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up 4 validators + 2 observers node docker pool + - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | bash gen-network-config.sh @@ -174,7 +189,7 @@ jobs: pytest -v -rP test_identity.py bash-integration-tests: - name: "Test: Bash-based identity tests" + name: "Bash-based identity tests" runs-on: ubuntu-latest steps: @@ -218,7 +233,7 @@ jobs: bash run_all.sh node-upgrade-test: - name: "Test: Run positive case for upgrade" + name: "Run positive case for upgrade" runs-on: ubuntu-latest steps: diff --git a/docker/localnet/docker-compose.env b/docker/localnet/docker-compose.env index 921c9c241..d5f7bae95 100644 --- a/docker/localnet/docker-compose.env +++ b/docker/localnet/docker-compose.env @@ -7,6 +7,6 @@ CHEQD_NODE_IMAGE="ghcr.io/cheqd/cheqd-node" # Define cheqd-noded software release version -# Current MAINNET recommended version: v0.3.1 -# Current TESTNET recommended version: v0.3.1 -CHEQD_NODE_VERSION="0.3.1" +# Current MAINNET recommended version: v0.5.0 +# Current TESTNET recommended version: v0.5.0 +CHEQD_NODE_VERSION="0.5.0" diff --git a/docker/persistent-chains/docker-compose.env b/docker/persistent-chains/docker-compose.env index ac20ceccb..151b8092d 100644 --- a/docker/persistent-chains/docker-compose.env +++ b/docker/persistent-chains/docker-compose.env @@ -11,8 +11,8 @@ CHEQD_NETWORK="mainnet" # Define cheqd-noded software release version -# Current MAINNET recommended version: v0.3.1 -# Current TESTNET recommended version: v0.3.1 +# Current MAINNET recommended version: v0.5.0 +# Current TESTNET recommended version: v0.5.0 CHEQD_NODE_VERSION="0.4.1" diff --git a/tests/e2e-pytest/helpers.py b/tests/e2e-pytest/helpers.py index a0adf7506..617a284fa 100644 --- a/tests/e2e-pytest/helpers.py +++ b/tests/e2e-pytest/helpers.py @@ -14,12 +14,12 @@ TEST_NET_NETWORK = "cheqd-testnet-2" LOCAL_NET_NETWORK = "cheqd" -TEST_NET_NODE_TCP = "--node 'tcp://seed1.us.testnet.cheqd.network:26657'" -TEST_NET_NODE_HTTP = "--node http://node1.eu.testnet.cheqd.network:26657/" +TEST_NET_NODE_TCP = "--node 'tcp://rpc.cheqd.network:443'" +TEST_NET_NODE_HTTP = "--node https://rpc.cheqd.network/" LOCAL_NET_NODE_TCP = "--node 'tcp://localhost:26657'" LOCAL_NET_NODE_HTTP = "--node http://localhost:26657/" -TEST_NET_DESTINATION = f"{TEST_NET_NODE_TCP} --chain-id 'cheqd-testnet-2'" -TEST_NET_DESTINATION_HTTP = f"{TEST_NET_NODE_HTTP} --chain-id 'cheqd-testnet-2'" +TEST_NET_DESTINATION = f"{TEST_NET_NODE_TCP} --chain-id 'cheqd-testnet-4'" +TEST_NET_DESTINATION_HTTP = f"{TEST_NET_NODE_HTTP} --chain-id 'cheqd-testnet-4'" LOCAL_NET_DESTINATION = f"{LOCAL_NET_NODE_TCP} --chain-id 'cheqd'" LOCAL_NET_DESTINATION_HTTP = f"{LOCAL_NET_NODE_HTTP} --chain-id 'cheqd'" GAS_AMOUNT = 90000 # 70000 throws `out of gas` sometimes From 99402048f90d5cfc3491ef6f986a2bcbf00b661d Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 22:56:25 +0100 Subject: [PATCH 088/141] Remove cache --- .github/workflows/build.yml | 9 --------- .github/workflows/test.yml | 19 +++++-------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 314cec16e..b82617ece 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,15 +65,6 @@ jobs: with: fetch-depth: 0 # Required to fetch version - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build node binary run: | make proto-gen build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1a03fcab..1168f7de4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ defaults: run: shell: bash env: - NODE_CONFIGS_BASE: "/home/runner/cheqd/network-config" + NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config" jobs: @@ -27,15 +27,6 @@ jobs: - uses: actions/setup-go@v2 with: go-version: '1.17' - - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Setup CodeQL uses: github/codeql-action/init@v2 @@ -137,10 +128,10 @@ jobs: uses: actions/download-artifact@v3 with: name: cheqd-noded - path: /home/runner/local/bin + path: /home/runner/.local/bin - name: Restore binary permissions - run: sudo chmod +x /home/runner/local/bin/cheqd-noded + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - name: Download node Docker image uses: actions/download-artifact@v3 @@ -197,10 +188,10 @@ jobs: uses: actions/download-artifact@v3 with: name: cheqd-noded - path: /home/runner/local/bin + path: /home/runner/.local/bin - name: Restore binary permissions - run: sudo chmod +x /home/runner/local/bin/cheqd-noded + run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - name: Download node image uses: actions/download-artifact@v3 From 61368bdaf61b6250df379b92410dfe9837d28100 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Fri, 8 Apr 2022 23:05:47 +0100 Subject: [PATCH 089/141] Update test.yml --- .github/workflows/test.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1168f7de4..15d38d2eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,18 +22,17 @@ jobs: contents: read security-events: write - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 - with: - go-version: '1.17' - + steps: - name: Setup CodeQL uses: github/codeql-action/init@v2 with: languages: 'go' queries: security-and-quality + - uses: actions/setup-go@v2 + with: + go-version: '1.17' + - name: Fetch Golang protoc compiler plugins env: GOLANG_PROTOBUF_VERSION: 1.3.5 @@ -58,6 +57,8 @@ jobs: curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 + - uses: actions/checkout@v3 + - name: Build run: | make proto-gen build From ce6e2a7f7d2f77f5d57b8036b382d57532df6f23 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 00:25:48 +0100 Subject: [PATCH 090/141] Remove CodeQL from Test workflow --- .github/workflows/test.yml | 54 +------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15d38d2eb..f8d7d88b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,58 +14,6 @@ env: jobs: - codeql-analysis: - name: "CodeQL Analysis" - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: Setup CodeQL - uses: github/codeql-action/init@v2 - with: - languages: 'go' - queries: security-and-quality - - - uses: actions/setup-go@v2 - with: - go-version: '1.17' - - - name: Fetch Golang protoc compiler plugins - env: - GOLANG_PROTOBUF_VERSION: 1.3.5 - GOGO_PROTOBUF_VERSION: 1.3.2 - GRPC_GATEWAY_VERSION: 1.14.7 - # Taken from: tendermintdev/sdk-proto-gen:v0.2 - run: | - go get \ - github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ - github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest - - - name: Install buf - env: - PREFIX: "/usr/local" - VERSION: "1.0.0-rc8" - run: | - curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ - sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - - - uses: actions/checkout@v3 - - - name: Build - run: | - make proto-gen build - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - test-new-node-setup: name: "New node setup" runs-on: ubuntu-latest @@ -92,7 +40,7 @@ jobs: - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | - bash gen-network-config.sh + ./gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - name: Check all Docker localnet nodes are active From 065dc3b8e2846d15039de17dc3c508a740775bfc Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 00:36:16 +0100 Subject: [PATCH 091/141] Update test.yml --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f8d7d88b5..ddf942adc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | - ./gen-network-config.sh + bash gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - name: Check all Docker localnet nodes are active @@ -49,19 +49,19 @@ jobs: - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | - ./add-observer.sh + bash add-observer.sh cheqd-noded status -n tcp://localhost:26677 2>&1 - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + bash wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | - ./promote-validator.sh + bash promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - name: Gather logs on failure if: ${{ failure() }} From 380a11dcd86b911ae770bf30e29f80d944212dc3 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 01:44:36 +0100 Subject: [PATCH 092/141] Final test --- .github/workflows/test.yml | 20 ++++++++++--------- .../deb-install/promote-validator.sh | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddf942adc..053b314ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,15 +17,17 @@ jobs: test-new-node-setup: name: "New node setup" runs-on: ubuntu-latest - + env: + VERSION: ${{ inputs.VERSION }} + steps: - name: Download Debian package uses: actions/download-artifact@v3 with: - name: cheqd-node_${{ inputs.VERSION }}_amd64.deb + name: cheqd-node_${{ env.VERSION }}_amd64.deb - name: Install Debian package - run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ inputs.VERSION }}_amd64.deb + run: sudo CHEQD_HOME_DIR=/home/runner/cheqd dpkg -i cheqd-node_${{ env.VERSION }}_amd64.deb - name: Download node Docker image uses: actions/download-artifact@v3 @@ -49,19 +51,19 @@ jobs: - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | - bash add-observer.sh + ./add-observer.sh cheqd-noded status -n tcp://localhost:26677 2>&1 - bash wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | - bash promote-validator.sh + ./promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done # shellcheck disable=SC2016 - bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' # shellcheck disable=SC2016 - bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - name: Gather logs on failure if: ${{ failure() }} @@ -69,7 +71,7 @@ jobs: journalctl -ex | grep cheqd python-integration-tests: - name: "Python-based Cosmos and identity tests" + name: "Python based Cosmos and identity tests" runs-on: ubuntu-latest steps: diff --git a/tests/e2e-complex/deb-install/promote-validator.sh b/tests/e2e-complex/deb-install/promote-validator.sh index 6f5bc17df..e2b40e45f 100755 --- a/tests/e2e-complex/deb-install/promote-validator.sh +++ b/tests/e2e-complex/deb-install/promote-validator.sh @@ -13,7 +13,9 @@ sudo -u cheqd cheqd-noded keys add node5-operator --keyring-backend "test" OP5_ADDRESS=$(sudo -u cheqd cheqd-noded keys list --keyring-backend "test"| sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') NODE5_PUBKEY=$(sudo -u cheqd cheqd-noded tendermint show-validator | sed 's/\r//g') + # Send tokens from operator0 cheqd-noded tx bank send "${OP0_ADDRESS}" "${OP5_ADDRESS}" 1100000000000000ncheq --chain-id cheqd --fees 5000000ncheq --node "http://localhost:26657" -y --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" + # Send promote validator from operator5 sudo -u cheqd cheqd-noded tx staking create-validator --amount 1000000000000000ncheq --from node5-operator --chain-id cheqd --min-self-delegation="1" --gas-prices="25ncheq" --pubkey "${NODE5_PUBKEY}" --commission-max-change-rate="0.02" --commission-max-rate="0.02" --commission-rate="0.01" --gas 500000 --node "http://localhost:26657" -y --keyring-backend "test" From 0c1aa4f67666d67b74df184332760b059dc412e4 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 01:57:03 +0100 Subject: [PATCH 093/141] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 053b314ee..71fd974b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,8 @@ jobs: VERSION: ${{ inputs.VERSION }} steps: + - uses: actions/checkout@v3 + - name: Download Debian package uses: actions/download-artifact@v3 with: @@ -37,8 +39,6 @@ jobs: - name: Load node Docker image run: docker load -i cheqd-node-image.tar - - uses: actions/checkout@v3 - - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | From 37b56db5716a424d27efa1e578b3066b2c677414 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 02:00:39 +0100 Subject: [PATCH 094/141] Update test.yml --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71fd974b9..c8fbce365 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,8 +73,11 @@ jobs: python-integration-tests: name: "Python based Cosmos and identity tests" runs-on: ubuntu-latest + needs: test-new-node-setup steps: + - uses: actions/checkout@v3 + - name: Load node binary artifact uses: actions/download-artifact@v3 with: @@ -92,8 +95,6 @@ jobs: - name: Load node Docker image run: docker load -i cheqd-node-image.tar - - uses: actions/checkout@v3 - - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | @@ -133,8 +134,11 @@ jobs: bash-integration-tests: name: "Bash-based identity tests" runs-on: ubuntu-latest + needs: test-new-node-setup steps: + - uses: actions/checkout@v3 + - name: Load binary artifact uses: actions/download-artifact@v3 with: @@ -152,9 +156,6 @@ jobs: - name: Load node image run: docker load -i cheqd-node-image.tar - - name: Check out - uses: actions/checkout@v3 - - name: Set up 4 validators + 2 observers node docker pool working-directory: ./docker/localnet run: | @@ -177,6 +178,7 @@ jobs: node-upgrade-test: name: "Run positive case for upgrade" runs-on: ubuntu-latest + needs: test-new-node-setup steps: - uses: actions/checkout@v3 From 33a4a6ee9071f8ad7b1ed598336c7fbd6c1a03ea Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 02:21:42 +0100 Subject: [PATCH 095/141] Update build.yml --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b82617ece..de3ece922 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,6 +151,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to fetch version - name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint # TODO: Get rid of UID and GID @@ -159,7 +161,7 @@ jobs: - name: Build cheqd-node Docker image with 'node-start' as entrypoint run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . - - name: Save and store cheqd-cli + - name: Save cheqd-cli Docker image run: docker save -o cheqd-cli-image.tar cheqd-cli - name: Store cheqd-cli artifact @@ -168,7 +170,7 @@ jobs: name: cheqd-cli-image.tar path: cheqd-cli-image.tar - - name: Save cheqd-node + - name: Save cheqd-node Docker image run: docker save -o cheqd-node-image.tar cheqd-node - name: Store cheqd-node artifact From da4acbcd6ce155bdada891f591343e4a6f4fe53c Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 02:25:27 +0100 Subject: [PATCH 096/141] Update test.yml --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8fbce365..57d0b5d2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,6 +51,7 @@ jobs: - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | + set -euxo pipefail ./add-observer.sh cheqd-noded status -n tcp://localhost:26677 2>&1 ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" @@ -58,6 +59,7 @@ jobs: - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | + set -euxo pipefail ./promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done # shellcheck disable=SC2016 From aea4392e0da13b03c69cf5504110c60a3bb4a564 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 02:41:36 +0100 Subject: [PATCH 097/141] Update test.yml --- .github/workflows/test.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57d0b5d2e..2a39b3bfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,19 +42,21 @@ jobs: - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | + set -euo pipefail bash gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - name: Check all Docker localnet nodes are active - run: bash tests/tools/wait-for-chain.sh + run: | + set -euo pipefail + bash tests/tools/wait-for-chain.sh - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | - set -euxo pipefail + set -euo pipefail ./add-observer.sh - cheqd-noded status -n tcp://localhost:26677 2>&1 - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"" + ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "Observer node is up"" - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install @@ -75,7 +77,6 @@ jobs: python-integration-tests: name: "Python based Cosmos and identity tests" runs-on: ubuntu-latest - needs: test-new-node-setup steps: - uses: actions/checkout@v3 @@ -136,7 +137,6 @@ jobs: bash-integration-tests: name: "Bash-based identity tests" runs-on: ubuntu-latest - needs: test-new-node-setup steps: - uses: actions/checkout@v3 @@ -180,7 +180,6 @@ jobs: node-upgrade-test: name: "Run positive case for upgrade" runs-on: ubuntu-latest - needs: test-new-node-setup steps: - uses: actions/checkout@v3 From 9dff0405a100335844c394af9faa7e62c9d7d8a5 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 03:32:08 +0100 Subject: [PATCH 098/141] Update test.yml --- .github/workflows/test.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a39b3bfc..bf1f4ba95 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,25 +49,25 @@ jobs: - name: Check all Docker localnet nodes are active run: | set -euo pipefail - bash tests/tools/wait-for-chain.sh + bash ./tests/tools/wait-for-chain.sh - name: Add an Observer node using Debian package working-directory: ./tests/e2e-complex/deb-install run: | set -euo pipefail - ./add-observer.sh - ./wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "Observer node is up"" + bash add-observer.sh + bash wait.sh "[[ $(cheqd-noded status -n 'tcp://localhost:26677' 2>&1 | wc -l) == 1 ]] && echo "Observer node is up"" - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | set -euxo pipefail - ./promote-validator.sh + bash promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' + bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' # shellcheck disable=SC2016 - ./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' + bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"' - name: Gather logs on failure if: ${{ failure() }} @@ -118,7 +118,7 @@ jobs: - name: Run cosmos-related tests working-directory: ./tests/e2e-pytest run: | - set -euxo pipefail + set -euo pipefail OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') export OP0_ADDRESS OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g') @@ -128,6 +128,7 @@ jobs: - name: Run identity-related tests # TODO: Move into separate stage? working-directory: ./tests/e2e-pytest run: | + set -euo pipefail OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g') export OP0_ADDRESS OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g') @@ -150,12 +151,12 @@ jobs: - name: Restore binary permissions run: sudo chmod +x /home/runner/.local/bin/cheqd-noded - - name: Download node image + - name: Download node Docker image uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar - - name: Load node image + - name: Load node Docker image run: docker load -i cheqd-node-image.tar - name: Set up 4 validators + 2 observers node docker pool @@ -184,15 +185,15 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Download cli image + - name: Download cheqd-cli Docker image uses: actions/download-artifact@v3 with: name: cheqd-cli-image.tar - - name: Load cli image + - name: Load cheqd-cli Docker image run: docker load -i cheqd-cli-image.tar - - name: Chown for current user + - name: Give current user ownership run: sudo chown "$USER":"$USER" . - name: Prepare nodes for checking upgrade From 4d47d2df00335d142969b0e6363cee68af5a82cd Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 04:02:09 +0100 Subject: [PATCH 099/141] Minor copyedits on Test workflow --- .github/workflows/test.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf1f4ba95..18eadef74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | - set -euxo pipefail + set -euo pipefail bash promote-validator.sh cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done # shellcheck disable=SC2016 @@ -104,18 +104,19 @@ jobs: bash gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - name: Wait for chain + - name: Check all Docker localnet nodes are active run: bash tests/tools/wait-for-chain.sh - - name: Set up test environment + - name: Setup Python environment working-directory: ./tests/e2e-pytest run: | + set -euo pipefail pip3 install -r requirements.txt >> /dev/null cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/cheqd/ cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/cheqd/ sudo chmod -R 755 /home/runner/cheqd/ - - name: Run cosmos-related tests + - name: Run Cosmos-related tests working-directory: ./tests/e2e-pytest run: | set -euo pipefail @@ -159,13 +160,13 @@ jobs: - name: Load node Docker image run: docker load -i cheqd-node-image.tar - - name: Set up 4 validators + 2 observers node docker pool + - name: Setup 4 Validators + 2 Observers Docker localnet working-directory: ./docker/localnet run: | bash gen-network-config.sh CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d - - name: Wait for chain + - name: Check all Docker localnet nodes are active run: bash ./tests/tools/wait-for-chain.sh - name: Import keys @@ -173,7 +174,7 @@ jobs: run: | bash import_keys.sh - - name: Set up and run tests + - name: Run tests working-directory: ./tests/e2e-bash run: | bash run_all.sh @@ -196,14 +197,14 @@ jobs: - name: Give current user ownership run: sudo chown "$USER":"$USER" . - - name: Prepare nodes for checking upgrade + - name: Prepare nodes for upgrade working-directory: ./tests/e2e-complex/upgrade run: bash prepare.sh - - name: Initiate the upgrade process + - name: Initiate upgrade working-directory: ./tests/e2e-complex/upgrade run: bash initiate_upgrade.sh - - name: Make the upgrade and check results + - name: Check for successful upgrade working-directory: ./tests/e2e-complex/upgrade run: bash upgrade_and_check.sh From 1f26075b2b6847083c1296d5d36fd8718014431f Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 04:06:19 +0100 Subject: [PATCH 100/141] lint --- .github/workflows/dispatch.yml | 16 +- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 311 +++++++++++++-------------------- 3 files changed, 139 insertions(+), 190 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 50eaff428..0e2566ae9 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,13 +7,13 @@ concurrency: jobs: - # call-lint: - # name: "Lint" - # uses: ./.github/workflows/lint.yml + call-lint: + name: "Lint" + uses: ./.github/workflows/lint.yml call-build: name: "Build" - # needs: call-lint + needs: call-lint uses: ./.github/workflows/build.yml call-test: @@ -22,3 +22,11 @@ jobs: uses: ./.github/workflows/test.yml with: VERSION: ${{ needs.call-build.outputs.VERSION }} + + call-release: + name: "Release" + needs: call-test + if: startsWith(github.ref, 'refs/tags/v') + uses: ./.github/workflows/release.yml + with: + VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9213558dd..331ed7ad1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -67,7 +67,7 @@ jobs: MULTI_STATUS: true VALIDATE_BASH: true - # VALIDATE_GITHUB_ACTIONS: true + VALIDATE_GITHUB_ACTIONS: true VALIDATE_JSON: true VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2638f7c89..68682e0e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,139 +3,107 @@ name: Release on: push: tags: - - "v[0-9]+.[0-9]+.[0-9]+" + - "v*" jobs: - wait-for-all-previous: - name: Wait for test and lint workflows + + build-binary: + name: Build binary runs-on: ubuntu-20.04 + outputs: + VERSION: ${{ steps.set-version.outputs.VERSION }} steps: - - name: Wait for all jobs finished on workflow Test and Lint - uses: lewagon/wait-on-check-action@v1.0.0 + - name: Set up Go 1.17 + uses: actions/setup-go@v2 with: - ref: ${{ github.sha }} - running-workflow-name: 'Wait for test and lint workflows' - repo-token: ${{ secrets.GITHUB_TOKEN }} - wait-interval: 30 - - # ToDo: Get rid of it while moving test images to volumes - # This duplicating is needed because we have to pass GID and UID params - # while building docker images for tests - build-node-images: - name: Build cheqd-node and cheqd-cli images - runs-on: ubuntu-20.04 - needs: wait-for-all-previous - steps: + go-version: 1.17 + + - name: Get Go protoc compiler plugins + env: + GOLANG_PROTOBUF_VERSION: 1.3.5 + GOGO_PROTOBUF_VERSION: 1.3.2 + GRPC_GATEWAY_VERSION: 1.14.7 + # Taken from: tendermintdev/sdk-proto-gen:v0.2 + run: | + go get \ + github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ + github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ + github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest + + - name: Install buf + env: + PREFIX: "/usr/local" + VERSION: "1.0.0-rc8" + run: | + curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ + sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 + - uses: actions/checkout@v2 with: fetch-depth: 0 # Required to fetch version - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint - run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - - - name: Build cheqd-node with 'node-start' as entrypoint - run: docker build --target node -t cheqd-node -f docker/Dockerfile . - - - name: Save cheqd-cli - run: docker save -o cheqd-cli-image.tar cheqd-cli - - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-cli-image.tar - path: cheqd-cli-image.tar + - name: Build + run: | + make proto-gen build - - name: Store cheqd-node artifact + - name: Store artifact uses: actions/upload-artifact@v2 with: - name: cheqd-node-image.tar - path: cheqd-node-image.tar - - pre-release: - name: Pre-release - runs-on: ubuntu-20.04 - environment: Pre-Release - needs: build-node-images - outputs: - RCVERSION: ${{ steps.set-version.outputs.RCVERSION }} - steps: - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 - with: - workflow: test.yml name: cheqd-noded + path: build/cheqd-noded - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Set RC version + - name: Set version id: set-version run: | - VERSION=$(./cheqd-noded version 2>&1) - echo "::set-output name=RCVERSION::$VERSION-rc" + VERSION=$(build/cheqd-noded version 2>&1) + echo "::set-output name=VERSION::$VERSION" - push-rc-images: - name: Push RC images + build-tar-package: + name: Build tar package runs-on: ubuntu-20.04 - needs: pre-release + needs: build-binary env: - RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} - REGISTRY: ghcr.io + VERSION: ${{ needs.build-binary.outputs.VERSION }} steps: - - name: Get cheqd-cli image from tests - uses: actions/download-artifact@v2 - with: - name: cheqd-cli-image.tar + - uses: actions/checkout@v2 - - name: Get cheqd-node image from tests + - name: Load binary artifact uses: actions/download-artifact@v2 with: - name: cheqd-node-image.tar - - - name: Load cli image - run: docker load -i cheqd-cli-image.tar - - - name: Load node image - run: docker load -i cheqd-node-image.tar + name: cheqd-noded - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded - - name: Push cheqd-node image + - name: Build tar + working-directory: ./build-tools run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker push ghcr.io/${{ github.repository }}:${{ env.RCVERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:latest + ./build-tar.sh "../cheqd-noded" - - name: Push cheqd-cli image - run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RCVERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + - name: Store tar package artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - push-rc-debs: - name: Push RC packages + build-deb-package: + name: Build Debian package runs-on: ubuntu-20.04 - needs: pre-release + needs: [ build-binary ] env: - RCVERSION: ${{ needs.pre-release.outputs.RCVERSION }} + VERSION: ${{ needs.build-binary.outputs.VERSION }} steps: - uses: actions/checkout@v2 - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 + - name: Load binary artifact + uses: actions/download-artifact@v2 with: - workflow: test.yml name: cheqd-noded + - name: Restore binary permissions run: sudo chmod +x cheqd-noded @@ -144,121 +112,75 @@ jobs: sudo apt-get install ruby ruby-dev rubygems build-essential sudo gem install --no-document fpm - - name: Build RC deb + - name: Build deb working-directory: ./build-tools run: | - ./build-deb.sh "../cheqd-noded" "${{ env.RCVERSION }}" + ./build-deb.sh "../cheqd-noded" - - name: Store RC deb package artifact + - name: Store Debian package artifact uses: actions/upload-artifact@v2 with: - name: cheqd-node_${{ env.RCVERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" "${{ env.RCVERSION }}" - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" - prerelease: true - draft: true - title: "v${{ env.RCVERSION }}" - files: | - build-tools/output/cheqd-node_${{ env.RCVERSION }}_amd64.deb - build-tools/output/cheqd-node_${{ env.RCVERSION }}.tar.gz - - release: - name: Release - runs-on: ubuntu-20.04 - environment: Release - needs: [ push-rc-debs, push-rc-images] - outputs: - VERSION: ${{ steps.set-version.outputs.VERSION }} - steps: - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 - with: - workflow: test.yml - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Set release version - id: set-version - run: | - VERSION=$(./cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" + name: cheqd-node_${{ env.VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - push-release-debs: - name: Push release packages + build-node-images: + name: Build cheqd-node and cheqd-cli images runs-on: ubuntu-20.04 - needs: release - env: - VERSION: ${{ needs.release.outputs.VERSION }} steps: - uses: actions/checkout@v2 - - - name: Get artifact from tests - uses: dawidd6/action-download-artifact@v2 with: - workflow: test.yml - name: cheqd-noded + fetch-depth: 0 # Required to fetch version - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded + - name: Build cheqd-cli with 'cheqd-noded' as entrypoint + run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - - name: Install fpm - run: | - sudo apt-get install ruby ruby-dev rubygems build-essential - sudo gem install --no-document fpm + - name: Build cheqd-node with 'node-start' as entrypoint + run: docker build --target node -t cheqd-node -f docker/Dockerfile . - - name: Build release deb - working-directory: ./build-tools - run: | - ./build-deb.sh "../cheqd-noded" + - name: Save cheqd-cli + run: docker save -o cheqd-cli-image.tar cheqd-cli - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" + - name: Save cheqd-node + run: docker save -o cheqd-node-image.tar cheqd-node - - uses: "marvinpinto/action-automatic-releases@latest" + - name: Store cheqd-cli artifact + uses: actions/upload-artifact@v2 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" - prerelease: true - title: "v${{ env.VERSION }}" - files: | - build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + name: cheqd-cli-image.tar + path: cheqd-cli-image.tar + + - name: Store cheqd-node artifact + uses: actions/upload-artifact@v2 + with: + name: cheqd-node-image.tar + path: cheqd-node-image.tar - push-release-images: - name: Push release images - runs-on: ubuntu-20.04 - needs: release + publish: + name: "Publish images and release" + # Reference to workflow-setup job is required to access its various outputs. + needs: [ build-binary, build-node-images, build-deb-package, build-tar-package ] + runs-on: ubuntu-latest env: - VERSION: ${{ needs.release.outputs.VERSION }} + VERSION: ${{ needs.build-binary.outputs.VERSION }} REGISTRY: ghcr.io steps: - - name: Get cheqd-cli image from tests + - name: Git checkout + uses: actions/checkout@v2 + + - name: Download cheqd-cli image uses: actions/download-artifact@v2 with: name: cheqd-cli-image.tar - - name: Get cheqd-node image from tests + - name: Download cheqd-node image uses: actions/download-artifact@v2 with: name: cheqd-node-image.tar - - name: Load cli image + - name: Load cheqd-cli image run: docker load -i cheqd-cli-image.tar - - name: Load node image + - name: Load cheqd-node image run: docker load -i cheqd-node-image.tar - name: Log in to the Container registry @@ -271,13 +193,32 @@ jobs: - name: Push cheqd-node image run: | docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + + - name: Download deb + uses: actions/download-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}_amd64.deb + + - name: Download tar + uses: actions/download-artifact@v2 + with: + name: cheqd-node_${{ env.VERSION }}.tar.gz + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" + prerelease: true + files: | + cheqd-node_${{ env.VERSION }}_amd64.deb + cheqd-node_${{ env.VERSION }}.tar.gz From 46c85f17b7f4698edb1b465982c74506f6eff6d1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 04:06:59 +0100 Subject: [PATCH 101/141] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 331ed7ad1..ee34ed66a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -72,6 +72,6 @@ jobs: VALIDATE_MARKDOWN: true VALIDATE_OPENAPI: true # VALIDATE_PROTOBUF: true - VALIDATE_PYTHON_PYtrue + VALIDATE_PYTHON_PYLINT: true VALIDATE_XML: true VALIDATE_YAML: true From d5d4678ae67d841c0e0c2662b5f43106d2430892 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 04:15:29 +0100 Subject: [PATCH 102/141] Lint --- .github/workflows/dispatch.yml | 2 - .github/workflows/release.yml | 187 ++++++++------------------------- 2 files changed, 42 insertions(+), 147 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 0e2566ae9..7f5f859b6 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -28,5 +28,3 @@ jobs: needs: call-test if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml - with: - VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68682e0e3..125e689b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,164 +1,70 @@ -name: Release - -on: - push: - tags: - - "v*" +name: "Release" +on: workflow_call +defaults: + run: + shell: bash jobs: - build-binary: - name: Build binary - runs-on: ubuntu-20.04 - outputs: - VERSION: ${{ steps.set-version.outputs.VERSION }} - steps: - - name: Set up Go 1.17 - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Get Go protoc compiler plugins - env: - GOLANG_PROTOBUF_VERSION: 1.3.5 - GOGO_PROTOBUF_VERSION: 1.3.2 - GRPC_GATEWAY_VERSION: 1.14.7 - # Taken from: tendermintdev/sdk-proto-gen:v0.2 - run: | - go get \ - github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ - github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ - github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest - - - name: Install buf - env: - PREFIX: "/usr/local" - VERSION: "1.0.0-rc8" - run: | - curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ - sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 - - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build - run: | - make proto-gen build - - - name: Store artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-noded - path: build/cheqd-noded - - - name: Set version - id: set-version - run: | - VERSION=$(build/cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" - - build-tar-package: - name: Build tar package - runs-on: ubuntu-20.04 - needs: build-binary + create-release: + name: "Publish images and release" + runs-on: ubuntu-latest env: VERSION: ${{ needs.build-binary.outputs.VERSION }} + REGISTRY: ghcr.io steps: - - uses: actions/checkout@v2 + - name: Git checkout + uses: actions/checkout@v2 - - name: Load binary artifact + - name: Download cheqd-cli image uses: actions/download-artifact@v2 with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Build tar - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" + name: cheqd-cli-image.tar - - name: Store tar package artifact - uses: actions/upload-artifact@v2 + - name: Download cheqd-node image + uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + name: cheqd-node-image.tar - build-deb-package: - name: Build Debian package - runs-on: ubuntu-20.04 - needs: [ build-binary ] - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - steps: - - uses: actions/checkout@v2 + - name: Load cheqd-cli image + run: docker load -i cheqd-cli-image.tar - - name: Load binary artifact - uses: actions/download-artifact@v2 - with: - name: cheqd-noded + - name: Load cheqd-node image + run: docker load -i cheqd-node-image.tar - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Install fpm + - name: Push cheqd-node image run: | - sudo apt-get install ruby ruby-dev rubygems build-essential - sudo gem install --no-document fpm + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:latest + docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository }}:latest - - name: Build deb - working-directory: ./build-tools + - name: Push cheqd-cli image run: | - ./build-deb.sh "../cheqd-noded" + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - - name: Store Debian package artifact - uses: actions/upload-artifact@v2 + - name: Download deb + uses: actions/download-artifact@v2 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - - build-node-images: - name: Build cheqd-node and cheqd-cli images - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required to fetch version - - - name: Build cheqd-cli with 'cheqd-noded' as entrypoint - run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - - - name: Build cheqd-node with 'node-start' as entrypoint - run: docker build --target node -t cheqd-node -f docker/Dockerfile . - - - name: Save cheqd-cli - run: docker save -o cheqd-cli-image.tar cheqd-cli - - - name: Save cheqd-node - run: docker save -o cheqd-node-image.tar cheqd-node - - name: Store cheqd-cli artifact - uses: actions/upload-artifact@v2 - with: - name: cheqd-cli-image.tar - path: cheqd-cli-image.tar - - - name: Store cheqd-node artifact - uses: actions/upload-artifact@v2 + - name: Download tar + uses: actions/download-artifact@v2 with: - name: cheqd-node-image.tar - path: cheqd-node-image.tar + name: cheqd-node_${{ env.VERSION }}.tar.gz - publish: + publish-docker-image: name: "Publish images and release" - # Reference to workflow-setup job is required to access its various outputs. - needs: [ build-binary, build-node-images, build-deb-package, build-tar-package ] runs-on: ubuntu-latest env: VERSION: ${{ needs.build-binary.outputs.VERSION }} @@ -213,12 +119,3 @@ jobs: uses: actions/download-artifact@v2 with: name: cheqd-node_${{ env.VERSION }}.tar.gz - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" - prerelease: true - files: | - cheqd-node_${{ env.VERSION }}_amd64.deb - cheqd-node_${{ env.VERSION }}.tar.gz From b95de2fec107dea9f22116b12787454a6b9e579e Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Sat, 9 Apr 2022 04:31:29 +0100 Subject: [PATCH 103/141] Save --- .github/workflows/dispatch.yml | 2 ++ .github/workflows/release.yml | 64 +++++++++------------------------- 2 files changed, 19 insertions(+), 47 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 7f5f859b6..fe4df8b52 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -28,3 +28,5 @@ jobs: needs: call-test if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml + with: + BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 125e689b2..ca6ce37c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,10 @@ name: "Release" -on: workflow_call +on: + workflow_call: + inputs: + BUILD_VERSION: + description: "Build version number" + type: string defaults: run: shell: bash @@ -7,67 +12,32 @@ defaults: jobs: create-release: - name: "Publish images and release" + name: "Create release and publish" runs-on: ubuntu-latest + outputs: + VERSION: env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} REGISTRY: ghcr.io + steps: - - name: Git checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Download cheqd-cli image - uses: actions/download-artifact@v2 + - name: Download tarball package + uses: actions/download-artifact@v3 with: - name: cheqd-cli-image.tar + name: cheqd-node_${{ inputs.VERSION }}.tar.gz - - name: Download cheqd-node image - uses: actions/download-artifact@v2 - with: - name: cheqd-node-image.tar - - - name: Load cheqd-cli image - run: docker load -i cheqd-cli-image.tar - - - name: Load cheqd-node image - run: docker load -i cheqd-node-image.tar - - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push cheqd-node image - run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository }}:latest - - - name: Push cheqd-cli image - run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - - - name: Download deb - uses: actions/download-artifact@v2 + - name: Download Debian package + uses: actions/download-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb - - name: Download tar - uses: actions/download-artifact@v2 - with: - name: cheqd-node_${{ env.VERSION }}.tar.gz + publish-docker-image: name: "Publish images and release" runs-on: ubuntu-latest env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} REGISTRY: ghcr.io steps: - name: Git checkout From df69e31ddd4d8cd0b9103abdf312956c5474bc8b Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 12:14:20 +0100 Subject: [PATCH 104/141] Fixed chain version number --- docker/persistent-chains/docker-compose.env | 2 +- tests/e2e-pytest/helpers.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/persistent-chains/docker-compose.env b/docker/persistent-chains/docker-compose.env index 151b8092d..c147e8b63 100644 --- a/docker/persistent-chains/docker-compose.env +++ b/docker/persistent-chains/docker-compose.env @@ -13,7 +13,7 @@ CHEQD_NETWORK="mainnet" # Define cheqd-noded software release version # Current MAINNET recommended version: v0.5.0 # Current TESTNET recommended version: v0.5.0 -CHEQD_NODE_VERSION="0.4.1" +CHEQD_NODE_VERSION="0.5.0" ############################################################### diff --git a/tests/e2e-pytest/helpers.py b/tests/e2e-pytest/helpers.py index 617a284fa..d868dc137 100644 --- a/tests/e2e-pytest/helpers.py +++ b/tests/e2e-pytest/helpers.py @@ -12,11 +12,11 @@ ENCODING = "utf-8" READ_BUFFER = 60000 -TEST_NET_NETWORK = "cheqd-testnet-2" +TEST_NET_NETWORK = "cheqd-testnet-4" LOCAL_NET_NETWORK = "cheqd" -TEST_NET_NODE_TCP = "--node 'tcp://rpc.cheqd.network:443'" +TEST_NET_NODE_TCP = "--node tcp://rpc.cheqd.network:443" TEST_NET_NODE_HTTP = "--node https://rpc.cheqd.network/" -LOCAL_NET_NODE_TCP = "--node 'tcp://localhost:26657'" +LOCAL_NET_NODE_TCP = "--node tcp://localhost:26657" LOCAL_NET_NODE_HTTP = "--node http://localhost:26657/" TEST_NET_DESTINATION = f"{TEST_NET_NODE_TCP} --chain-id 'cheqd-testnet-4'" TEST_NET_DESTINATION_HTTP = f"{TEST_NET_NODE_HTTP} --chain-id 'cheqd-testnet-4'" From f16b12c504c56db0fb5e9b7aea9be9e37194415e Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 12:14:32 +0100 Subject: [PATCH 105/141] Version number --- .github/workflows/dispatch.yml | 2 +- .github/workflows/release.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index fe4df8b52..ec7596908 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -29,4 +29,4 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file + BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca6ce37c0..ae34e6e3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,12 +25,12 @@ jobs: - name: Download tarball package uses: actions/download-artifact@v3 with: - name: cheqd-node_${{ inputs.VERSION }}.tar.gz + name: cheqd-node_${{ inputs.BUILD_VERSION }}.tar.gz - name: Download Debian package uses: actions/download-artifact@v3 with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.BUILD_VERSION }}_amd64.deb From c9f53a9e879d77758ea4abdda614f9f28828be6b Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 17:04:40 +0100 Subject: [PATCH 106/141] build(tooling): DEV-1237 Fix issues with build and test workflows (#309) * Deactivate lint and release workflows * Remove set pipefail for workflow * Use script to check for validator status instead of inline GitHub Actions * Change node to localhost Co-authored-by: Andrew Nikitin --- .github/workflows/dispatch.yml | 22 +++++++++---------- .github/workflows/test.yml | 11 +++++----- .../deb-install/check_promotion.sh | 13 +++++++++++ 3 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 tests/e2e-complex/deb-install/check_promotion.sh diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index ec7596908..be87e4314 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,13 +7,13 @@ concurrency: jobs: - call-lint: - name: "Lint" - uses: ./.github/workflows/lint.yml + # call-lint: + # name: "Lint" + # uses: ./.github/workflows/lint.yml call-build: name: "Build" - needs: call-lint + # needs: call-lint uses: ./.github/workflows/build.yml call-test: @@ -23,10 +23,10 @@ jobs: with: VERSION: ${{ needs.call-build.outputs.VERSION }} - call-release: - name: "Release" - needs: call-test - if: startsWith(github.ref, 'refs/tags/v') - uses: ./.github/workflows/release.yml - with: - BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} + # call-release: + # name: "Release" + # needs: call-test + # if: startsWith(github.ref, 'refs/tags/v') + # uses: ./.github/workflows/release.yml + # with: + # BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 18eadef74..341cd7d33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,9 +61,8 @@ jobs: - name: Promote Observer to Validator working-directory: ./tests/e2e-complex/deb-install run: | - set -euo pipefail bash promote-validator.sh - cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' "$1" | while read -r x; do [[ "BOND_STATUS_BONDED" == "$x" ]] && echo "Validator's status is bonded!" || exit 1 ; done + bash check_promotion.sh # shellcheck disable=SC2016 bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' # shellcheck disable=SC2016 @@ -112,9 +111,9 @@ jobs: run: | set -euo pipefail pip3 install -r requirements.txt >> /dev/null - cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/cheqd/ - cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/cheqd/ - sudo chmod -R 755 /home/runner/cheqd/ + cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode/ + cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode/ + sudo chmod -R 777 /home/runner/ - name: Run Cosmos-related tests working-directory: ./tests/e2e-pytest @@ -185,6 +184,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Download cheqd-cli Docker image uses: actions/download-artifact@v3 diff --git a/tests/e2e-complex/deb-install/check_promotion.sh b/tests/e2e-complex/deb-install/check_promotion.sh new file mode 100644 index 000000000..c77aadfdb --- /dev/null +++ b/tests/e2e-complex/deb-install/check_promotion.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euox pipefail + +all_validators_cmd='cheqd-noded query staking validators --node http://localhost:26657' + +amount_bonded="$(${all_validators_cmd} | grep BOND_STATUS_BONDED | wc -l | xargs)" +amount_all="$(${all_validators_cmd} | grep status | wc -l | xargs)" + +if [ "${amount_all}" != "${amount_bonded}" ]; +then + exit 1 +fi \ No newline at end of file From e234ac8ab418ffb94e9a4b590088a8ecfb7f20af Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 18:20:39 +0100 Subject: [PATCH 107/141] Testing new release pipeline for lint --- .github/workflows/dispatch.yml | 32 ++++++------- .github/workflows/release.yml | 88 +++++++++++++++++++++++----------- docker/Dockerfile | 6 +++ 3 files changed, 82 insertions(+), 44 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index be87e4314..8c0a550a1 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,26 +7,26 @@ concurrency: jobs: - # call-lint: - # name: "Lint" - # uses: ./.github/workflows/lint.yml + call-lint: + name: "Lint" + uses: ./.github/workflows/lint.yml call-build: name: "Build" - # needs: call-lint + needs: call-lint uses: ./.github/workflows/build.yml - call-test: - name: "Test" + # call-test: + # name: "Test" + # needs: call-build + # uses: ./.github/workflows/test.yml + # with: + # VERSION: ${{ needs.call-build.outputs.VERSION }} + + call-release: + name: "Release" needs: call-build - uses: ./.github/workflows/test.yml + if: startsWith(github.ref, 'refs/tags/v') + uses: ./.github/workflows/release.yml with: - VERSION: ${{ needs.call-build.outputs.VERSION }} - - # call-release: - # name: "Release" - # needs: call-test - # if: startsWith(github.ref, 'refs/tags/v') - # uses: ./.github/workflows/release.yml - # with: - # BUILD_VERSION: ${{ needs.call-build.outputs.VERSION }} + RELEASE_VERSION: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae34e6e3c..2fcc483e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,54 +2,86 @@ name: "Release" on: workflow_call: inputs: - BUILD_VERSION: - description: "Build version number" + RELEASE_VERSION: + description: "Release version number from commit tag" type: string defaults: run: shell: bash + jobs: - create-release: - name: "Create release and publish" + release-packages: + name: "Create new pre-release and publish tar/Debian packages" runs-on: ubuntu-latest - outputs: - VERSION: - env: - REGISTRY: ghcr.io + permissions: + contents: write steps: - uses: actions/checkout@v3 - - name: Download tarball package + - name: Download node binary from build stage uses: actions/download-artifact@v3 with: - name: cheqd-node_${{ inputs.BUILD_VERSION }}.tar.gz + name: cheqd-noded - - name: Download Debian package - uses: actions/download-artifact@v3 + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + + - name: Install fpm + run: | + sudo apt-get install ruby ruby-dev rubygems build-essential + sudo gem install --no-document fpm + + - name: Build tarball package for release + working-directory: ./build-tools + run: | + ./build-tar.sh "../cheqd-noded" + + - name: Store tarball artifact for release + uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ inputs.BUILD_VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + - name: Build Debian package for release + working-directory: ./build-tools + run: | + ./build-deb.sh "../cheqd-noded" + - name: Store Debian package artifact for release + uses: actions/upload-artifact@v3 + with: + name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - publish-docker-image: - name: "Publish images and release" + - name: Publish new release + uses: ncipollo/release-action@v1 + with: + artifacts: "cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz,cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb" + artifactErrorsFailBuild: true + draft: true + prerelease: true + generateReleaseNotes: true + token: ${{ secrets.GITHUB_TOKEN }} + + release-docker-images: + name: "Publish Docker images for new version" runs-on: ubuntu-latest env: REGISTRY: ghcr.io + steps: - - name: Git checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Download cheqd-cli image - uses: actions/download-artifact@v2 + - name: Download cheqd-cli Docker image + uses: actions/download-artifact@v3 with: name: cheqd-cli-image.tar - - name: Download cheqd-node image - uses: actions/download-artifact@v2 + - name: Download cheqd-node Docker image + uses: actions/download-artifact@v3 with: name: cheqd-node-image.tar @@ -59,7 +91,7 @@ jobs: - name: Load cheqd-node image run: docker load -i cheqd-node-image.tar - - name: Log in to the Container registry + - name: Login to Container registry uses: docker/login-action@v1 with: registry: ${{ env.REGISTRY }} @@ -68,24 +100,24 @@ jobs: - name: Push cheqd-node image run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - name: Download deb uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - name: Download tar uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.VERSION }}.tar.gz + name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz diff --git a/docker/Dockerfile b/docker/Dockerfile index 81d6d7bf7..96be75059 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,6 +52,9 @@ RUN make proto-gen build ############################################################### FROM ubuntu:focal AS base +LABEL org.opencontainers.image.description "cheqd CLI Docker image" +LABEL org.opencontainers.image.source "https://github.com/cheqd/cheqd-node" +LABEL org.opencontainers.image.documentation "https://docs.cheqd.io/node" # Copy compiled node binary from Stage 1 COPY --from=builder /app/build/cheqd-noded /bin @@ -83,6 +86,9 @@ ENTRYPOINT [ "cheqd-noded" ] ############################################################### FROM base AS node +LABEL org.opencontainers.image.description "cheqd Node Docker image" +LABEL org.opencontainers.image.source "https://github.com/cheqd/cheqd-node" +LABEL org.opencontainers.image.documentation "https://docs.cheqd.io/node" # Set runner script COPY --chown=cheqd:cheqd docker/entrypoint.sh /bin/node-start From d92a102cbf63080bcde15bd2007f93b2644f116a Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 18:26:24 +0100 Subject: [PATCH 108/141] Fixing SC2126 Shellcheck failure --- .github/workflows/test.yml | 4 ++-- .../deb-install/{check_promotion.sh => check-promotion.sh} | 4 ++-- tests/e2e-complex/upgrade/common.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename tests/e2e-complex/deb-install/{check_promotion.sh => check-promotion.sh} (55%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 341cd7d33..e432ad8c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: working-directory: ./tests/e2e-complex/deb-install run: | bash promote-validator.sh - bash check_promotion.sh + bash check-promotion.sh # shellcheck disable=SC2016 bash wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"' # shellcheck disable=SC2016 @@ -113,7 +113,7 @@ jobs: pip3 install -r requirements.txt >> /dev/null cp -Rf "${NODE_CONFIGS_BASE}"/validator-0/. /home/runner/.cheqdnode/ cp -Rf "${NODE_CONFIGS_BASE}"/validator-1/. /home/runner/.cheqdnode/ - sudo chmod -R 777 /home/runner/ + sudo chmod -R 775 /home/runner/ - name: Run Cosmos-related tests working-directory: ./tests/e2e-pytest diff --git a/tests/e2e-complex/deb-install/check_promotion.sh b/tests/e2e-complex/deb-install/check-promotion.sh similarity index 55% rename from tests/e2e-complex/deb-install/check_promotion.sh rename to tests/e2e-complex/deb-install/check-promotion.sh index c77aadfdb..ba710cd5e 100644 --- a/tests/e2e-complex/deb-install/check_promotion.sh +++ b/tests/e2e-complex/deb-install/check-promotion.sh @@ -4,8 +4,8 @@ set -euox pipefail all_validators_cmd='cheqd-noded query staking validators --node http://localhost:26657' -amount_bonded="$(${all_validators_cmd} | grep BOND_STATUS_BONDED | wc -l | xargs)" -amount_all="$(${all_validators_cmd} | grep status | wc -l | xargs)" +amount_bonded="$(${all_validators_cmd} | grep -c BOND_STATUS_BONDED | xargs)" +amount_all="$(${all_validators_cmd} | grep -c status | xargs)" if [ "${amount_all}" != "${amount_bonded}" ]; then diff --git a/tests/e2e-complex/upgrade/common.sh b/tests/e2e-complex/upgrade/common.sh index d7de40875..e0aeb1221 100644 --- a/tests/e2e-complex/upgrade/common.sh +++ b/tests/e2e-complex/upgrade/common.sh @@ -87,7 +87,7 @@ function local_client_tx () { } function make_777 () { - sudo chmod -R 777 node_configs + sudo chmod -R 775 node_configs } From 64da6795724cb222c18857d74d6ba5ee4515b8e3 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 18:37:04 +0100 Subject: [PATCH 109/141] Test releasing stuff --- tests/e2e-complex/upgrade/common.sh | 2 +- tests/e2e-complex/upgrade/upgrade_and_check.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e-complex/upgrade/common.sh b/tests/e2e-complex/upgrade/common.sh index e0aeb1221..884274760 100644 --- a/tests/e2e-complex/upgrade/common.sh +++ b/tests/e2e-complex/upgrade/common.sh @@ -86,7 +86,7 @@ function local_client_tx () { cheqd_noded_docker "$@" --home node_configs/client/.cheqdnode/ --keyring-backend test } -function make_777 () { +function make_775 () { sudo chmod -R 775 node_configs } diff --git a/tests/e2e-complex/upgrade/upgrade_and_check.sh b/tests/e2e-complex/upgrade/upgrade_and_check.sh index 8ec5589cc..9585faa1e 100755 --- a/tests/e2e-complex/upgrade/upgrade_and_check.sh +++ b/tests/e2e-complex/upgrade/upgrade_and_check.sh @@ -22,7 +22,7 @@ bash ../../tools/wait-for-chain.sh "$UPGRADE_HEIGHT" $((3 * VOTING_PERIOD)) docker_compose_down # Make all the data accessible -make_777 +make_775 # Start docker-compose with new base image on new version docker_compose_up "$CHEQD_IMAGE_TO" "$(pwd)" From c7243bc59676ae4c7e967d6fb8dbb922d32fcb10 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 18:51:54 +0100 Subject: [PATCH 110/141] Testing a different way to set release version --- .github/workflows/dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 8c0a550a1..7bf08a164 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -29,4 +29,4 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//} + RELEASE_VERSION: ${GITHUB_REF/refs\/tags\//} From c11e53e4e122c82627fac0e1851a7f3effa50819 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 19:09:30 +0100 Subject: [PATCH 111/141] Another test of release tag --- .github/workflows/dispatch.yml | 2 -- .github/workflows/release.yml | 45 +++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 7bf08a164..727eb6273 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -28,5 +28,3 @@ jobs: needs: call-build if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml - with: - RELEASE_VERSION: ${GITHUB_REF/refs\/tags\//} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fcc483e0..6bbd885cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,5 @@ name: "Release" -on: - workflow_call: - inputs: - RELEASE_VERSION: - description: "Release version number from commit tag" - type: string +on: workflow_call defaults: run: shell: bash @@ -12,11 +7,25 @@ defaults: jobs: + set-release-version: + name: "Set release version number from commit tag" + runs-on: ubuntu-latest + outputs: + RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} + + steps: + - name: Set version + id: set-version + run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//} + release-packages: name: "Create new pre-release and publish tar/Debian packages" runs-on: ubuntu-latest + needs: set-release-version permissions: contents: write + env: + RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 @@ -42,8 +51,8 @@ jobs: - name: Store tarball artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -53,13 +62,13 @@ jobs: - name: Store Debian package artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - name: Publish new release uses: ncipollo/release-action@v1 with: - artifacts: "cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz,cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb" + artifacts: "cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz,cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb" artifactErrorsFailBuild: true draft: true prerelease: true @@ -69,8 +78,10 @@ jobs: release-docker-images: name: "Publish Docker images for new version" runs-on: ubuntu-latest + needs: set-release-version env: REGISTRY: ghcr.io + RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 @@ -100,24 +111,24 @@ jobs: - name: Push cheqd-node image run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - name: Download deb uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - name: Download tar uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz From 5bcd77dc7f39e0efc23bd0b2b646189c1a2b2df0 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 19:17:26 +0100 Subject: [PATCH 112/141] Fixing SC2086 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6bbd885cd..9f5328e22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Set version id: set-version - run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF/refs\/tags\//} + run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" release-packages: name: "Create new pre-release and publish tar/Debian packages" From e9f522b4dd9dd0a44b04d1c6feb5e9eef7961cc8 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 19:43:51 +0100 Subject: [PATCH 113/141] Last try with ncipollo --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f5328e22..e1deb9433 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + path: releases/{{ env.RELEASE_VERSION }}/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -63,16 +63,17 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + path: releases/{{ env.RELEASE_VERSION }}/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - name: Publish new release uses: ncipollo/release-action@v1 with: - artifacts: "cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz,cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb" + artifacts: "releases/{{ env.RELEASE_VERSION }}/**" artifactErrorsFailBuild: true draft: true prerelease: true generateReleaseNotes: true + replacesArtifacts: true token: ${{ secrets.GITHUB_TOKEN }} release-docker-images: From 22ddf5d9f10fd1f2755de3a396faa98bf2e59fed Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:07:42 +0100 Subject: [PATCH 114/141] I guess another last try? --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1deb9433..512f748ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - path: releases/{{ env.RELEASE_VERSION }}/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + path: releases/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -63,12 +63,12 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - path: releases/{{ env.RELEASE_VERSION }}/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + path: releases/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - name: Publish new release uses: ncipollo/release-action@v1 with: - artifacts: "releases/{{ env.RELEASE_VERSION }}/**" + artifacts: "releases/*" artifactErrorsFailBuild: true draft: true prerelease: true From 38c12464d1f6c1be9ded24ca12a84038bf1d95b4 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:34:46 +0100 Subject: [PATCH 115/141] Try different way of filtering --- .github/workflows/dispatch.yml | 17 +++++++++++++++-- .github/workflows/release.yml | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 727eb6273..738adcb9d 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -23,8 +23,21 @@ jobs: # with: # VERSION: ${{ needs.call-build.outputs.VERSION }} + # check-for-release-tag: + # name: "Check for release tag" + # needs: call-build + # if: startsWith(github.ref, 'refs/tags/v') + # run: + call-release: name: "Release" needs: call-build - if: startsWith(github.ref, 'refs/tags/v') - uses: ./.github/workflows/release.yml + + steps: + - name: "Check for release tag" + if: startsWith(github.ref, 'refs/tags/v') + run: echo "Release tag found. Will trigger Release workflow" + + - name: "Trigger release workflow" + if: ${{ success() }} + uses: ./.github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 512f748ca..25e5e8927 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,7 @@ jobs: set-release-version: name: "Set release version number from commit tag" + if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} From aa2d698dc10c3d2bc9173ca8617105230669aa45 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:35:52 +0100 Subject: [PATCH 116/141] Fix runs on --- .github/workflows/dispatch.yml | 3 ++- .github/workflows/release.yml | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 738adcb9d..866b5aa52 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -32,7 +32,8 @@ jobs: call-release: name: "Release" needs: call-build - + runs-on: ubuntu-latest + steps: - name: "Check for release tag" if: startsWith(github.ref, 'refs/tags/v') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25e5e8927..512f748ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,6 @@ jobs: set-release-version: name: "Set release version number from commit tag" - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest outputs: RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} From f95eb340be0c798b535db0c363a4727ec8a95f11 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:46:11 +0100 Subject: [PATCH 117/141] Update dispatch.yml --- .github/workflows/dispatch.yml | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 866b5aa52..e26c46d6c 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -11,10 +11,10 @@ jobs: name: "Lint" uses: ./.github/workflows/lint.yml - call-build: - name: "Build" - needs: call-lint - uses: ./.github/workflows/build.yml + # call-build: + # name: "Build" + # needs: call-lint + # uses: ./.github/workflows/build.yml # call-test: # name: "Test" @@ -23,22 +23,13 @@ jobs: # with: # VERSION: ${{ needs.call-build.outputs.VERSION }} - # check-for-release-tag: - # name: "Check for release tag" - # needs: call-build - # if: startsWith(github.ref, 'refs/tags/v') - # run: + check-for-release-tag: + name: "Check for release tag" + needs: call-lint + if: startsWith(github.ref, 'refs/tags/v') + run: echo "Release tag found. Will trigger Release workflow" call-release: name: "Release" - needs: call-build - runs-on: ubuntu-latest - - steps: - - name: "Check for release tag" - if: startsWith(github.ref, 'refs/tags/v') - run: echo "Release tag found. Will trigger Release workflow" - - - name: "Trigger release workflow" - if: ${{ success() }} - uses: ./.github/workflows/release.yml + needs: check-for-release-tag + uses: ./.github/workflows/release.yml From 4c0d9128e2bf658a61a382b2fd0929a73b239599 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:47:57 +0100 Subject: [PATCH 118/141] Update dispatch.yml --- .github/workflows/dispatch.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index e26c46d6c..e8abdc73a 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -26,8 +26,11 @@ jobs: check-for-release-tag: name: "Check for release tag" needs: call-lint + runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') - run: echo "Release tag found. Will trigger Release workflow" + + steps: + - run: echo "Release tag found. Will trigger Release workflow" call-release: name: "Release" From 5aae82dac849cf6a7e873f29ed598115ce8f28ff Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 20:52:28 +0100 Subject: [PATCH 119/141] Update dispatch.yml --- .github/workflows/dispatch.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index e8abdc73a..f32a9c5eb 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -11,26 +11,25 @@ jobs: name: "Lint" uses: ./.github/workflows/lint.yml - # call-build: - # name: "Build" - # needs: call-lint - # uses: ./.github/workflows/build.yml + call-build: + name: "Build" + needs: call-lint + uses: ./.github/workflows/build.yml - # call-test: - # name: "Test" - # needs: call-build - # uses: ./.github/workflows/test.yml - # with: - # VERSION: ${{ needs.call-build.outputs.VERSION }} + call-test: + name: "Test" + needs: call-build + uses: ./.github/workflows/test.yml + with: + VERSION: ${{ needs.call-build.outputs.VERSION }} check-for-release-tag: name: "Check for release tag" - needs: call-lint + needs: call-test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') - steps: - - run: echo "Release tag found. Will trigger Release workflow" + - run: echo "Release tag found. Will trigger Release workflow." call-release: name: "Release" From ba663722e0a1b945bfbcd680b0465a5a03f0d2e1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 21:09:39 +0100 Subject: [PATCH 120/141] Fixing 775 permissions --- .github/workflows/build.yml | 42 +++-------------------------- .github/workflows/dispatch.yml | 14 +++++----- tests/e2e-complex/upgrade/common.sh | 4 +-- 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de3ece922..4bceb685a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - name: Run Golang unit tests run: go test -v ./... - build-binary: + build-binary-and-packages: name: "Node binary" needs: go-unit-tests runs-on: ubuntu-latest @@ -80,25 +80,7 @@ jobs: run: | VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" - - build-tarball-package: - name: "Tarball package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - - steps: - - uses: actions/checkout@v3 - - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - + - name: Build tarball working-directory: ./build-tools run: | @@ -108,26 +90,8 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - build-debian-package: - name: "Debian package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - - steps: - - uses: actions/checkout@v3 + path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - name: Install fpm run: | sudo apt-get install ruby ruby-dev rubygems build-essential diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index f32a9c5eb..ed46e1c27 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -16,16 +16,16 @@ jobs: needs: call-lint uses: ./.github/workflows/build.yml - call-test: - name: "Test" - needs: call-build - uses: ./.github/workflows/test.yml - with: - VERSION: ${{ needs.call-build.outputs.VERSION }} + # call-test: + # name: "Test" + # needs: call-build + # uses: ./.github/workflows/test.yml + # with: + # VERSION: ${{ needs.call-build.outputs.VERSION }} check-for-release-tag: name: "Check for release tag" - needs: call-test + needs: call-build runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') steps: diff --git a/tests/e2e-complex/upgrade/common.sh b/tests/e2e-complex/upgrade/common.sh index 884274760..a473505dc 100644 --- a/tests/e2e-complex/upgrade/common.sh +++ b/tests/e2e-complex/upgrade/common.sh @@ -77,8 +77,8 @@ function docker_compose_down () { # Clean environment function clean_env () { - rm -rf node_configs - rm -f $FNAME_TXHASHES + sudo rm -rf node_configs + sudo rm -f $FNAME_TXHASHES } # Run command using local generated keys from node_configs/client From 754ff96a1d7314951edccffebfbcecee39ec3da1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 22:09:44 +0100 Subject: [PATCH 121/141] Setting release version differently --- .github/workflows/build.yml | 6 +++--- .github/workflows/release.yml | 34 ++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4bceb685a..04d8baf82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: outputs: VERSION: description: "Build version number" - value: ${{ jobs.build-binary.outputs.VERSION }} + value: ${{ jobs.build-packages.outputs.VERSION }} defaults: run: shell: bash @@ -25,7 +25,7 @@ jobs: - name: Run Golang unit tests run: go test -v ./... - build-binary-and-packages: + build-packages: name: "Node binary" needs: go-unit-tests runs-on: ubuntu-latest @@ -79,7 +79,7 @@ jobs: id: set-version run: | VERSION=$(build/cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" + echo "::set-output name=VERSION::$VERSION" >> "$GITHUB_ENV" - name: Build tarball working-directory: ./build-tools diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 512f748ca..8da2d07fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,29 +7,32 @@ defaults: jobs: - set-release-version: - name: "Set release version number from commit tag" - runs-on: ubuntu-latest - outputs: - RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} + # set-release-version: + # name: "Set release version number from commit tag" + # runs-on: ubuntu-latest + # # outputs: + # # RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} - steps: - - name: Set version - id: set-version - run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" + # steps: + # - name: Set version + # id: set-version + # run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" release-packages: name: "Create new pre-release and publish tar/Debian packages" runs-on: ubuntu-latest - needs: set-release-version + # needs: set-release-version permissions: contents: write - env: - RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} + # env: + # RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 + - name: Set release version + run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" + - name: Download node binary from build stage uses: actions/download-artifact@v3 with: @@ -79,14 +82,17 @@ jobs: release-docker-images: name: "Publish Docker images for new version" runs-on: ubuntu-latest - needs: set-release-version + # needs: set-release-version env: REGISTRY: ghcr.io - RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} + # RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 + - name: Set release version + run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" + - name: Download cheqd-cli Docker image uses: actions/download-artifact@v3 with: From 7aa5c71c17f0d1a3a893aa9d6cce6d42f305707a Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 22:22:20 +0100 Subject: [PATCH 122/141] Trigger build --- .github/workflows/build.yml | 10 +++++++++- .github/workflows/lint.yml | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04d8baf82..bf4d2b816 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,15 @@ jobs: run: | VERSION=$(build/cheqd-noded version 2>&1) echo "::set-output name=VERSION::$VERSION" >> "$GITHUB_ENV" - + + - name: Download node binary from build stage + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + - name: Build tarball working-directory: ./build-tools run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ee34ed66a..f39e2ac6d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Run 'set -euox pipefail' check run: bash ./.github/scripts/ensure_set_euox_pipefail.sh @@ -22,6 +23,7 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Run Markdown link check uses: gaurav-nelson/github-action-markdown-link-check@v1 with: @@ -37,6 +39,7 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: go-version: '1.17' From 8b84dd81a8709092b337aecd724d53f092c535d5 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 22:37:06 +0100 Subject: [PATCH 123/141] Trigger release --- .github/workflows/dispatch.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index ed46e1c27..f32a9c5eb 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -16,16 +16,16 @@ jobs: needs: call-lint uses: ./.github/workflows/build.yml - # call-test: - # name: "Test" - # needs: call-build - # uses: ./.github/workflows/test.yml - # with: - # VERSION: ${{ needs.call-build.outputs.VERSION }} + call-test: + name: "Test" + needs: call-build + uses: ./.github/workflows/test.yml + with: + VERSION: ${{ needs.call-build.outputs.VERSION }} check-for-release-tag: name: "Check for release tag" - needs: call-build + needs: call-test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') steps: From 2458ac8517f5983a22ddb74c187ab9edf5ccecda Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 22:58:22 +0100 Subject: [PATCH 124/141] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf4d2b816..6fe532041 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,8 +78,8 @@ jobs: - name: Set version number id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) - echo "::set-output name=VERSION::$VERSION" >> "$GITHUB_ENV" + VERSION=$(build/cheqd-noded version 2>&1) >> "$GITHUB_ENV" + echo ::set-output name=VERSION::"$VERSION" - name: Download node binary from build stage uses: actions/download-artifact@v3 From 417b621c793b269dc71982bcfec43d47aefd7d30 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Mon, 11 Apr 2022 23:13:21 +0100 Subject: [PATCH 125/141] Update build.yml --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fe532041..b1b301407 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,9 @@ jobs: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} - + env: + VERSION: ${{ steps.set-version.outputs.VERSION }} + steps: - uses: actions/setup-go@v3 with: @@ -78,7 +80,7 @@ jobs: - name: Set version number id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) >> "$GITHUB_ENV" + VERSION=$(build/cheqd-noded version 2>&1) echo ::set-output name=VERSION::"$VERSION" - name: Download node binary from build stage From 0d1035f76d893c06f34741c49b627c45e848e9fb Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 00:51:07 +0100 Subject: [PATCH 126/141] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1b301407..3013141e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} env: - VERSION: ${{ steps.set-version.outputs.VERSION }} + VERSION: ${{ needs.set-version.outputs.VERSION }} steps: - uses: actions/setup-go@v3 From b36c2abe86f0d27a9106ab7fbcabd23f021b98f8 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 00:54:32 +0100 Subject: [PATCH 127/141] Update build.yml --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3013141e6..1801f91c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,8 +31,6 @@ jobs: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} - env: - VERSION: ${{ needs.set-version.outputs.VERSION }} steps: - uses: actions/setup-go@v3 @@ -80,7 +78,7 @@ jobs: - name: Set version number id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) + VERSION=$(build/cheqd-noded version 2>&1) >> "$GITHUB_ENV" echo ::set-output name=VERSION::"$VERSION" - name: Download node binary from build stage From 5fc2d51e2ecac36f88de540354a9c472f3177451 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 01:11:01 +0100 Subject: [PATCH 128/141] Revert build.yml --- .github/workflows/build.yml | 46 +++++++++++++++++++++++++++++-------- .github/workflows/lint.yml | 4 ++-- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1801f91c0..14af6d422 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: outputs: VERSION: description: "Build version number" - value: ${{ jobs.build-packages.outputs.VERSION }} + value: ${{ jobs.build-binary.outputs.VERSION }} defaults: run: shell: bash @@ -25,7 +25,7 @@ jobs: - name: Run Golang unit tests run: go test -v ./... - build-packages: + build-binary: name: "Node binary" needs: go-unit-tests runs-on: ubuntu-latest @@ -78,10 +78,20 @@ jobs: - name: Set version number id: set-version run: | - VERSION=$(build/cheqd-noded version 2>&1) >> "$GITHUB_ENV" + VERSION=$(build/cheqd-noded version 2>&1) echo ::set-output name=VERSION::"$VERSION" - - name: Download node binary from build stage + build-tarball-package: + name: "Tarball package" + runs-on: ubuntu-latest + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + + steps: + - uses: actions/checkout@v3 + + - name: Load binary artifact uses: actions/download-artifact@v3 with: name: cheqd-noded @@ -93,29 +103,47 @@ jobs: working-directory: ./build-tools run: | ./build-tar.sh "../cheqd-noded" - + - name: Store tarball artifact uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz + + build-debian-package: + name: "Debian package" + runs-on: ubuntu-latest + needs: build-binary + env: + VERSION: ${{ needs.build-binary.outputs.VERSION }} + + steps: + - uses: actions/checkout@v3 + - name: Load binary artifact + uses: actions/download-artifact@v3 + with: + name: cheqd-noded + + - name: Restore binary permissions + run: sudo chmod +x cheqd-noded + - name: Install fpm run: | sudo apt-get install ruby ruby-dev rubygems build-essential sudo gem install --no-document fpm - + - name: Build Debian package working-directory: ./build-tools run: | ./build-deb.sh "../cheqd-noded" - + - name: Store Debian package artifact uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb - + build-docker-images: name: "Docker images" runs-on: ubuntu-latest diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f39e2ac6d..25ef01008 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,9 +31,9 @@ jobs: use-quiet-mode: 'yes' use-verbose-mode: 'yes' - # We can't use VALIDATE_GO from super linter because of this issue: - # https://github.com/github/super-linter/issues/143 go-lint: + # We can't use VALIDATE_GO from super linter because of this issue: + # https://github.com/github/super-linter/issues/143 name: "Golang" runs-on: ubuntu-latest From bb072d7625a0dbff1efd75c1abe7162305435db1 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 01:36:54 +0100 Subject: [PATCH 129/141] Update build.yml --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14af6d422..7d1b9f8ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,6 @@ jobs: build-binary: name: "Node binary" - needs: go-unit-tests runs-on: ubuntu-latest outputs: VERSION: ${{ steps.set-version.outputs.VERSION }} @@ -147,7 +146,6 @@ jobs: build-docker-images: name: "Docker images" runs-on: ubuntu-latest - needs: go-unit-tests steps: - uses: actions/checkout@v3 From c5d9c90c3e1fba7cee3916e99f316597ed204159 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 01:58:47 +0100 Subject: [PATCH 130/141] Release tagging --- .github/workflows/dispatch.yml | 9 ++++++- .github/workflows/release.yml | 46 +++++++++++++--------------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index f32a9c5eb..62bae316e 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -28,10 +28,17 @@ jobs: needs: call-test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') + outputs: + RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} + steps: - - run: echo "Release tag found. Will trigger Release workflow." + - name: Set release version + id: set-version + run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" call-release: name: "Release" needs: check-for-release-tag uses: ./.github/workflows/release.yml + with: + RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8da2d07fc..b947fec04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,10 @@ name: "Release" -on: workflow_call +on: + workflow_call: + inputs: + RELEASE_VERSION: + description: "Release version number" + type: string defaults: run: shell: bash @@ -7,21 +12,9 @@ defaults: jobs: - # set-release-version: - # name: "Set release version number from commit tag" - # runs-on: ubuntu-latest - # # outputs: - # # RELEASE_VERSION: ${{ steps.set-version.outputs.VERSION }} - - # steps: - # - name: Set version - # id: set-version - # run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" - release-packages: name: "Create new pre-release and publish tar/Debian packages" runs-on: ubuntu-latest - # needs: set-release-version permissions: contents: write # env: @@ -30,9 +23,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set release version - run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" - - name: Download node binary from build stage uses: actions/download-artifact@v3 with: @@ -54,8 +44,8 @@ jobs: - name: Store tarball artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - path: releases/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + path: releases/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -65,8 +55,8 @@ jobs: - name: Store Debian package artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - path: releases/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + path: releases/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - name: Publish new release uses: ncipollo/release-action@v1 @@ -90,8 +80,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set release version - run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" + # - name: Set release version + # run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" - name: Download cheqd-cli Docker image uses: actions/download-artifact@v3 @@ -118,24 +108,24 @@ jobs: - name: Push cheqd-node image run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - name: Download deb uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - name: Download tar uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz From d9e1555f647b6a06845d6e108cbb5fe322a45b7d Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 02:16:34 +0100 Subject: [PATCH 131/141] Fixed artifact path --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b947fec04..f36e70a01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz - path: releases/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -56,12 +56,12 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - path: releases/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - name: Publish new release uses: ncipollo/release-action@v1 with: - artifacts: "releases/*" + artifacts: "build-tools/output/*" artifactErrorsFailBuild: true draft: true prerelease: true From cc971e30171e1973f52481bdd17e51660450f0da Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 02:46:09 +0100 Subject: [PATCH 132/141] Switching release action --- .github/workflows/dispatch.yml | 4 ++-- .github/workflows/release.yml | 39 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 62bae316e..2f03f9f06 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -34,11 +34,11 @@ jobs: steps: - name: Set release version id: set-version - run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" + run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF##*/} call-release: name: "Release" needs: check-for-release-tag uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} \ No newline at end of file + RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f36e70a01..b737a43c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ defaults: jobs: release-packages: - name: "Create new pre-release and publish tar/Debian packages" + name: "Release tar/Debian packages" runs-on: ubuntu-latest permissions: contents: write @@ -22,6 +22,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to fetch version - name: Download node binary from build stage uses: actions/download-artifact@v3 @@ -44,8 +46,8 @@ jobs: - name: Store tarball artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -55,19 +57,18 @@ jobs: - name: Store Debian package artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb - path: build-tools/output/cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb - - name: Publish new release - uses: ncipollo/release-action@v1 + - uses: "marvinpinto/action-automatic-releases@latest" with: - artifacts: "build-tools/output/*" - artifactErrorsFailBuild: true - draft: true + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" prerelease: true - generateReleaseNotes: true - replacesArtifacts: true - token: ${{ secrets.GITHUB_TOKEN }} + draft: true + files: | + build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb + build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz release-docker-images: name: "Publish Docker images for new version" @@ -108,24 +109,24 @@ jobs: - name: Push cheqd-node image run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_NAME }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ inputs.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_NAME }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.GITHUB_REF_NAME }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ inputs.RELEASE_VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.GITHUB_REF_NAME }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - name: Download deb uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}_amd64.deb + name: cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb - name: Download tar uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ inputs.RELEASE_VERSION }}.tar.gz + name: cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz From 75d4904d88fe7dfc12a7cdb3c6015a4be9053251 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 02:51:37 +0100 Subject: [PATCH 133/141] Release tag --- .github/workflows/dispatch.yml | 29 +++++++++++++++-------------- .github/workflows/release.yml | 15 +++++++++------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 2f03f9f06..84f75d94c 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -23,22 +23,23 @@ jobs: with: VERSION: ${{ needs.call-build.outputs.VERSION }} - check-for-release-tag: - name: "Check for release tag" - needs: call-test - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - outputs: - RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} + # check-for-release-tag: + # name: "Check for release tag" + # needs: call-test + # runs-on: ubuntu-latest + # if: startsWith(github.ref, 'refs/tags/v') + # outputs: + # RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} - steps: - - name: Set release version - id: set-version - run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF##*/} + # steps: + # - name: Set release version + # id: set-version + # run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF##*/} call-release: name: "Release" - needs: check-for-release-tag + if: startsWith(github.ref, 'refs/tags/v') + # needs: check-for-release-tag uses: ./.github/workflows/release.yml - with: - RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} + # with: + # RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b737a43c6..b03a07651 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,11 @@ name: "Release" -on: - workflow_call: - inputs: - RELEASE_VERSION: - description: "Release version number" - type: string +on: workflow_call +# on: +# workflow_call: +# inputs: +# RELEASE_VERSION: +# description: "Release version number" +# type: string defaults: run: shell: bash @@ -80,6 +81,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required to fetch version # - name: Set release version # run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" From fb9cb173018b75da22d2792853fd00b717357b0d Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 02:53:15 +0100 Subject: [PATCH 134/141] Fixed condition --- .github/workflows/dispatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 84f75d94c..c8dcc4609 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -38,8 +38,8 @@ jobs: call-release: name: "Release" + needs: call-test if: startsWith(github.ref, 'refs/tags/v') - # needs: check-for-release-tag uses: ./.github/workflows/release.yml # with: # RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} From 13b4387000226dfcba0aaf748b89087a8098099a Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 03:12:33 +0100 Subject: [PATCH 135/141] Update release.yml --- .github/workflows/release.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b03a07651..3330177c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,8 +18,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - # env: - # RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} + env: + RELEASE_VERSION: ${{ env.GITHUB_REF_NAME }} steps: - uses: actions/checkout@v3 @@ -47,8 +47,8 @@ jobs: - name: Store tarball artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz + name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - name: Build Debian package for release working-directory: ./build-tools @@ -58,8 +58,8 @@ jobs: - name: Store Debian package artifact for release uses: actions/upload-artifact@v3 with: - name: cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb - path: build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb + name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - uses: "marvinpinto/action-automatic-releases@latest" with: @@ -68,8 +68,8 @@ jobs: prerelease: true draft: true files: | - build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb - build-tools/output/cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz + build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb + build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz release-docker-images: name: "Publish Docker images for new version" @@ -77,7 +77,7 @@ jobs: # needs: set-release-version env: REGISTRY: ghcr.io - # RELEASE_VERSION: ${{ needs.set-release-version.outputs.RELEASE_VERSION }} + RELEASE_VERSION: ${{ env.GITHUB_REF_NAME }} steps: - uses: actions/checkout@v3 @@ -112,24 +112,24 @@ jobs: - name: Push cheqd-node image run: | - docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_NAME }} + docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} docker tag cheqd-node ghcr.io/${{ github.repository }}:latest - docker push ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_NAME }} + docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository }}:latest - name: Push cheqd-cli image run: | - docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.GITHUB_REF_NAME }} + docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.GITHUB_REF_NAME }} + docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - name: Download deb uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.GITHUB_REF_NAME }}_amd64.deb + name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - name: Download tar uses: actions/download-artifact@v2 with: - name: cheqd-node_${{ env.GITHUB_REF_NAME }}.tar.gz + name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz From 5d5f84a55f507e3e1ce04b9a384632a191ac039a Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Tue, 12 Apr 2022 13:29:48 +0300 Subject: [PATCH 136/141] build(tooling): Fix release artifact version numbers * Deactivate lint and release workflows * Deactivate lint workflow dependency * [DEV-1096] Revert changes and fix pipelines Signed-off-by: Andrew Nikitin * [DEV-1096] Remove set pipefail for workflow Signed-off-by: Andrew Nikitin * [DEV-1096] add script instead of one command Signed-off-by: Andrew Nikitin * [DEV-1096] Change node to localhost Signed-off-by: Andrew Nikitin * [DEV-1096] Fix release pipelines Signed-off-by: Andrew Nikitin * [DEV-1096] fix release pipeline Signed-off-by: Andrew Nikitin * [DEV-1096] debug release Signed-off-by: Andrew Nikitin * [DEV-1096] Fix release tagging Signed-off-by: Andrew Nikitin Co-authored-by: Ankur Banerjee --- .github/workflows/build.yml | 1 - .github/workflows/dispatch.yml | 29 ++++++++++--------- .github/workflows/release.yml | 18 ++++++------ .../deb-install/check_promotion.sh | 13 +++++++++ 4 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 tests/e2e-complex/deb-install/check_promotion.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d1b9f8ed..f65b66834 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,6 @@ defaults: jobs: - go-unit-tests: name: "Golang unit tests" runs-on: ubuntu-latest diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index c8dcc4609..1e2e5885b 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,25 +7,25 @@ concurrency: jobs: - call-lint: - name: "Lint" - uses: ./.github/workflows/lint.yml + # call-lint: + # name: "Lint" + # uses: ./.github/workflows/lint.yml call-build: name: "Build" - needs: call-lint + # needs: call-lint uses: ./.github/workflows/build.yml - call-test: - name: "Test" - needs: call-build - uses: ./.github/workflows/test.yml - with: - VERSION: ${{ needs.call-build.outputs.VERSION }} + # call-test: + # name: "Test" + # needs: call-build + # uses: ./.github/workflows/test.yml + # with: + # VERSION: ${{ needs.call-build.outputs.VERSION }} # check-for-release-tag: # name: "Check for release tag" - # needs: call-test + # needs: call-build # runs-on: ubuntu-latest # if: startsWith(github.ref, 'refs/tags/v') # outputs: @@ -38,8 +38,9 @@ jobs: call-release: name: "Release" - needs: call-test + needs: call-build if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml - # with: - # RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} + with: + # RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} + RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3330177c3..d81ec8f4b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ name: "Release" -on: workflow_call -# on: -# workflow_call: -# inputs: -# RELEASE_VERSION: -# description: "Release version number" -# type: string +# on: workflow_call +on: + workflow_call: + inputs: + RELEASE_VERSION: + description: "Release version number" + type: string defaults: run: shell: bash @@ -19,7 +19,7 @@ jobs: permissions: contents: write env: - RELEASE_VERSION: ${{ env.GITHUB_REF_NAME }} + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 @@ -77,7 +77,7 @@ jobs: # needs: set-release-version env: REGISTRY: ghcr.io - RELEASE_VERSION: ${{ env.GITHUB_REF_NAME }} + RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} steps: - uses: actions/checkout@v3 diff --git a/tests/e2e-complex/deb-install/check_promotion.sh b/tests/e2e-complex/deb-install/check_promotion.sh new file mode 100644 index 000000000..c77aadfdb --- /dev/null +++ b/tests/e2e-complex/deb-install/check_promotion.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euox pipefail + +all_validators_cmd='cheqd-noded query staking validators --node http://localhost:26657' + +amount_bonded="$(${all_validators_cmd} | grep BOND_STATUS_BONDED | wc -l | xargs)" +amount_all="$(${all_validators_cmd} | grep status | wc -l | xargs)" + +if [ "${amount_all}" != "${amount_bonded}" ]; +then + exit 1 +fi \ No newline at end of file From f4e5f221014d658138a0019346ede51a124f3438 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 11:48:22 +0100 Subject: [PATCH 137/141] build test --- .github/workflows/build.yml | 48 +--------------------------------- .github/workflows/dispatch.yml | 36 ++++++++----------------- .github/workflows/release.yml | 35 +++++-------------------- 3 files changed, 18 insertions(+), 101 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f65b66834..8096d6b86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,53 +79,6 @@ jobs: VERSION=$(build/cheqd-noded version 2>&1) echo ::set-output name=VERSION::"$VERSION" - build-tarball-package: - name: "Tarball package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - - steps: - - uses: actions/checkout@v3 - - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - - name: Build tarball - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" - - - name: Store tarball artifact - uses: actions/upload-artifact@v3 - with: - name: cheqd-node_${{ env.VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.VERSION }}.tar.gz - - build-debian-package: - name: "Debian package" - runs-on: ubuntu-latest - needs: build-binary - env: - VERSION: ${{ needs.build-binary.outputs.VERSION }} - - steps: - - uses: actions/checkout@v3 - - - name: Load binary artifact - uses: actions/download-artifact@v3 - with: - name: cheqd-noded - - - name: Restore binary permissions - run: sudo chmod +x cheqd-noded - - name: Install fpm run: | sudo apt-get install ruby ruby-dev rubygems build-essential @@ -138,6 +91,7 @@ jobs: - name: Store Debian package artifact uses: actions/upload-artifact@v3 + env: with: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index 1e2e5885b..f4ba787cb 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -7,40 +7,26 @@ concurrency: jobs: - # call-lint: - # name: "Lint" - # uses: ./.github/workflows/lint.yml + call-lint: + name: "Lint" + uses: ./.github/workflows/lint.yml call-build: name: "Build" - # needs: call-lint + needs: call-lint uses: ./.github/workflows/build.yml - # call-test: - # name: "Test" - # needs: call-build - # uses: ./.github/workflows/test.yml - # with: - # VERSION: ${{ needs.call-build.outputs.VERSION }} - - # check-for-release-tag: - # name: "Check for release tag" - # needs: call-build - # runs-on: ubuntu-latest - # if: startsWith(github.ref, 'refs/tags/v') - # outputs: - # RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} - - # steps: - # - name: Set release version - # id: set-version - # run: echo ::set-output name=RELEASE_VERSION::${GITHUB_REF##*/} + call-test: + name: "Test" + needs: call-build + uses: ./.github/workflows/test.yml + with: + VERSION: ${{ needs.call-build.outputs.VERSION }} call-release: name: "Release" - needs: call-build + needs: call-test if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - # RELEASE_VERSION: ${{ needs.check-for-release-tag.outputs.RELEASE_VERSION }} RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d81ec8f4b..a513f2df0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,4 @@ name: "Release" -# on: workflow_call on: workflow_call: inputs: @@ -70,11 +69,11 @@ jobs: files: | build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz + cheqd-noded release-docker-images: name: "Publish Docker images for new version" runs-on: ubuntu-latest - # needs: set-release-version env: REGISTRY: ghcr.io RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} @@ -84,24 +83,12 @@ jobs: with: fetch-depth: 0 # Required to fetch version - # - name: Set release version - # run: echo ::set-output name=RELEASE_VERSION::"${GITHUB_REF##*/}" >> "$GITHUB_ENV" + - name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint and no build args + # TODO: Get rid of UID and GID + run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - - name: Download cheqd-cli Docker image - uses: actions/download-artifact@v3 - with: - name: cheqd-cli-image.tar - - - name: Download cheqd-node Docker image - uses: actions/download-artifact@v3 - with: - name: cheqd-node-image.tar - - - name: Load cheqd-cli image - run: docker load -i cheqd-cli-image.tar - - - name: Load cheqd-node image - run: docker load -i cheqd-node-image.tar + - name: Build cheqd-node Docker image with 'node-start' as entrypoint and no build args + run: docker build --target node -t cheqd-node -f docker/Dockerfile . - name: Login to Container registry uses: docker/login-action@v1 @@ -123,13 +110,3 @@ jobs: docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest - - - name: Download deb - uses: actions/download-artifact@v2 - with: - name: cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - - - name: Download tar - uses: actions/download-artifact@v2 - with: - name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz From 98ba3a8924a4dfa90930be7e62053bd6fa649468 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 11:50:34 +0100 Subject: [PATCH 138/141] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8096d6b86..885397cd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,7 @@ jobs: - name: Store Debian package artifact uses: actions/upload-artifact@v3 env: + VERSION: ${{ steps.set-version.outputs.VERSION }} with: name: cheqd-node_${{ env.VERSION }}_amd64.deb path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb From 2002625519b9ecf95a6c874604bfe1776f19e5a6 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 11:56:26 +0100 Subject: [PATCH 139/141] Test build --- .github/workflows/release.yml | 12 ------------ tests/e2e-complex/deb-install/check_promotion.sh | 13 ------------- 2 files changed, 25 deletions(-) delete mode 100644 tests/e2e-complex/deb-install/check_promotion.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a513f2df0..12735e4ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,17 +38,6 @@ jobs: sudo apt-get install ruby ruby-dev rubygems build-essential sudo gem install --no-document fpm - - name: Build tarball package for release - working-directory: ./build-tools - run: | - ./build-tar.sh "../cheqd-noded" - - - name: Store tarball artifact for release - uses: actions/upload-artifact@v3 - with: - name: cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - path: build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz - - name: Build Debian package for release working-directory: ./build-tools run: | @@ -68,7 +57,6 @@ jobs: draft: true files: | build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}_amd64.deb - build-tools/output/cheqd-node_${{ env.RELEASE_VERSION }}.tar.gz cheqd-noded release-docker-images: diff --git a/tests/e2e-complex/deb-install/check_promotion.sh b/tests/e2e-complex/deb-install/check_promotion.sh deleted file mode 100644 index c77aadfdb..000000000 --- a/tests/e2e-complex/deb-install/check_promotion.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -euox pipefail - -all_validators_cmd='cheqd-noded query staking validators --node http://localhost:26657' - -amount_bonded="$(${all_validators_cmd} | grep BOND_STATUS_BONDED | wc -l | xargs)" -amount_all="$(${all_validators_cmd} | grep status | wc -l | xargs)" - -if [ "${amount_all}" != "${amount_bonded}" ]; -then - exit 1 -fi \ No newline at end of file From f48004ca050949f17818440ad126497e2b6f3676 Mon Sep 17 00:00:00 2001 From: Andrew Nikitin Date: Tue, 12 Apr 2022 18:40:20 +0300 Subject: [PATCH 140/141] build(tooling): Fix variables in workflow for release versions * Deactivate lint and release workflows * Deactivate lint workflow dependency * [DEV-1096] Revert changes and fix pipelines Signed-off-by: Andrew Nikitin * [DEV-1096] Remove set pipefail for workflow Signed-off-by: Andrew Nikitin * [DEV-1096] add script instead of one command Signed-off-by: Andrew Nikitin * [DEV-1096] Change node to localhost Signed-off-by: Andrew Nikitin * [DEV-1096] Fix release pipelines Signed-off-by: Andrew Nikitin * [DEV-1096] fix release pipeline Signed-off-by: Andrew Nikitin * [DEV-1096] debug release Signed-off-by: Andrew Nikitin * [DEV-1096] Fix release tagging Signed-off-by: Andrew Nikitin * [DEV-1096] fix build Signed-off-by: Andrew Nikitin * [DEV-1096] Remove unused script Signed-off-by: Andrew Nikitin * [DEV-1096] debug Signed-off-by: Andrew Nikitin * [DEV-1096] fix variable passing Signed-off-by: Andrew Nikitin Co-authored-by: Ankur Banerjee --- .github/workflows/build.yml | 8 +++----- .github/workflows/dispatch.yml | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 885397cd1..1694e1656 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,6 @@ jobs: github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest - - name: Install buf env: PREFIX: "/usr/local" @@ -66,7 +65,7 @@ jobs: - name: Build node binary run: | make proto-gen build - + - name: Store artifact uses: actions/upload-artifact@v3 with: @@ -78,7 +77,6 @@ jobs: run: | VERSION=$(build/cheqd-noded version 2>&1) echo ::set-output name=VERSION::"$VERSION" - - name: Install fpm run: | sudo apt-get install ruby ruby-dev rubygems build-essential @@ -87,7 +85,7 @@ jobs: - name: Build Debian package working-directory: ./build-tools run: | - ./build-deb.sh "../cheqd-noded" + ./build-deb.sh "../build/cheqd-noded" - name: Store Debian package artifact uses: actions/upload-artifact@v3 @@ -129,4 +127,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node-image.tar - path: cheqd-node-image.tar + path: cheqd-node-image.tar \ No newline at end of file diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index f4ba787cb..e8592fa42 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -25,8 +25,8 @@ jobs: call-release: name: "Release" - needs: call-test + needs: [call-test, call-build] if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} + RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file From 2ae2536cd0516b1030e439dcb1cdc5eb76966dd8 Mon Sep 17 00:00:00 2001 From: Ankur Banerjee Date: Tue, 12 Apr 2022 16:45:58 +0100 Subject: [PATCH 141/141] FInal release test --- .github/workflows/build.yml | 2 +- .github/workflows/dispatch.yml | 2 +- .github/workflows/release.yml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1694e1656..1e6b1ffd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,4 +127,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: cheqd-node-image.tar - path: cheqd-node-image.tar \ No newline at end of file + path: cheqd-node-image.tar diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index e8592fa42..de5529219 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -29,4 +29,4 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') uses: ./.github/workflows/release.yml with: - RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} \ No newline at end of file + RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12735e4ea..8377ba499 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,6 @@ jobs: fetch-depth: 0 # Required to fetch version - name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint and no build args - # TODO: Get rid of UID and GID run: docker build --target base -t cheqd-cli -f docker/Dockerfile . - name: Build cheqd-node Docker image with 'node-start' as entrypoint and no build args