-
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.
Signed-off-by: Mark S. Lewis <[email protected]>
- Loading branch information
1 parent
56b5ed6
commit 2bd813b
Showing
46 changed files
with
460 additions
and
390 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 |
---|---|---|
|
@@ -4,61 +4,97 @@ | |
name: fabric-contract-api-go | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- release-* | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
license_check: | ||
name: License check | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://npm.pkg.github.com' | ||
- uses: actions/checkout@v4 | ||
- name: install Tools | ||
run: | | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
go install github.com/securego/gosec/v2/cmd/gosec@latest | ||
go install github.com/cucumber/godog/cmd/godog@latest | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
npm install -g [email protected] | ||
- 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 | ||
|
||
- name: Vet and lint | ||
run: ci/scripts/lint.sh | ||
|
||
- name: Check Licenses | ||
run: license-check-and-add check -f ci/license-config.json | ||
|
||
- name: Run tests (excluding fv) | ||
run: go test -race $(go list ./... | grep -v functionaltests) | ||
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 | ||
|
||
- name: Run functional tests | ||
working-directory: internal/functionaltests | ||
run: godog run features/* | ||
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 | ||
|
||
- name: Check tutorial contents | ||
run: ci/scripts/tutorial-checks.sh | ||
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 | ||
|
||
- name: Run the integration tests | ||
env: | ||
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 | ||
run: | | ||
docker build . --file integrationtest/Dockerfile --tag hyperledger/fabric-contract-api-go-integrationtest | ||
ci/scripts/setup-integration-chaincode.sh | ||
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 | ||
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 | ||
cd ./integrationtest | ||
npm ci | ||
npx fabric-chaincode-integration run | ||
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,22 @@ | ||
name: Pull request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- release-* | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
|
||
pull-request: | ||
needs: build | ||
name: Pull request success | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: "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
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,23 @@ | ||
# See https://golangci-lint.run/usage/configuration/ | ||
|
||
run: | ||
timeout: 5m | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- errcheck | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- typecheck | ||
- unused | ||
|
||
linters-settings: | ||
gocyclo: | ||
min-complexity: 18 |
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,39 @@ | ||
# 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: lint | ||
lint: staticcheck golangci-lint | ||
|
||
.PHONY: staticcheck | ||
staticcheck: | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
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 | ||
golangci-lint run | ||
|
||
.PHONY: unit-test | ||
unit-test: | ||
go test -race $$(go list '$(base_dir)/...' | 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 | ||
govulncheck '$(base_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 was deleted.
Oops, something went wrong.
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.