From 9dc504582c9ca269bb8600a41a9b9093d1a2ff03 Mon Sep 17 00:00:00 2001 From: yihuang Date: Wed, 28 Feb 2024 16:23:02 +0800 Subject: [PATCH] nixify unit test --- .github/workflows/build.yml | 19 ++++++++++--------- Makefile | 6 +++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f637bc61e..06a471ff87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,9 +58,6 @@ jobs: nix_path: nixpkgs=channel:nixos-22.11 extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-go@v3 - with: - go-version: '^1.22.0' - id: changed-files uses: tj-actions/changed-files@v41 with: @@ -68,13 +65,17 @@ jobs: **/*.go *.mod *.sum + - uses: cachix/cachix-action@v12 + if: steps.changed-files.outputs.any_changed == 'true' + with: + name: cronos + # github don't pass secrets for pull request from fork repos, + # in that case the push is disabled naturally. + signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - name: test & coverage report creation run: | - make test - - # run versiondb tests - cd ./versiondb - nix-shell -I nixpkgs=../nix -p rocksdb go_1_22 --run "go test -v -mod=readonly ./... -tags rocksdb,grocksdb_clean_link -coverprofile=coverage.txt" + nix develop -c make test + nix develop .#rocksdb -c make test-versiondb if: steps.changed-files.outputs.any_changed == 'true' - name: filter out proto files run: | @@ -88,7 +89,7 @@ jobs: - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.txt,./memiavl/coverage.txt,./versiondb/coverage.txt + files: ./coverage.txt,./memiavl/coverage.txt,./store/coverage.txt,./versiondb/coverage.txt fail_ci_if_error: true if: steps.changed-files.outputs.any_changed == 'true' diff --git a/Makefile b/Makefile index 573f820fc0..057281c06c 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,11 @@ install: check-network print-ledger go.sum test: @go test -v -mod=readonly $(PACKAGES) -coverprofile=$(COVERAGE) -covermode=atomic - @cd memiavl; go test -v -mod=readonly ./ -coverprofile=$(COVERAGE) -covermode=atomic + @cd memiavl; go test -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic; cd .. + @cd store; go test -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic; cd .. + +test-versiondb: + @cd versiondb; go test -tags rocksdb -v -mod=readonly ./... -coverprofile=$(COVERAGE) -covermode=atomic; cd .. .PHONY: clean build install test