-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update docker * commment out contract test * update check * update workflow
- Loading branch information
Showing
12 changed files
with
71 additions
and
335 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name: pr_check | ||
name: run tests | ||
|
||
on: | ||
push: | ||
branches: [ "develop", "pull-request" ] | ||
branches: [ "develop"] | ||
pull_request: | ||
branches: [ "develop", "pull-request" ] | ||
branches: [ "develop"] | ||
|
||
jobs: | ||
build: | ||
|
@@ -28,16 +28,16 @@ jobs: | |
with: | ||
node-version: '21.x' | ||
|
||
- name: Run Unit tests for smart-contract | ||
run: make contract_test | ||
- name: Run tests for smart-contract | ||
run: make contract-test | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.22 | ||
|
||
- name: Run Unit tests. | ||
run: make unit_test | ||
- name: Run unit tests. | ||
run: make test | ||
|
||
- name: Upload Coverage report to CodeCov | ||
uses: codecov/[email protected] | ||
|
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,65 +1,47 @@ | ||
|
||
DOCKER_COMPOSE_TEST_FILE=./docker-compose-test.yaml | ||
|
||
e2e_test_depends_stop: | ||
@docker compose -f ${DOCKER_COMPOSE_TEST_FILE} down | ||
|
||
e2e_test_depends_start: | ||
@docker compose -p w3bstream-sprout -f ${DOCKER_COMPOSE_TEST_FILE} up -d | ||
|
||
.PHONY: e2e_test_depends | ||
e2e_test_depends: e2e_test_depends_stop e2e_test_depends_start | ||
|
||
e2e_test: e2e_test_depends | ||
@cd cmd/e2etest/ && CGO_LDFLAGS='-L../sequencer/lib/linux-x86_64 -lioConnectCore' go test ./... -v | ||
|
||
unit_test: | ||
GOARCH=amd64 go test -gcflags="all=-N -l" ./... -covermode=atomic -coverprofile cover.out | ||
|
||
.PHONY: contract_test_depends | ||
contract_test_depends: | ||
@cd smartcontracts && npm install --save-dev hardhat | ||
|
||
contract_test: contract_test_depends | ||
@cd smartcontracts && npx hardhat test | ||
|
||
# Variables | ||
BUILD_DIR=build | ||
DOCKER_APINODE_TARGET=ghcr.io/iotexproject/w3bstream-apinode:latest | ||
DOCKER_PROVER_TARGET=ghcr.io/iotexproject/w3bstream-prover:latest | ||
DOCKER_BOOTNODE_TARGET=ghcr.io/iotexproject/w3bstream-bootnode:latest | ||
DOCKER_SEQUENCER_TARGET=ghcr.io/iotexproject/w3bstream-sequencer:latest | ||
|
||
# Build targets | ||
.PHONY: build | ||
build: build-apinode build-prover build-bootnode build-sequencer | ||
|
||
.PHONY: build-apinode | ||
build-apinode: | ||
go build -o $(BUILD_DIR)/apinode cmd/apinode/main.go | ||
|
||
.PHONY: build-prover | ||
build-prover: | ||
go build -o $(BUILD_DIR)/prover cmd/prover/main.go | ||
|
||
.PHONY: build-bootnode | ||
build-bootnode: | ||
go build -o $(BUILD_DIR)/bootnode cmd/bootnode/main.go | ||
|
||
.PHONY: build-sequencer | ||
build-sequencer: | ||
go build -o $(BUILD_DIR)/sequencer cmd/sequencer/main.go | ||
|
||
# Docker targets | ||
.PHONY: images | ||
images: | ||
@for target in 'sequencer' 'prover' 'coordinator' ; \ | ||
do \ | ||
echo build $$target image; \ | ||
if [ -e $$target.Dockerfile ]; then \ | ||
echo $$target.Dockerfile; \ | ||
docker build -f $$target.Dockerfile . -t $$target; \ | ||
else \ | ||
echo "no entry"; \ | ||
fi; \ | ||
echo "done!"; \ | ||
done | ||
|
||
.PHONY: prover_image | ||
prover_image: | ||
@docker build -f prover.Dockerfile . -t prover | ||
docker build -f apinode.Dockerfile -t $(DOCKER_APINODE_TARGET) . | ||
docker build -f prover.Dockerfile -t $(DOCKER_PROVER_TARGET) . | ||
docker build -f bootnode.Dockerfile -t $(DOCKER_BOOTNODE_TARGET) . | ||
docker build -f sequencer.Dockerfile -t $(DOCKER_SEQUENCER_TARGET) . | ||
|
||
.PHONY: sequencer_image | ||
sequencer_image: | ||
@docker build -f sequencer.Dockerfile . -t sequencer | ||
.PHONY: test | ||
test: | ||
go test -gcflags="all=-N -l" ./... | ||
|
||
.PHONY: coordinator_image | ||
coordinator_image: | ||
@docker build -f coordinator.Dockerfile . -t coordinator | ||
|
||
MOD=$(shell cat go.mod | grep ^module -m 1 | awk '{ print $$2; }' || '') | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@echo ${MOD} | ||
@for item in `find . -type f -name '*.go' -not -path '*.pb.go'` ; \ | ||
do \ | ||
if [ -z ${MOD} ]; then \ | ||
goimports -w $$item ; \ | ||
else \ | ||
goimports -w -local "${MOD}" $$item ; \ | ||
fi \ | ||
done | ||
# Clean targets | ||
.PHONY: clean | ||
clean: | ||
@rm -rf $(BUILD_DIR) | ||
|
||
contract-test: | ||
@cd smartcontracts && npm install --save-dev hardhat | ||
@cd smartcontracts && npx hardhat test |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.