Makefile+action: add make unit-module to test submodules
This commit adds a new command `make unit-module` to run unit tests for submodules to avoid future build errors.
This commit is contained in:
3 files changed
+34
No files matched your search
@@ -186,6 +186,8 @@ jobs:
|
|||||||
- unit tags="kvdb_postgres"
|
- unit tags="kvdb_postgres"
|
||||||
- unit tags="kvdb_sqlite"
|
- unit tags="kvdb_sqlite"
|
||||||
- btcd unit-race
|
- btcd unit-race
|
||||||
|
- unit-module
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: git checkout
|
- name: git checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -217,6 +219,7 @@ jobs:
|
|||||||
path-to-profile: coverage.txt
|
path-to-profile: coverage.txt
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# run ubuntu integration tests
|
# run ubuntu integration tests
|
||||||
########################
|
########################
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ unit: $(BTCD_BIN)
|
|||||||
@$(call print, "Running unit tests.")
|
@$(call print, "Running unit tests.")
|
||||||
$(UNIT)
|
$(UNIT)
|
||||||
|
|
||||||
|
unit-module:
|
||||||
|
@$(call print, "Running submodule unit tests.")
|
||||||
|
scripts/unit_test_modules.sh
|
||||||
|
|
||||||
unit-debug: $(BTCD_BIN)
|
unit-debug: $(BTCD_BIN)
|
||||||
@$(call print, "Running debug unit tests.")
|
@$(call print, "Running debug unit tests.")
|
||||||
$(UNIT_DEBUG)
|
$(UNIT_DEBUG)
|
||||||
|
|||||||
Executable
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
IGNORE="tools"
|
||||||
|
SUBMODULES=$(find . -mindepth 2 -name "go.mod" | cut -d'/' -f2 | grep -v "$IGNORE")
|
||||||
|
|
||||||
|
for submodule in $SUBMODULES
|
||||||
|
do
|
||||||
|
pushd $submodule
|
||||||
|
|
||||||
|
echo "Running submodule unit tests in $(pwd)"
|
||||||
|
echo "testing $submodule..."
|
||||||
|
go test -timeout=5m || exit 1
|
||||||
|
|
||||||
|
if [[ "$submodule" == "kvdb" ]]
|
||||||
|
then
|
||||||
|
echo "testing $submodule with sqlite..."
|
||||||
|
go test -tags="kvdb_sqlite" -timeout=5m || exit 1
|
||||||
|
|
||||||
|
echo "testing $submodule with postgres..."
|
||||||
|
go test -tags="kvdb_postgres" -timeout=5m || exit 1
|
||||||
|
|
||||||
|
echo "testing $submodule with etcd..."
|
||||||
|
go test -tags="kvdb_etcd" -timeout=5m || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
||||||
|
done
|
||||||
Reference in new issue
Block a user