Skip to content

Commit

Permalink
nixify unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Feb 28, 2024
1 parent 096ab66 commit 9dc5045
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,24 @@ 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:
files: |
**/*.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: |
Expand All @@ -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'

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9dc5045

Please sign in to comment.