-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(weaver-go-sdk): revert fabric-protos-go-apiv2 dep to fabric-proto…
…s-go * Added a script to manually change go package names inside fabric-protos to fabric-protos-go-apiv2 (for future migration apiv2). * Added more unit and build tests covering all go modules * Added tools/go-mod-tidy.sh script to fix go.mod by running go mod tidy Signed-off-by: Sandeep Nishad <[email protected]>
- Loading branch information
1 parent
e6d5d88
commit 6994e5b
Showing
33 changed files
with
359 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,10 @@ jobs: | |
check_code_changed: | ||
outputs: | ||
interopcc_changed: ${{ steps.changes.outputs.interopcc_changed }} | ||
gosdk_changed: ${{ steps.changes.outputs.gosdk_changed }} | ||
gocli_changed: ${{ steps.changes.outputs.gocli_changed }} | ||
simplestate_changed: ${{ steps.changes.outputs.simplestate_changed }} | ||
satpsimpleasset_changed: ${{ steps.changes.outputs.satpsimpleasset_changed }} | ||
simpleasset_changed: ${{ steps.changes.outputs.simpleasset_changed }} | ||
simpleassetandinterop_changed: ${{ steps.changes.outputs.simpleassetandinterop_changed }} | ||
simpleassettransfer_changed: ${{ steps.changes.outputs.simpleassettransfer_changed }} | ||
|
@@ -35,9 +38,18 @@ jobs: | |
- 'weaver/core/network/fabric-interop-cc/**' | ||
- '.github/workflows/test_weaver-go.yaml' | ||
gosdk_changed: | ||
- 'weaver/sdks/fabric/go-sdk/**' | ||
gocli_changed: | ||
- 'weaver/samples/fabric/go-cli/**' | ||
simplestate_changed: | ||
- 'weaver/samples/fabric/simplestate/**' | ||
satpsimpleasset_changed: | ||
- 'weaver/samples/fabric/satpsimpleasset/**' | ||
simpleasset_changed: | ||
- 'weaver/samples/fabric/simpleasset/**' | ||
|
@@ -60,7 +72,7 @@ jobs: | |
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
run: make run-vendor || echo "If this steps fails and asks to run 'go mod tidy' then run the script 'tools/go-mod-tidy.sh' to update all go modules" | ||
working-directory: weaver/core/network/fabric-interop-cc/contracts/interop | ||
|
||
- name: Build | ||
|
@@ -95,6 +107,90 @@ jobs: | |
- name: Test | ||
run: go test -v ./... | ||
working-directory: weaver/core/network/fabric-interop-cc/interfaces/asset-mgmt | ||
|
||
build_test_libs_utils: | ||
needs: check_code_changed | ||
if: needs.check_code_changed.outputs.interopcc_changed == 'true' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
working-directory: weaver/core/network/fabric-interop-cc/libs/utils | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
working-directory: weaver/core/network/fabric-interop-cc/libs/utils | ||
|
||
build_test_libs_assetexchange: | ||
needs: check_code_changed | ||
if: needs.check_code_changed.outputs.interopcc_changed == 'true' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
working-directory: weaver/core/network/fabric-interop-cc/libs/assetexchange | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
working-directory: weaver/core/network/fabric-interop-cc/libs/assetexchange | ||
|
||
unit_test_sdk: | ||
needs: check_code_changed | ||
if: ${{ needs.check_code_changed.outputs.interopcc_changed == 'true' || needs.check_code_changed.outputs.gosdk_changed == 'true' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
working-directory: weaver/sdks/fabric/go-sdk | ||
|
||
- name: Build | ||
run: make build | ||
working-directory: weaver/sdks/fabric/go-sdk | ||
|
||
- name: Test | ||
run: make test | ||
working-directory: weaver/sdks/fabric/go-sdk | ||
|
||
build_test_cli: | ||
needs: check_code_changed | ||
if: ${{ needs.check_code_changed.outputs.interopcc_changed == 'true' || needs.check_code_changed.outputs.gocli_changed == 'true' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
working-directory: weaver/samples/fabric/go-cli | ||
|
||
- name: Build | ||
run: make build | ||
working-directory: weaver/samples/fabric/go-cli | ||
|
||
unit_test_simplestate: | ||
needs: check_code_changed | ||
|
@@ -120,6 +216,30 @@ jobs: | |
run: go test -v ./... | ||
working-directory: weaver/samples/fabric/simplestate | ||
|
||
unit_test_satpsimpleasset: | ||
needs: check_code_changed | ||
if: ${{ needs.check_code_changed.outputs.interopcc_changed == 'true' || needs.check_code_changed.outputs.satpsimpleasset_changed == 'true' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Go | ||
uses: actions/[email protected] | ||
with: | ||
go-version: '1.20.2' | ||
|
||
- name: Vendor | ||
run: make run-vendor | ||
working-directory: weaver/samples/fabric/satpsimpleasset | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
working-directory: weaver/samples/fabric/satpsimpleasset | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
working-directory: weaver/samples/fabric/satpsimpleasset | ||
|
||
unit_test_simpleasset: | ||
needs: check_code_changed | ||
if: ${{ needs.check_code_changed.outputs.interopcc_changed == 'true' || needs.check_code_changed.outputs.simpleasset_changed == 'true' }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Root of repo | ||
ROOT_DIR=${1:-'..'} | ||
|
||
GOMODULE_PATHS=("weaver/core/network/fabric-interop-cc/libs/utils" | ||
"weaver/core/network/fabric-interop-cc/libs/assetexchange" | ||
"weaver/core/network/fabric-interop-cc/interfaces/asset-mgmt" | ||
"weaver/core/network/fabric-interop-cc/contracts/interop" | ||
"weaver/sdks/fabric/go-sdk" | ||
"weaver/samples/fabric/go-cli" | ||
"weaver/samples/fabric/simpleasset" | ||
"weaver/samples/fabric/satpsimpleasset" | ||
"weaver/samples/fabric/simpleassetandinterop" | ||
"weaver/samples/fabric/simpleassettransfer" | ||
"weaver/samples/fabric/simplestatewithacl" | ||
"weaver/samples/fabric/simplestate") | ||
|
||
for GOMODULE in ${GOMODULE_PATHS[@]}; do | ||
echo "############# START $GOMODULE ################" | ||
pushd $ROOT_DIR/$GOMODULE > /dev/null | ||
make run-vendor || (go mod tidy && make run-vendor) # Run once for local build | ||
make undo-vendor | ||
go mod tidy # Run once for normal build | ||
popd > /dev/null | ||
echo "############# END $GOMODULE ################\n" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
CACTI_ROOTDIR = ../../.. | ||
|
||
.PHONY: build | ||
build: | ||
sh ../get-fabric-protos.sh ../.. | ||
sh build-protos.sh | ||
sh ../get-fabric-protos.sh $(CACTI_ROOTDIR)/weaver | ||
#sh update-fabprotos-go-pkg-name.sh $(CACTI_ROOTDIR)/weaver/common | ||
sh build-protos.sh $(CACTI_ROOTDIR)/weaver/common | ||
|
||
.PHONY: clean-build | ||
clean-build: | ||
rm -R `ls -1 -d ./*/` | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ../fabric-protos | ||
rm -rf ../fabric-protos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= | ||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= | ||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= | ||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= | ||
github.com/hyperledger/fabric-protos-go v0.3.0 h1:MXxy44WTMENOh5TI8+PCK2x6pMj47Go2vFRKDHB2PZs= | ||
github.com/hyperledger/fabric-protos-go v0.3.0/go.mod h1:WWnyWP40P2roPmmvxsUXSvVI/CF6vwY1K1UFidnKBys= | ||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= | ||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= | ||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||
github.com/hyperledger/fabric-protos-go v0.3.3 h1:0nssqz8QWJNVNBVQz+IIfAd2j1ku7QPKFSM/1anKizI= | ||
github.com/hyperledger/fabric-protos-go v0.3.3/go.mod h1:BPXse9gIOQwyAePQrwQVUcc44bTW4bB5V3tujuvyArk= | ||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= | ||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= | ||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= | ||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= | ||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= | ||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= | ||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= | ||
google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= | ||
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= | ||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= | ||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= | ||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= | ||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= | ||
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= | ||
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= | ||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= | ||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
ROOT_DIR=${1:-'..'} | ||
|
||
pushd $ROOT_DIR | ||
files=$(find ./fabric-protos -name *.proto) | ||
|
||
for filename in $files | ||
do | ||
sed -i'.scriptbak' -e ' s#^option go_package = "github.com/hyperledger/fabric-protos-go/#option go_package = "github.com/hyperledger/fabric-protos-go-apiv2/#' "$filename" | ||
rm -rf $filename.scriptbak | ||
cat $filename | grep "option go_package" | ||
done | ||
popd $ROOT_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.