mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 03:27:26 +00:00 
			
		
		
		
	ci: update CI workflows and pipelines (#1768)
* build & publish rocksdb docker images merge to master * publish docker images on push of release version tags NOTE: New docker image tag pattern. ALL tags now include database suffix ex. <githash>-goleveldb, v0.25.0-alpha.1-rocksdb, master-rocksdb, etc * update dockerfiles for better caching * update all github action workflow versions * improve caching of go packages * cache docker image layers for reuse between runs * update dockerignore to remove non-essential files
This commit is contained in:
		
							parent
							
								
									803f54113a
								
							
						
					
					
						commit
						1f82949c56
					
				@ -1,9 +1,15 @@
 | 
				
			|||||||
out/
 | 
					out/
 | 
				
			||||||
**/node_modules/
 | 
					**/node_modules/
 | 
				
			||||||
.git/
 | 
					.git/
 | 
				
			||||||
docs/
 | 
					.github/
 | 
				
			||||||
tests/
 | 
					tests/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ci/
 | 
				
			||||||
contracts/
 | 
					contracts/
 | 
				
			||||||
 | 
					contrib/
 | 
				
			||||||
 | 
					docs/
 | 
				
			||||||
 | 
					networks/
 | 
				
			||||||
 | 
					scratch/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
go.work
 | 
					go.work
 | 
				
			||||||
go.work.sum
 | 
					go.work.sum
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								.github/scripts/install-rocksdb.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/scripts/install-rocksdb.sh
									
									
									
									
										vendored
									
									
								
							@ -7,9 +7,9 @@ sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4
 | 
				
			|||||||
# get rocksdb sources
 | 
					# get rocksdb sources
 | 
				
			||||||
git clone https://github.com/facebook/rocksdb.git /home/runner/rocksdb
 | 
					git clone https://github.com/facebook/rocksdb.git /home/runner/rocksdb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd /home/runner/rocksdb
 | 
					cd /home/runner/rocksdb || exit 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git checkout "$ROCKSDB_VERSION"
 | 
					git checkout "$ROCKSDB_VERSION"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# install rocksdb locally
 | 
					# install rocksdb locally
 | 
				
			||||||
sudo make -j $(nproc --all) install-shared
 | 
					sudo make -j "$(nproc --all)" install-shared && sudo ldconfig
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								.github/workflows/cd-reset-internal-testnet.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/cd-reset-internal-testnet.yml
									
									
									
									
										vendored
									
									
								
							@ -36,7 +36,7 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: take the chain offline
 | 
					      - name: take the chain offline
 | 
				
			||||||
        run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
 | 
					        run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
@ -45,18 +45,16 @@ jobs:
 | 
				
			|||||||
          AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
 | 
					          AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
 | 
				
			||||||
          AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
 | 
					          AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
 | 
				
			||||||
      - name: checkout infrastructure repo
 | 
					      - name: checkout infrastructure repo
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          repository: Kava-Labs/infrastructure
 | 
					          repository: Kava-Labs/infrastructure
 | 
				
			||||||
          token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
 | 
					          token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
 | 
				
			||||||
          path: infrastructure
 | 
					          path: infrastructure
 | 
				
			||||||
          ref: master
 | 
					          ref: master
 | 
				
			||||||
      - name: set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build kava node updater
 | 
					      - name: build kava node updater
 | 
				
			||||||
        run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
 | 
					        run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
 | 
				
			||||||
      - name: run reset playbook on all chain nodes
 | 
					      - name: run reset playbook on all chain nodes
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								.github/workflows/cd-seed-chain.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.github/workflows/cd-seed-chain.yml
									
									
									
									
										vendored
									
									
								
							@ -32,25 +32,23 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from master
 | 
					      - name: checkout repo from master
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
         ref: master
 | 
					          ref: master
 | 
				
			||||||
      - name: checkout version of kava used by network
 | 
					      - name: checkout version of kava used by network
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          git pull -p
 | 
					          git pull -p
 | 
				
			||||||
          git checkout $(cat ${KAVA_VERSION_FILEPATH})
 | 
					          git checkout $(cat ${KAVA_VERSION_FILEPATH})
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
            KAVA_VERSION_FILEPATH: ${{ inputs.kava_version_filepath }}
 | 
					          KAVA_VERSION_FILEPATH: ${{ inputs.kava_version_filepath }}
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build kava binary
 | 
					      - name: build kava binary
 | 
				
			||||||
        run: make install
 | 
					        run: make install
 | 
				
			||||||
      - name: checkout go evm tools repo
 | 
					      - name: checkout go evm tools repo
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          repository: ethereum/go-ethereum
 | 
					          repository: ethereum/go-ethereum
 | 
				
			||||||
          path: go-ethereum
 | 
					          path: go-ethereum
 | 
				
			||||||
@ -61,7 +59,7 @@ jobs:
 | 
				
			|||||||
          make devtools
 | 
					          make devtools
 | 
				
			||||||
        working-directory: go-ethereum
 | 
					        working-directory: go-ethereum
 | 
				
			||||||
      - name: checkout kava bridge repo for deploying evm contracts
 | 
					      - name: checkout kava bridge repo for deploying evm contracts
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          repository: Kava-Labs/kava-bridge
 | 
					          repository: Kava-Labs/kava-bridge
 | 
				
			||||||
          path: kava-bridge
 | 
					          path: kava-bridge
 | 
				
			||||||
@ -82,7 +80,7 @@ jobs:
 | 
				
			|||||||
        run: wget https://raw.githubusercontent.com/Kava-Labs/kava/master/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
 | 
					        run: wget https://raw.githubusercontent.com/Kava-Labs/kava/master/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
 | 
				
			||||||
        working-directory: kava-bridge/contract
 | 
					        working-directory: kava-bridge/contract
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
            SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
 | 
					          SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
 | 
				
			||||||
      - name: run seed scripts
 | 
					      - name: run seed scripts
 | 
				
			||||||
        run: bash ./${SEED_SCRIPT_FILENAME}
 | 
					        run: bash ./${SEED_SCRIPT_FILENAME}
 | 
				
			||||||
        working-directory: kava-bridge/contract
 | 
					        working-directory: kava-bridge/contract
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								.github/workflows/cd-start-chain.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/cd-start-chain.yml
									
									
									
									
										vendored
									
									
								
							@ -32,7 +32,7 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: take the chain offline
 | 
					      - name: take the chain offline
 | 
				
			||||||
        run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
 | 
					        run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
@ -41,18 +41,16 @@ jobs:
 | 
				
			|||||||
          AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
 | 
					          AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
 | 
				
			||||||
          AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
 | 
					          AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
 | 
				
			||||||
      - name: checkout infrastructure repo
 | 
					      - name: checkout infrastructure repo
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          repository: Kava-Labs/infrastructure
 | 
					          repository: Kava-Labs/infrastructure
 | 
				
			||||||
          token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
 | 
					          token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
 | 
				
			||||||
          path: infrastructure
 | 
					          path: infrastructure
 | 
				
			||||||
          ref: master
 | 
					          ref: master
 | 
				
			||||||
      - name: set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build kava node updater
 | 
					      - name: build kava node updater
 | 
				
			||||||
        run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
 | 
					        run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
 | 
				
			||||||
      - name: run start-chain playbook on all chain nodes
 | 
					      - name: run start-chain playbook on all chain nodes
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										42
									
								
								.github/workflows/ci-default.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								.github/workflows/ci-default.yml
									
									
									
									
										vendored
									
									
								
							@ -7,28 +7,30 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					          cache-dependency-path: |
 | 
				
			||||||
          cache: true
 | 
					            go.sum
 | 
				
			||||||
 | 
					            tests/e2e/kvtool/go.sum
 | 
				
			||||||
      - name: build application
 | 
					      - name: build application
 | 
				
			||||||
        run: make build
 | 
					        run: make build
 | 
				
			||||||
  test:
 | 
					  test:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          submodules: true
 | 
					          submodules: true
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					          cache-dependency-path: |
 | 
				
			||||||
          cache: true
 | 
					            go.sum
 | 
				
			||||||
 | 
					            tests/e2e/kvtool/go.sum
 | 
				
			||||||
      - name: run unit tests
 | 
					      - name: run unit tests
 | 
				
			||||||
        run: make test
 | 
					        run: make test
 | 
				
			||||||
      - name: run e2e tests
 | 
					      - name: run e2e tests
 | 
				
			||||||
@ -37,13 +39,13 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: save version of kava that will be deployed if this pr is merged
 | 
					      - name: save version of kava that will be deployed if this pr is merged
 | 
				
			||||||
        id: kava-version
 | 
					        id: kava-version
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          echo "KAVA_VERSION=$(cat ./ci/env/kava-internal-testnet/KAVA.VERSION)" >> $GITHUB_OUTPUT
 | 
					          echo "KAVA_VERSION=$(cat ./ci/env/kava-internal-testnet/KAVA.VERSION)" >> $GITHUB_OUTPUT
 | 
				
			||||||
      - name: checkout repo from master
 | 
					      - name: checkout repo from master
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          ref: master
 | 
					          ref: master
 | 
				
			||||||
      - name: checkout version of kava that will be deployed if this pr is merged
 | 
					      - name: checkout version of kava that will be deployed if this pr is merged
 | 
				
			||||||
@ -53,28 +55,24 @@ jobs:
 | 
				
			|||||||
        env:
 | 
					        env:
 | 
				
			||||||
          KAVA_VERSION: ${{ steps.kava-version.outputs.KAVA_VERSION }}
 | 
					          KAVA_VERSION: ${{ steps.kava-version.outputs.KAVA_VERSION }}
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build kava cli
 | 
					      - name: build kava cli
 | 
				
			||||||
        run: make install
 | 
					        run: make install
 | 
				
			||||||
      - name: checkout repo from current commit to validate current branch's genesis
 | 
					      - name: checkout repo from current commit to validate current branch's genesis
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: validate testnet genesis
 | 
					      - name: validate testnet genesis
 | 
				
			||||||
        run: kava validate-genesis ci/env/kava-internal-testnet/genesis.json
 | 
					        run: kava validate-genesis ci/env/kava-internal-testnet/genesis.json
 | 
				
			||||||
  validate-protonet-genesis:
 | 
					  validate-protonet-genesis:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build kava cli
 | 
					      - name: build kava cli
 | 
				
			||||||
        run: make install
 | 
					        run: make install
 | 
				
			||||||
      - name: validate protonet genesis
 | 
					      - name: validate protonet genesis
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										71
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								.github/workflows/ci-docker.yml
									
									
									
									
										vendored
									
									
								
							@ -6,6 +6,14 @@ on:
 | 
				
			|||||||
      dockerhub-username:
 | 
					      dockerhub-username:
 | 
				
			||||||
        required: true
 | 
					        required: true
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
 | 
					      # this workflow publishes a rocksdb & goleveldb docker images with these tags:
 | 
				
			||||||
 | 
					      # - <commit-hash>-goleveldb
 | 
				
			||||||
 | 
					      # - <extra-image-tag>-goleveldb
 | 
				
			||||||
 | 
					      # - <commit-hash>-rocksdb
 | 
				
			||||||
 | 
					      # - <extra-image-tag>-rocksdb
 | 
				
			||||||
 | 
					      extra-image-tag:
 | 
				
			||||||
 | 
					        required: true
 | 
				
			||||||
 | 
					        type: string
 | 
				
			||||||
    secrets:
 | 
					    secrets:
 | 
				
			||||||
      CI_DOCKERHUB_TOKEN:
 | 
					      CI_DOCKERHUB_TOKEN:
 | 
				
			||||||
        required: true
 | 
					        required: true
 | 
				
			||||||
@ -14,34 +22,81 @@ on:
 | 
				
			|||||||
# you can use images built by this action in future jobs.
 | 
					# you can use images built by this action in future jobs.
 | 
				
			||||||
# https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
 | 
					# https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  docker:
 | 
					  docker-goleveldb:
 | 
				
			||||||
    # https://github.com/marketplace/actions/build-and-push-docker-images
 | 
					    # https://github.com/marketplace/actions/build-and-push-docker-images
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      # ensure working with latest code
 | 
					      # ensure working with latest code
 | 
				
			||||||
      - name: Checkout
 | 
					      - name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # generate a git commit hash to be used as image tag
 | 
					      # generate a git commit hash to be used as image tag
 | 
				
			||||||
      - name: Generate short hash
 | 
					      - name: Generate short hash
 | 
				
			||||||
        id: commit-hash
 | 
					        id: commit-hash
 | 
				
			||||||
        run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
 | 
					        run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # qemu is used to emulate different platform architectures
 | 
					      # qemu is used to emulate different platform architectures
 | 
				
			||||||
      - name: Set up QEMU
 | 
					      - name: Set up QEMU
 | 
				
			||||||
        uses: docker/setup-qemu-action@v2
 | 
					        uses: docker/setup-qemu-action@v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # cross-platform build of the image
 | 
					      # cross-platform build of the image
 | 
				
			||||||
      - name: Set up Docker Buildx
 | 
					      - name: Set up Docker Buildx
 | 
				
			||||||
        uses: docker/setup-buildx-action@v2
 | 
					        uses: docker/setup-buildx-action@v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # authenticate for publish to docker hub
 | 
					      # authenticate for publish to docker hub
 | 
				
			||||||
      - name: Login to Docker Hub
 | 
					      - name: Login to Docker Hub
 | 
				
			||||||
        uses: docker/login-action@v2
 | 
					        uses: docker/login-action@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          username: ${{ inputs.dockerhub-username }}
 | 
					          username: ${{ inputs.dockerhub-username }}
 | 
				
			||||||
          password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
 | 
					          password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # publish to docker hub, tag with short git hash
 | 
					      # publish to docker hub, tag with short git hash
 | 
				
			||||||
      - name: Build and push
 | 
					      - name: Build and push (goleveldb)
 | 
				
			||||||
        uses: docker/build-push-action@v3
 | 
					        uses: docker/build-push-action@v5
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
 | 
					          cache-from: type=gha
 | 
				
			||||||
 | 
					          cache-to: type=gha,mode=max
 | 
				
			||||||
          platforms: linux/amd64,linux/arm64
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
          tags: kava/kava:${{ steps.commit-hash.outputs.short }},kava/kava:master
 | 
					          tags: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:${{ inputs.extra-image-tag }}-goleveldb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  docker-rocksdb:
 | 
				
			||||||
 | 
					    # https://github.com/marketplace/actions/build-and-push-docker-images
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      # ensure working with latest code
 | 
				
			||||||
 | 
					      - name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # generate a git commit hash to be used as image tag
 | 
				
			||||||
 | 
					      - name: Generate short hash
 | 
				
			||||||
 | 
					        id: commit-hash
 | 
				
			||||||
 | 
					        run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # qemu is used to emulate different platform architectures
 | 
				
			||||||
 | 
					      - name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # cross-platform build of the image
 | 
				
			||||||
 | 
					      - name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # authenticate for publish to docker hub
 | 
				
			||||||
 | 
					      - name: Login to Docker Hub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v3
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ inputs.dockerhub-username }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # publish to docker hub, tag with short git hash
 | 
				
			||||||
 | 
					      - name: Build and push (rocksdb)
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v5
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          file: Dockerfile-rocksdb
 | 
				
			||||||
 | 
					          cache-from: type=gha
 | 
				
			||||||
 | 
					          cache-to: type=gha,mode=max
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb,kava/kava:${{ inputs.extra-image-tag }}-rocksdb
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								.github/workflows/ci-lint.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci-lint.yml
									
									
									
									
										vendored
									
									
								
							@ -8,7 +8,7 @@ jobs:
 | 
				
			|||||||
  golangci-lint:
 | 
					  golangci-lint:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@master
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
      - name: golangci-lint
 | 
					      - name: golangci-lint
 | 
				
			||||||
        uses: reviewdog/action-golangci-lint@v2
 | 
					        uses: reviewdog/action-golangci-lint@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										9
									
								
								.github/workflows/ci-master.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/workflows/ci-master.yml
									
									
									
									
										vendored
									
									
								
							@ -19,13 +19,11 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: set build tag
 | 
					      - name: set build tag
 | 
				
			||||||
        run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
 | 
					        run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
 | 
				
			||||||
      - name: build rocksdb dependency
 | 
					      - name: build rocksdb dependency
 | 
				
			||||||
@ -45,6 +43,7 @@ jobs:
 | 
				
			|||||||
    uses: ./.github/workflows/ci-docker.yml
 | 
					    uses: ./.github/workflows/ci-docker.yml
 | 
				
			||||||
    with:
 | 
					    with:
 | 
				
			||||||
      dockerhub-username: kavaops
 | 
					      dockerhub-username: kavaops
 | 
				
			||||||
 | 
					      extra-image-tag: master
 | 
				
			||||||
    secrets: inherit
 | 
					    secrets: inherit
 | 
				
			||||||
  post-pipeline-metrics:
 | 
					  post-pipeline-metrics:
 | 
				
			||||||
    uses: ./.github/workflows/metric-pipeline.yml
 | 
					    uses: ./.github/workflows/metric-pipeline.yml
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										35
									
								
								.github/workflows/ci-release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								.github/workflows/ci-release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					name: Continuous Integration (Release)
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    tags:
 | 
				
			||||||
 | 
					      - "v[0-9]+.[0-9]+.[0-9]+*"
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  # run per commit ci checks against released version
 | 
				
			||||||
 | 
					  lint-checks:
 | 
				
			||||||
 | 
					    uses: ./.github/workflows/ci-lint.yml
 | 
				
			||||||
 | 
					  # run default ci checks against released version
 | 
				
			||||||
 | 
					  default-checks:
 | 
				
			||||||
 | 
					    uses: ./.github/workflows/ci-default.yml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # get the version tag that triggered this workflow
 | 
				
			||||||
 | 
					  get-version-tag:
 | 
				
			||||||
 | 
					    # prep version release only if all checks pass
 | 
				
			||||||
 | 
					    needs: [lint-checks, default-checks]
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    outputs:
 | 
				
			||||||
 | 
					      git-tag: ${{ steps.git-tag.outputs.tag }}
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      - id: git-tag
 | 
				
			||||||
 | 
					        run: echo "tag=$(git describe --always --tags --match='v*')" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # build and upload versions of kava for use on internal infrastructure
 | 
				
			||||||
 | 
					  # configurations for databases, cpu architectures and operating systems
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    # only run if all checks pass
 | 
				
			||||||
 | 
					    needs: get-version-tag
 | 
				
			||||||
 | 
					    uses: ./.github/workflows/ci-docker.yml
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      dockerhub-username: kavaops
 | 
				
			||||||
 | 
					      extra-image-tag: ${{ needs.get-version-tag.outputs.git-tag }}
 | 
				
			||||||
 | 
					    secrets: inherit
 | 
				
			||||||
							
								
								
									
										16
									
								
								.github/workflows/ci-rocksdb-build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/ci-rocksdb-build.yml
									
									
									
									
										vendored
									
									
								
							@ -10,13 +10,11 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: build rocksdb dependency
 | 
					      - name: build rocksdb dependency
 | 
				
			||||||
        run: bash ${GITHUB_WORKSPACE}/.github/scripts/install-rocksdb.sh
 | 
					        run: bash ${GITHUB_WORKSPACE}/.github/scripts/install-rocksdb.sh
 | 
				
			||||||
      - name: build application
 | 
					      - name: build application
 | 
				
			||||||
@ -34,14 +32,12 @@ jobs:
 | 
				
			|||||||
          && sudo make -j$(nproc) install-shared
 | 
					          && sudo make -j$(nproc) install-shared
 | 
				
			||||||
          && sudo ldconfig
 | 
					          && sudo ldconfig
 | 
				
			||||||
      - name: checkout repo from current commit
 | 
					      - name: checkout repo from current commit
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          submodules: true
 | 
					          submodules: true
 | 
				
			||||||
      - name: Set up Go
 | 
					      - name: Set up Go
 | 
				
			||||||
        uses: actions/setup-go@v3
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version: "1.20"
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          check-latest: true
 | 
					 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - name: run unit tests
 | 
					      - name: run unit tests
 | 
				
			||||||
        run: make test-rocksdb
 | 
					        run: make test-rocksdb
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								.github/workflows/proto.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/proto.yml
									
									
									
									
										vendored
									
									
								
							@ -8,11 +8,11 @@ jobs:
 | 
				
			|||||||
    name: "Check Proto"
 | 
					    name: "Check Proto"
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
      - uses: actions/setup-go@v3
 | 
					      - name: Set up Go
 | 
				
			||||||
 | 
					        uses: actions/setup-go@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          go-version-file: go.mod
 | 
					          go-version-file: go.mod
 | 
				
			||||||
          cache: true
 | 
					 | 
				
			||||||
      - run: go mod download
 | 
					      - run: go mod download
 | 
				
			||||||
      - run: make install-build-deps
 | 
					      - run: make install-build-deps
 | 
				
			||||||
      - run: make check-proto-deps
 | 
					      - run: make check-proto-deps
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,15 @@ RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl
 | 
				
			|||||||
WORKDIR /root/kava
 | 
					WORKDIR /root/kava
 | 
				
			||||||
# default home directory is /root
 | 
					# default home directory is /root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Copy dependency files first to facilitate dependency caching
 | 
				
			||||||
 | 
					COPY ./go.mod ./
 | 
				
			||||||
 | 
					COPY ./go.sum ./
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Download dependencies
 | 
				
			||||||
 | 
					RUN --mount=type=cache,target=/root/.cache/go-build \
 | 
				
			||||||
 | 
					    --mount=type=cache,target=/go/pkg/mod \
 | 
				
			||||||
 | 
					    go version && go mod download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Add source files
 | 
					# Add source files
 | 
				
			||||||
COPY . .
 | 
					COPY . .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,8 +19,18 @@ RUN git clone https://github.com/facebook/rocksdb.git \
 | 
				
			|||||||
    && make -j$(nproc) install-shared \
 | 
					    && make -j$(nproc) install-shared \
 | 
				
			||||||
    && ldconfig
 | 
					    && ldconfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Add source files for kava
 | 
					WORKDIR /root/kava
 | 
				
			||||||
COPY . kava
 | 
					# Copy dependency files first to facilitate dependency caching
 | 
				
			||||||
 | 
					COPY ./go.mod ./
 | 
				
			||||||
 | 
					COPY ./go.sum ./
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Download dependencies
 | 
				
			||||||
 | 
					RUN --mount=type=cache,target=/root/.cache/go-build \
 | 
				
			||||||
 | 
					    --mount=type=cache,target=/go/pkg/mod \
 | 
				
			||||||
 | 
					    go version && go mod download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Add source files
 | 
				
			||||||
 | 
					COPY . .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARG kava_database_backend=rocksdb
 | 
					ARG kava_database_backend=rocksdb
 | 
				
			||||||
ENV KAVA_DATABASE_BACKEND=$kava_database_backend
 | 
					ENV KAVA_DATABASE_BACKEND=$kava_database_backend
 | 
				
			||||||
@ -28,7 +38,7 @@ ENV KAVA_DATABASE_BACKEND=$kava_database_backend
 | 
				
			|||||||
# Mount go build and mod caches as container caches, persisted between builder invocations
 | 
					# Mount go build and mod caches as container caches, persisted between builder invocations
 | 
				
			||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
 | 
					RUN --mount=type=cache,target=/root/.cache/go-build \
 | 
				
			||||||
    --mount=type=cache,target=/go/pkg/mod \
 | 
					    --mount=type=cache,target=/go/pkg/mod \
 | 
				
			||||||
    cd kava && make install COSMOS_BUILD_OPTIONS=$KAVA_DATABASE_BACKEND
 | 
					    make install COSMOS_BUILD_OPTIONS=$KAVA_DATABASE_BACKEND
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM ubuntu:22.04
 | 
					FROM ubuntu:22.04
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user