Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create config fix tool #14342

Merged
merged 32 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bc015b1
feat: create config fix tool
julienrbrt Dec 16, 2022
3760019
Merge branch 'main' into julien/config-fix
julienrbrt Jan 2, 2023
d3909d9
wip
julienrbrt Jan 4, 2023
6822b81
updates
julienrbrt Jan 4, 2023
fbe2f40
wip
julienrbrt Jan 4, 2023
b0fcfa9
Merge branch 'main' into julien/config-fix
julienrbrt Jan 4, 2023
52325e9
updates
julienrbrt Jan 5, 2023
c4130ff
update changelog
julienrbrt Jan 5, 2023
5588b8f
Merge branch 'main' into julien/config-fix
julienrbrt Jan 5, 2023
61924ff
add tests and diff command
julienrbrt Jan 5, 2023
34388a6
updates
julienrbrt Jan 5, 2023
81a8f52
renaming
julienrbrt Jan 5, 2023
25d24fc
updates
julienrbrt Jan 5, 2023
79eb103
wip
julienrbrt Jan 6, 2023
f2cabde
Merge branch 'main' into julien/config-fix
julienrbrt Jan 6, 2023
ee11e8b
naming
julienrbrt Jan 6, 2023
a98c4ee
store value in diff
julienrbrt Jan 6, 2023
77be207
finish migrate (only comments addition missing)
julienrbrt Jan 6, 2023
14210fa
Merge branch 'main' into julien/config-fix
julienrbrt Jan 8, 2023
1dfd460
add section comments
julienrbrt Jan 8, 2023
c425738
parse comments from diff
julienrbrt Jan 8, 2023
1643cc7
remove dep and imp tests
julienrbrt Jan 9, 2023
86fd670
Merge branch 'main' into julien/config-fix
julienrbrt Jan 9, 2023
598817d
chore: add docs
julienrbrt Jan 9, 2023
d6f21ca
fix tests
julienrbrt Jan 9, 2023
942ae4e
fix tests
julienrbrt Jan 9, 2023
de3794d
Merge branch 'main' into julien/config-fix
julienrbrt Jan 9, 2023
bda3028
Merge branch 'main' into julien/config-fix
julienrbrt Jan 9, 2023
a6bac20
use tagged version
julienrbrt Jan 9, 2023
a99937f
Merge branch 'main' into julien/config-fix
julienrbrt Jan 10, 2023
d87310d
go mod tidy all
julienrbrt Jan 10, 2023
4e19b7f
go mod tidy
julienrbrt Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"C:Rosetta":
- contrib/rosetta/**/*
- tools/rosetta/**/*
"C:Confix":
- tools/confix/**/*
"C:Keys":
- client/keys/**/*
"Type: Build":
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,24 @@ jobs:
**/go.sum
**/Makefile
Makefile
###################
#### Build App ####
###################
- name: Build
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build Legacy
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false COSMOS_BUILD_OPTIONS=legacy make build
###################
## Build Tooling ##
###################
- name: Build Cosmovisor
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor
- name: Build Rosetta
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make rosetta
- name: Build Confix
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make confix
38 changes: 38 additions & 0 deletions .github/workflows/release-confix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release Confix

on:
push:
tags:
- "tools/confix/v*.*.*"
permissions:
contents: read

jobs:
goreleaser:
permissions:
contents: write # for goreleaser/goreleaser-action to create a GitHub release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.4
# get 'v*.*.*' part from 'confix/v*.*.*' and save to $GITHUB_ENV
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/confix/}" >> $GITHUB_ENV
# remove the possible pre-existing same tag for cosmos-sdk related tags instead of confix tags
# Because goreleaser enforces semantic versioning and will error on non compliant tags.(https://goreleaser.com/limitations/semver/)
- name: Tag without prefix locally to avoid error in goreleaser
run: |-
git tag -d ${{ env.RELEASE_VERSION }} || echo "No such a tag exists before"
git tag ${{ env.RELEASE_VERSION }} HEAD
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
# stick to version v0.179.0(https://github.com/cosmos/cosmos-sdk/issues/11125)
version: v0.179.0
args: release --rm-dist --skip-validate --release-notes ./RELEASE_NOTES.md
workdir: tools/confix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: confix/${{ env.RELEASE_VERSION }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,33 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_COSMOVISOR }}
with:
projectBaseDir: tools/cosmovisor/

test-confix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.4
cache: true
cache-dependency-path: tools/confix/go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
tools/confix/**/*.go
tools/confix/go.mod
tools/confix/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd tools/confix
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
- name: sonarcloud
if: env.GIT_DIFF
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CONFIX }}
with:
projectBaseDir: tools/confix/
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ cosmovisor:
rosetta:
$(MAKE) -C tools/rosetta rosetta

.PHONY: build build-linux-amd64 build-linux-arm64 cosmovisor rosetta
confix:
$(MAKE) -C tools/confix confix

.PHONY: build build-linux-amd64 build-linux-arm64 cosmovisor rosetta confix


mocks: $(MOCKS_DIR)
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ docs/docs/spec
docs/docs/architecture
docs/docs/tooling/01-cosmovisor.md
docs/docs/tooling/02-depinject.md
docs/docs/tooling/03-confix.md
docs/run-node/04-rosetta.md

# Misc
Expand Down
1 change: 1 addition & 0 deletions docs/docs/tooling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ This section provides documentation on various tooling used in development of a
* [Protocol Buffers](./00-protobuf.md)
* [Cosmovisor](./01-cosmovisor.md)
* [Depinject](./02-depinject.md)
* [Confix](./03-confix.md)
1 change: 1 addition & 0 deletions docs/post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
find docs/modules ! -name '_category_.json' -type f -exec rm -rf {} +
rm -rf docs/tooling/01-cosmovisor.md
rm -rf docs/tooling/02-depinject.md
rm -rf docs/tooling/03-confix.md
rm -rf docs/run-node/04-rosetta.md
rm -rf docs/architecture
rm -rf docs/spec
Expand Down
5 changes: 2 additions & 3 deletions docs/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ cp ../x/auth/tx/README.md ./docs/modules/auth/2-tx.md
## Add modules page list
cat ../x/README.md | sed 's/\.\.\/docs\/building-modules\/README\.md/\/building-modules\/intro\.html/g' > ./docs/modules/README.md

## Add cosmovisor documentation
## Add tooling documentation
cp ../tools/cosmovisor/README.md ./docs/tooling/01-cosmovisor.md

## Add depinject documentation
cp ../depinject/README.md ./docs/tooling/02-depinject.md
cp ../tools/confix/README.md ./docs/tooling/03-confix.md

## Add rosetta documentation
cp ../tools/rosetta/README.md ./docs/run-node/04-rosetta.md
Expand Down
1 change: 1 addition & 0 deletions go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ use (
./tests
./tools/rosetta
./tools/cosmovisor
./tools/confix
)
1 change: 1 addition & 0 deletions tools/confix/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/confix
34 changes: 34 additions & 0 deletions tools/confix/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
project_name: confix

release:
disable: false
name_template: "{{.Tag}}"

before:
hooks:
- go mod tidy

builds:
- main: ./cmd/confix
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0

archives:
- name_template: '{{ replace .Version "confix/" "confix-" }}-{{ .Os }}-{{ .Arch }}'
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'SHA256SUMS-{{ replace .Version "confix/" "confix-" }}.txt'
algorithm: sha256

changelog:
skip: false
11 changes: 11 additions & 0 deletions tools/confix/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/make -f

all: confix test

confix:
go build -mod=readonly ./cmd/confix

test:
go test -mod=readonly -race ./...

.PHONY: all confix test
5 changes: 5 additions & 0 deletions tools/confix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 1
---

# Confix
1 change: 1 addition & 0 deletions tools/confix/cmd/confix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package cmd
1 change: 1 addition & 0 deletions tools/confix/cmd/confix/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
3 changes: 3 additions & 0 deletions tools/confix/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module cosmossdk.io/confix
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved

go 1.19
15 changes: 15 additions & 0 deletions tools/confix/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sonar.projectKey=cosmos-sdk-tools-confix
sonar.organization=cosmos

sonar.projectName=Cosmos SDK - Confix
sonar.project.monorepo.enabled=true

sonar.sources=.
sonar.exclusions=**/*_test.go
sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.go.coverage.reportPaths=coverage.out

sonar.sourceEncoding=UTF-8
sonar.scm.provider=git
sonar.pullrequest.github.summary_comment=true