Skip to content

Commit

Permalink
replace tmdb with comedb in 0.34 (#160)
Browse files Browse the repository at this point in the history
* replace tmdb with comedb in 0.34

* updates to workflow files

* e2e test docker files

* updated cometbft-docker
Co-authored-by: Thane Thomson <connect@thanethomson.com>

* reordered commands in Dockerfile

* Applied Thanes fix for dockerfiles

Co-authored-by: Thane Thomson <connect@thanethomson.com>
  • Loading branch information
jmalicevic and thanethomson committed Jan 20, 2023
1 parent 24b3a1b commit 29482fb
Show file tree
Hide file tree
Showing 69 changed files with 185 additions and 85 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ permissions:
jobs:
check-mocks:
runs-on: ubuntu-latest
# TODO (thane): Remove once we make the cometbft-db repository public
env:
GOPRIVATE: github.com/cometbft/cometbft-db
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'

- uses: actions/checkout@v3


# TODO (thane): Remove once we make the cometbft-db repository public
- run : git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- name: "Check generated mocks"
run: |
set -euo pipefail
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/cometbft-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" # e.g. v0.37.0-beta.1, v0.38.0-beta.10
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # e.g. v0.37.0-rc1, v0.38.0-rc10


jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,3 +59,5 @@ jobs:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
build-args: |
"GO_MODULES_TOKEN=${{ secrets.GO_MODULES_TOKEN }}"
8 changes: 8 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
matrix:
goarch: ["arm", "amd64"]
timeout-minutes: 5
# ToDo (thane): Remove once we make cometbft-db public
env:
GOPRIVATE: github.com/cometbft/cometbft-db
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- uses: actions/setup-go@v3
with:
Expand All @@ -52,6 +56,8 @@ jobs:
**/**.go
go.mod
go.sum
# ToDo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- name: install
run: GOOS=linux GOARCH=${{ matrix.goarch }} make build
if: "env.GIT_DIFF != ''"
Expand All @@ -74,6 +80,8 @@ jobs:
**/**.go
go.mod
go.sum
# ToDo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/e2e-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@ jobs:
group: ['00', '01', '02', '03']
runs-on: ubuntu-latest
timeout-minutes: 60
# TODO (thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
# We supply this as an environment variable in order to pass it
# through to the "docker" Makefile target in ./test/e2e
GO_MODULES_TOKEN: ${{ secrets.GO_MODULES_TOKEN }}
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'

- uses: actions/checkout@v3

# TODO (thane): Remove once we make the cometbft-db repository public.
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/

- name: Build
working-directory: test/e2e
# Run make jobs in parallel, since we can't run steps in parallel.
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/e2e-nightly-34x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
group: ['00', '01', '02', '03']
runs-on: ubuntu-latest
timeout-minutes: 60
# TODO (thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
# We have to supply this as an environment variable in order to pass it
# through to the "docker" Makefile target in ./test/e2e
GO_MODULES_TOKEN: ${{ secrets.GO_MODULES_TOKEN }}
steps:
- uses: actions/setup-go@v3
with:
Expand All @@ -34,6 +40,9 @@ jobs:
# Run make jobs in parallel, since we can't run steps in parallel.
run: make -j2 docker generator runner

# TODO(thane): Remove once we make the cometbft-db repository public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/

- name: Generate testnets
working-directory: test/e2e
# When changing -g, also change the matrix groups above
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/e2e-nightly-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ jobs:
group: ['00', '01', '02', '03']
runs-on: ubuntu-latest
timeout-minutes: 60
# TODO(thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
# We have to supply this as an environment variable in order to pass it
# through to the "docker" Makefile target in ./test/e2e
GO_MODULES_TOKEN: ${{ secrets.GO_MODULES_TOKEN }}
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.18'

- uses: actions/checkout@v3

# TODO(thane): Remove once we make the cometbft-db repository public.
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/

- name: Build
working-directory: test/e2e
# Run make jobs in parallel, since we can't run steps in parallel.
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 15
# TODO(thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
# We have to supply this as an environment variable in order to pass it
# through to the "docker" Makefile target in ./test/e2e
GO_MODULES_TOKEN: ${{ secrets.GO_MODULES_TOKEN }}
steps:
- uses: actions/setup-go@v3
with:
Expand All @@ -24,6 +30,10 @@ jobs:
go.mod
go.sum
# TODO(thane): Remove once we make the cometbft-db repository public.
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/


- name: Build
working-directory: test/e2e
# Run two make jobs in parallel, since we can't run steps in parallel.
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
jobs:
govulncheck:
runs-on: ubuntu-latest
# TODO(thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
steps:
- uses: actions/setup-go@v3
with:
Expand All @@ -26,6 +29,8 @@ jobs:
go.mod
go.sum
Makefile
# TODO(thane): Remove once we make the cometbft-db repository public.
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- name: govulncheck
run: make vulncheck
if: "env.GIT_DIFF != ''"
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 8
# TODO(thane): Remove once we make the cometbft-db repository public.
env:
GOPRIVATE: github.com/cometbft/cometbft-db
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand All @@ -23,6 +26,8 @@ jobs:
**/**.go
go.mod
go.sum
# TODO(thane): Remove once we make the cometbft-db repository public.
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/testapp-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" # e.g. v0.37.0-alpha.1, v0.38.0-alpha.10
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" # e.g. v0.37.0-beta.1, v0.38.0-beta.10
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # e.g. v0.37.0-rc1, v0.38.0-rc10
# TODO(thane): Remove once we make the cometbft-db repository public.

jobs:
build:
Expand Down Expand Up @@ -58,3 +59,6 @@ jobs:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'beep_boop' }}
tags: ${{ steps.prep.outputs.tags }}
# TODO(thane): Remove when we publish cometbft-db repository.
build-args: |
"GO_MODULES_TOKEN=${{ secrets.GO_MODULES_TOKEN }}"
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
# ToDo (thane): Remove once we make cometbft-db public
GOPRIVATE: github.com/cometbft/cometbft-db
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"

Expand All @@ -33,6 +35,8 @@ jobs:
**/**.go
go.mod
go.sum
# Todo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- name: install
run: make install install_abci
if: "env.GIT_DIFF != ''"
Expand Down Expand Up @@ -65,6 +69,8 @@ jobs:
**/**.go
go.mod
go.sum
# Todo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -97,6 +103,8 @@ jobs:
**/**.go
go.mod
go.sum
# Todo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -128,6 +136,8 @@ jobs:
**/**.go
go.mod
go.sum
# Todo (thane): Remove once we make cometbft-db public
- run: git config --global url.https://${{ secrets.GO_MODULES_TOKEN }}@github.com/.insteadOf https://github.com/
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
Expand Down
10 changes: 9 additions & 1 deletion DOCKER/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@
FROM golang:1.18-alpine as builder
RUN apk update && \
apk upgrade && \
apk --no-cache add make
apk --no-cache add make git
COPY / /cometbft
WORKDIR /cometbft
# TODO(thane): Remove once we publish the cometbft-db repository.
ENV GOPRIVATE=github.com/cometbft/cometbft-db
ARG GO_MODULES_TOKEN
RUN apk --no-cache add git && git config --global "url.https://${GO_MODULES_TOKEN}@github.com/".insteadOf "https://github.com/"
RUN make build-linux

# stage 2
FROM golang:1.18-alpine



LABEL maintainer="hello@informal.systems"


# CometBFT will be looking for the genesis file in /cometbft/config/genesis.json
# (unless you change `genesis_file` in config.toml). You can put your config.toml and
# private validator file into /cometbft/config.
Expand Down
6 changes: 5 additions & 1 deletion DOCKER/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ read -p "==> Build 3 docker images with the following tags (latest, $TAG, $TAG_N
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker build -t "cometbft/cometbft" -t "cometbft/cometbft:$TAG" -t "cometbft/cometbft:$TAG_NO_PATCH" .
docker build \
--build-arg GO_MODULES_TOKEN=${GO_MODULES_TOKEN} \
-t "cometbft/cometbft" \
-t "cometbft/cometbft:$TAG" \
-t "cometbft/cometbft:$TAG_NO_PATCH" .
fi
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BUILD_TAGS?=cometbft
ifneq ($(shell git symbolic-ref -q --short HEAD),)
VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)-$(shell git rev-parse HEAD)
else
VERSION := $(shell git describe)
VERSION := $(shell git describe --tags)
endif

LD_FLAGS = -X github.com/cometbft/cometbft/version.TMCoreSemVer=$(VERSION)
Expand Down Expand Up @@ -237,7 +237,7 @@ sync-docs:

build-docker: build-linux
cp $(OUTPUT) DOCKER/cometbft
docker build --label=cometbft --tag="cometbft/cometbft" DOCKER
docker build --label=cometbft --tag="cometbft/cometbft" --build-arg GO_MODULES_TOKEN=${GO_MODULES_TOKEN} --progress=plain DOCKER --no-cache
rm -rf DOCKER/cometbft
.PHONY: build-docker

Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/json"
"fmt"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
Expand Down
2 changes: 1 addition & 1 deletion abci/example/kvstore/persistent_kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

"github.com/tendermint/tendermint/abci/example/code"
"github.com/tendermint/tendermint/abci/types"
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v0/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v1/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/behaviour"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tendermint/commands/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/spf13/cobra"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

"github.com/tendermint/tendermint/libs/log"
cmtmath "github.com/tendermint/tendermint/libs/math"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tendermint/commands/reindex_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"strings"

dbm "github.com/cometbft/cometbft-db"
"github.com/spf13/cobra"
dbm "github.com/tendermint/tm-db"

abcitypes "github.com/tendermint/tendermint/abci/types"
cmtcfg "github.com/tendermint/tendermint/config"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tendermint/commands/reindex_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

abcitypes "github.com/tendermint/tendermint/abci/types"
cmtcfg "github.com/tendermint/tendermint/config"
Expand Down
2 changes: 1 addition & 1 deletion cmd/tendermint/commands/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/spf13/cobra"

dbm "github.com/tendermint/tm-db"
dbm "github.com/cometbft/cometbft-db"

cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/os"
Expand Down
Loading

0 comments on commit 29482fb

Please sign in to comment.