Skip to content

Commit 1f82949

Browse files
pirtleshelldrklee3
authored andcommitted
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
1 parent 803f541 commit 1f82949

14 files changed

+181
-79
lines changed

.dockerignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
out/
22
**/node_modules/
33
.git/
4-
docs/
4+
.github/
55
tests/
6+
7+
ci/
68
contracts/
9+
contrib/
10+
docs/
11+
networks/
12+
scratch/
713

814
go.work
915
go.work.sum

.github/scripts/install-rocksdb.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4
77
# get rocksdb sources
88
git clone https://github.com/facebook/rocksdb.git /home/runner/rocksdb
99

10-
cd /home/runner/rocksdb
10+
cd /home/runner/rocksdb || exit 1
1111

1212
git checkout "$ROCKSDB_VERSION"
1313

1414
# install rocksdb locally
15-
sudo make -j $(nproc --all) install-shared
15+
sudo make -j "$(nproc --all)" install-shared && sudo ldconfig

.github/workflows/cd-reset-internal-testnet.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- name: checkout repo from current commit
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040
- name: take the chain offline
4141
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
4242
env:
@@ -45,18 +45,16 @@ jobs:
4545
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
4646
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
4747
- name: checkout infrastructure repo
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4949
with:
5050
repository: Kava-Labs/infrastructure
5151
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
5252
path: infrastructure
5353
ref: master
54-
- name: set up Go
55-
uses: actions/setup-go@v3
54+
- name: Set up Go
55+
uses: actions/setup-go@v4
5656
with:
57-
go-version: "1.20"
58-
check-latest: true
59-
cache: true
57+
go-version-file: go.mod
6058
- name: build kava node updater
6159
run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
6260
- name: run reset playbook on all chain nodes

.github/workflows/cd-seed-chain.yml

+8-10
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,23 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- name: checkout repo from master
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636
with:
37-
ref: master
37+
ref: master
3838
- name: checkout version of kava used by network
3939
run: |
4040
git pull -p
4141
git checkout $(cat ${KAVA_VERSION_FILEPATH})
4242
env:
43-
KAVA_VERSION_FILEPATH: ${{ inputs.kava_version_filepath }}
43+
KAVA_VERSION_FILEPATH: ${{ inputs.kava_version_filepath }}
4444
- name: Set up Go
45-
uses: actions/setup-go@v3
45+
uses: actions/setup-go@v4
4646
with:
47-
go-version: "1.20"
48-
check-latest: true
49-
cache: true
47+
go-version-file: go.mod
5048
- name: build kava binary
5149
run: make install
5250
- name: checkout go evm tools repo
53-
uses: actions/checkout@v3
51+
uses: actions/checkout@v4
5452
with:
5553
repository: ethereum/go-ethereum
5654
path: go-ethereum
@@ -61,7 +59,7 @@ jobs:
6159
make devtools
6260
working-directory: go-ethereum
6361
- name: checkout kava bridge repo for deploying evm contracts
64-
uses: actions/checkout@v3
62+
uses: actions/checkout@v4
6563
with:
6664
repository: Kava-Labs/kava-bridge
6765
path: kava-bridge
@@ -82,7 +80,7 @@ jobs:
8280
run: wget https://raw.githubusercontent.com/Kava-Labs/kava/master/.github/scripts/${SEED_SCRIPT_FILENAME} && chmod +x ${SEED_SCRIPT_FILENAME}
8381
working-directory: kava-bridge/contract
8482
env:
85-
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
83+
SEED_SCRIPT_FILENAME: ${{ inputs.seed-script-filename }}
8684
- name: run seed scripts
8785
run: bash ./${SEED_SCRIPT_FILENAME}
8886
working-directory: kava-bridge/contract

.github/workflows/cd-start-chain.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- name: checkout repo from current commit
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636
- name: take the chain offline
3737
run: bash ${GITHUB_WORKSPACE}/.github/scripts/put-all-chain-nodes-on-standby.sh
3838
env:
@@ -41,18 +41,16 @@ jobs:
4141
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
4242
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
4343
- name: checkout infrastructure repo
44-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
4545
with:
4646
repository: Kava-Labs/infrastructure
4747
token: ${{ secrets.KAVA_PRIVATE_GITHUB_ACCESS_TOKEN }}
4848
path: infrastructure
4949
ref: master
50-
- name: set up Go
51-
uses: actions/setup-go@v3
50+
- name: Set up Go
51+
uses: actions/setup-go@v4
5252
with:
53-
go-version: "1.20"
54-
check-latest: true
55-
cache: true
53+
go-version-file: go.mod
5654
- name: build kava node updater
5755
run: cd infrastructure/cli/kava-node-updater && make install && cd ../../../
5856
- name: run start-chain playbook on all chain nodes

.github/workflows/ci-default.yml

+20-22
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,30 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: checkout repo from current commit
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
- name: Set up Go
12-
uses: actions/setup-go@v3
12+
uses: actions/setup-go@v4
1313
with:
14-
go-version: "1.20"
15-
check-latest: true
16-
cache: true
14+
go-version-file: go.mod
15+
cache-dependency-path: |
16+
go.sum
17+
tests/e2e/kvtool/go.sum
1718
- name: build application
1819
run: make build
1920
test:
2021
runs-on: ubuntu-latest
2122
steps:
2223
- name: checkout repo from current commit
23-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2425
with:
2526
submodules: true
2627
- name: Set up Go
27-
uses: actions/setup-go@v3
28+
uses: actions/setup-go@v4
2829
with:
29-
go-version: "1.20"
30-
check-latest: true
31-
cache: true
30+
go-version-file: go.mod
31+
cache-dependency-path: |
32+
go.sum
33+
tests/e2e/kvtool/go.sum
3234
- name: run unit tests
3335
run: make test
3436
- name: run e2e tests
@@ -37,13 +39,13 @@ jobs:
3739
runs-on: ubuntu-latest
3840
steps:
3941
- name: checkout repo from current commit
40-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4143
- name: save version of kava that will be deployed if this pr is merged
4244
id: kava-version
4345
run: |
4446
echo "KAVA_VERSION=$(cat ./ci/env/kava-internal-testnet/KAVA.VERSION)" >> $GITHUB_OUTPUT
4547
- name: checkout repo from master
46-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4749
with:
4850
ref: master
4951
- name: checkout version of kava that will be deployed if this pr is merged
@@ -53,28 +55,24 @@ jobs:
5355
env:
5456
KAVA_VERSION: ${{ steps.kava-version.outputs.KAVA_VERSION }}
5557
- name: Set up Go
56-
uses: actions/setup-go@v3
58+
uses: actions/setup-go@v4
5759
with:
58-
go-version: "1.20"
59-
check-latest: true
60-
cache: true
60+
go-version-file: go.mod
6161
- name: build kava cli
6262
run: make install
6363
- name: checkout repo from current commit to validate current branch's genesis
64-
uses: actions/checkout@v3
64+
uses: actions/checkout@v4
6565
- name: validate testnet genesis
6666
run: kava validate-genesis ci/env/kava-internal-testnet/genesis.json
6767
validate-protonet-genesis:
6868
runs-on: ubuntu-latest
6969
steps:
7070
- name: checkout repo from current commit
71-
uses: actions/checkout@v3
71+
uses: actions/checkout@v4
7272
- name: Set up Go
73-
uses: actions/setup-go@v3
73+
uses: actions/setup-go@v4
7474
with:
75-
go-version: "1.20"
76-
check-latest: true
77-
cache: true
75+
go-version-file: go.mod
7876
- name: build kava cli
7977
run: make install
8078
- name: validate protonet genesis

.github/workflows/ci-docker.yml

+63-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ on:
66
dockerhub-username:
77
required: true
88
type: string
9+
# this workflow publishes a rocksdb & goleveldb docker images with these tags:
10+
# - <commit-hash>-goleveldb
11+
# - <extra-image-tag>-goleveldb
12+
# - <commit-hash>-rocksdb
13+
# - <extra-image-tag>-rocksdb
14+
extra-image-tag:
15+
required: true
16+
type: string
917
secrets:
1018
CI_DOCKERHUB_TOKEN:
1119
required: true
@@ -14,34 +22,81 @@ on:
1422
# you can use images built by this action in future jobs.
1523
# https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
1624
jobs:
17-
docker:
25+
docker-goleveldb:
26+
# https://github.com/marketplace/actions/build-and-push-docker-images
27+
runs-on: ubuntu-latest
28+
steps:
29+
# ensure working with latest code
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
# generate a git commit hash to be used as image tag
34+
- name: Generate short hash
35+
id: commit-hash
36+
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
37+
38+
# qemu is used to emulate different platform architectures
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
42+
# cross-platform build of the image
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
# authenticate for publish to docker hub
47+
- name: Login to Docker Hub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ inputs.dockerhub-username }}
51+
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
52+
53+
# publish to docker hub, tag with short git hash
54+
- name: Build and push (goleveldb)
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max
60+
platforms: linux/amd64,linux/arm64
61+
push: true
62+
tags: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:${{ inputs.extra-image-tag }}-goleveldb
63+
64+
docker-rocksdb:
1865
# https://github.com/marketplace/actions/build-and-push-docker-images
1966
runs-on: ubuntu-latest
2067
steps:
2168
# ensure working with latest code
2269
- name: Checkout
23-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
71+
2472
# generate a git commit hash to be used as image tag
2573
- name: Generate short hash
2674
id: commit-hash
2775
run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
76+
2877
# qemu is used to emulate different platform architectures
2978
- name: Set up QEMU
30-
uses: docker/setup-qemu-action@v2
79+
uses: docker/setup-qemu-action@v3
80+
3181
# cross-platform build of the image
3282
- name: Set up Docker Buildx
33-
uses: docker/setup-buildx-action@v2
83+
uses: docker/setup-buildx-action@v3
84+
3485
# authenticate for publish to docker hub
3586
- name: Login to Docker Hub
36-
uses: docker/login-action@v2
87+
uses: docker/login-action@v3
3788
with:
3889
username: ${{ inputs.dockerhub-username }}
3990
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
91+
4092
# publish to docker hub, tag with short git hash
41-
- name: Build and push
42-
uses: docker/build-push-action@v3
93+
- name: Build and push (rocksdb)
94+
uses: docker/build-push-action@v5
4395
with:
4496
context: .
97+
file: Dockerfile-rocksdb
98+
cache-from: type=gha
99+
cache-to: type=gha,mode=max
45100
platforms: linux/amd64,linux/arm64
46101
push: true
47-
tags: kava/kava:${{ steps.commit-hash.outputs.short }},kava/kava:master
102+
tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb,kava/kava:${{ inputs.extra-image-tag }}-rocksdb

.github/workflows/ci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
golangci-lint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@master
11+
- uses: actions/checkout@v4
1212
- name: golangci-lint
1313
uses: reviewdog/action-golangci-lint@v2
1414
with:

.github/workflows/ci-master.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: checkout repo from current commit
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
- name: Set up Go
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@v4
2525
with:
26-
go-version: "1.20"
27-
check-latest: true
28-
cache: true
26+
go-version-file: go.mod
2927
- name: set build tag
3028
run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
3129
- name: build rocksdb dependency
@@ -45,6 +43,7 @@ jobs:
4543
uses: ./.github/workflows/ci-docker.yml
4644
with:
4745
dockerhub-username: kavaops
46+
extra-image-tag: master
4847
secrets: inherit
4948
post-pipeline-metrics:
5049
uses: ./.github/workflows/metric-pipeline.yml

0 commit comments

Comments
 (0)