-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2 implementation based on fabric-chaincode-go/v2 (#137)
The v2 implementation retains wire-level compatibility with Fabric but does include the following breaking changes: - Chaincode implementations that make direct use of fabric-protos-go will experience protocol buffer namespace conflicts (as described in https://protobuf.dev/reference/go/faq/). Any use of fabric-protos-go must be replaced by fabric-protos-go-apiv2. Signed-off-by: Mark S. Lewis <[email protected]>
- Loading branch information
1 parent
66f7b67
commit b8b28e7
Showing
83 changed files
with
17,018 additions
and
114 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 |
---|---|---|
|
@@ -8,93 +8,11 @@ on: | |
workflow_call: | ||
|
||
jobs: | ||
license_check: | ||
name: License check | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: install Tools | ||
run: | | ||
npm install -g [email protected] | ||
- name: Check Licenses | ||
run: license-check-and-add check -f ci/license-config.json | ||
checks: | ||
uses: ./.github/workflows/check.yml | ||
|
||
tutorial: | ||
name: Check tutorial | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Check tutorial contents | ||
run: ci/scripts/tutorial-checks.sh | ||
test-v1: | ||
uses: ./.github/workflows/test-v1.yml | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Staticcheck | ||
run: make staticcheck | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: latest | ||
|
||
unit_test: | ||
name: Unit test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run tests (excluding fv) | ||
run: make unit-test | ||
|
||
functional_test: | ||
name: Functional test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run functional tests | ||
run: make functional-test | ||
|
||
integration_test: | ||
name: Integration test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: Run the integration tests | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
docker build . --file integrationtest/Dockerfile --tag hyperledger/fabric-contract-api-go-integrationtest | ||
ci/scripts/setup-integration-chaincode.sh | ||
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- samples binary docker | ||
export TEST_NETWORK_DIR=$(pwd)/fabric-samples/test-network | ||
cd ./integrationtest | ||
npm ci | ||
npx fabric-chaincode-integration run | ||
test-v2: | ||
uses: ./.github/workflows/test-v2.yml |
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,19 @@ | ||
# Copyright the Hyperledger Fabric contributors. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Checks | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
tutorial: | ||
name: Check tutorial | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Check tutorial contents | ||
run: ci/scripts/tutorial-checks.sh |
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,73 @@ | ||
# Copyright the Hyperledger Fabric contributors. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Test (v1) | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Staticcheck | ||
run: make -f Makefile.v1 staticcheck | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: latest | ||
|
||
unit_test: | ||
name: Unit test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run tests (excluding fv) | ||
run: make -f Makefile.v1 unit-test | ||
|
||
functional_test: | ||
name: Functional test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run functional tests | ||
run: make -f Makefile.v1 functional-test | ||
|
||
integration_test: | ||
name: Integration test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: Run the integration tests | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
docker build . --file integrationtest/Dockerfile --tag hyperledger/fabric-contract-api-go-integrationtest | ||
ci/scripts/setup-integration-chaincode.sh | ||
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- samples binary docker | ||
export TEST_NETWORK_DIR=$(pwd)/fabric-samples/test-network | ||
cd ./integrationtest | ||
npm ci | ||
npx fabric-chaincode-integration run |
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,74 @@ | ||
# Copyright the Hyperledger Fabric contributors. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Test (v2) | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Staticcheck | ||
run: make staticcheck | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: latest | ||
working-directory: v2 | ||
|
||
unit_test: | ||
name: Unit test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run tests (excluding fv) | ||
run: make unit-test | ||
|
||
functional_test: | ||
name: Functional test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run functional tests | ||
run: make functional-test | ||
|
||
integration_test: | ||
name: Integration test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://npm.pkg.github.com" | ||
- name: Run the integration tests | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
docker build . --file integrationtest/Dockerfile --tag hyperledger/fabric-contract-api-go-integrationtest | ||
ci/scripts/setup-integration-chaincode.sh | ||
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- samples binary docker | ||
export TEST_NETWORK_DIR=$(pwd)/fabric-samples/test-network | ||
cd ./integrationtest | ||
npm ci | ||
npx fabric-chaincode-integration run |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright the Hyperledger Fabric contributors. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
base_dir := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST))))) | ||
functional_dir := $(base_dir)/internal/functionaltests | ||
go_bin_dir := $(shell go env GOPATH)/bin | ||
|
||
.PHONY: test | ||
test: lint unit-test functional-test | ||
|
||
.PHONY: lint | ||
lint: staticcheck golangci-lint | ||
|
||
.PHONY: staticcheck | ||
staticcheck: | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
cd '$(base_dir)' && staticcheck -f stylish ./... | ||
|
||
.PHONY: install-golangci-lint | ||
install-golangci-lint: | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b '$(go_bin_dir)' | ||
|
||
$(go_bin_dir)/golangci-lint: | ||
$(MAKE) install-golangci-lint | ||
|
||
.PHONY: golangci-lint | ||
golangci-lint: $(go_bin_dir)/golangci-lint | ||
cd '$(base_dir)' && golangci-lint run | ||
|
||
.PHONY: unit-test | ||
unit-test: | ||
cd '$(base_dir)' && go test -race $$(go list ./... | grep -v functionaltests) | ||
|
||
.PHONY: functional-test | ||
functional-test: | ||
go install github.com/cucumber/godog/cmd/[email protected] | ||
cd '$(functional_dir)' && godog run features/* | ||
|
||
.PHONY: scan | ||
scan: | ||
go install golang.org/x/vuln/cmd/govulncheck@latest | ||
cd '$(base_dir)' && govulncheck ./... |
Oops, something went wrong.