Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Reintroduce the MapStore interface and SimpleMap and make the Badger a submodules #33

Merged
merged 33 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bb08623
feat: move benchmarks into docs folder, tidy readme and docs
h5law Dec 23, 2023
89dee09
feat: update gitignore
h5law Dec 23, 2023
dedc8f3
feat: cleanup and update workflow file
h5law Dec 23, 2023
2d215eb
feat: make codecov reports informational only
h5law Dec 23, 2023
63a9c3a
feat: add badger as a submodule
h5law Dec 22, 2023
83a994a
chore: makefile changes
h5law Dec 22, 2023
bcc569f
chore: update workflow to cover submodule tests
h5law Dec 22, 2023
4280986
chore: revert go version to 1.20.12
h5law Dec 23, 2023
0ce48aa
chore: unexport simpleMap MapStore implementation
h5law Dec 23, 2023
27dd854
chore: add kvstore package godoc
h5law Dec 23, 2023
66beac1
chore: s/badger/v4/g
h5law Dec 23, 2023
a0ebc3f
chore: use custom errors and wrap badgerv4 errors
h5law Dec 23, 2023
719ea55
squash: merged feat/doc-changes
h5law Jan 3, 2024
7a0f8fb
chore: add executable code examples
h5law Jan 3, 2024
17ccf68
feat: move interface out of submodule declarations and add simplemap …
h5law Jan 3, 2024
e4670f1
chore: better submodule support
h5law Jan 3, 2024
4518387
chore: grammar
h5law Jan 3, 2024
afeb02e
chore: fix example tests
h5law Jan 3, 2024
a64495a
s/name/desc/g
h5law Jan 3, 2024
f88a178
chore: clarify godoc
h5law Jan 3, 2024
81ff1b8
chore: refactor to use simplemap submodules
h5law Jan 3, 2024
e9892b1
chore: fix tests to cover simplemap submodule
h5law Jan 3, 2024
2d70eb0
chore: update godocs
h5law Jan 3, 2024
71ec219
feat: add SMT specific errors
h5law Jan 3, 2024
9bcd021
chore: add simplestore MapStore complaiance check
h5law Jan 3, 2024
f927cf2
chore: address comments
h5law Jan 3, 2024
6850a8a
chore: interface commennts
h5law Jan 3, 2024
fee3061
chore: s/name/desc/g
h5law Jan 3, 2024
a7c793c
chore: address comments
h5law Jan 3, 2024
9b1371c
chore: indentation
h5law Jan 3, 2024
27461f3
Merge branch 'main' into feat/badger-submodule
h5law Jan 3, 2024
538dcb5
chore: add simple to simplemap description
h5law Jan 3, 2024
58cc541
chore: address final comments
h5law Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Only post coverage comments and not pass/fail reports in the CI checks
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
59 changes: 24 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test & Build
name: Go Tests

on:
pull_request:
Expand All @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

env:
TARGET_GOLANG_VERSION: "1.20.11"
TARGET_GOLANG_VERSION: "1.20.12"

jobs:
tests:
Expand All @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147
fetch-depth: "0"

- name: Setup go
uses: actions/setup-go@v4
Expand All @@ -37,20 +37,36 @@ jobs:
skip-cache: true
only-new-issues: true

- name: Install gocovmerge
run: go install github.com/wadey/gocovmerge@latest

- name: Create coverage report and run tests
run: |
# Run each of the tests (excluding benchmarks) outputting the JSON
# to the test_results.json file for usage in later steps.
set -euo pipefail
GODEBUG=netdns=cgo go test -p 1 -json ./ -mod=readonly -timeout 8m -race -coverprofile=coverage.txt -covermode=atomic 2>&1 | tee test_results.json
go test -v -json -p 1 ./ -mod=readonly -race -coverprofile=coverage1.txt -covermode=atomic 2>&1 | tee test_results.json
go test -v -json -p 1 ./kvstore/simplemap/... -mod=readonly -race -coverprofile=coverage2.txt -covermode=atomic 2>&1 | tee -a test_results.json
go test -v -json -p 1 ./kvstore/badger/... -mod=readonly -race -coverprofile=coverage3.txt -covermode=atomic 2>&1 | tee -a test_results.json
# Combine coverage reports
gocovmerge coverage1.txt coverage2.txt coverage3.txt > coverage.txt

- name: Sanitize test results
# We're utilizing `tee` above which can capture non-json stdout output so we need to remove non-json lines before additional parsing and submitting it to the external github action.
# We're utilizing `tee` above which can capture non-json stdout output
# so we need to remove non-json lines before additional parsing and
# submitting it to the external github action.
run: cat test_results.json | jq -c -R 'fromjson? | select(type == "object")' > tmp.json && mv tmp.json test_results.json

- name: Output test failures
# Makes it easier to find failed tests so no need to scroll through the whole log.
if: ${{ failure() }}
run: |
jq --argjson fail_tests "$(jq -c -r 'select(.Action == "fail") | select(.Test) | .Test' test_results.json | jq -R -s -c -r 'split("\n") | map(select(length>0))')" 'select(.Test as $t | ($fail_tests | arrays)[] | select($t == .)) | select(.Output) | .Output' test_results.json | jq -r | sed ':a;N;$!ba;s/\n\n/\n/g' > test_failures.json
jq --argjson fail_tests "$( \
jq -c -r 'select(.Action == "fail") | select(.Test) | .Test' test_results.json \
| jq -R -s -c 'split("\n") | map(select(length > 0))' \
)" \
'select(.Test as $t | ($fail_tests | arrays)[] | select($t == .)) | select(.Output) | .Output' test_results.json \
| jq -r \
| sed ':a;N;$!ba;s/\n\n/\n/g' > test_failures.json
cat test_failures.json
exit 1

Expand All @@ -62,7 +78,6 @@ jobs:
test_*.json

- name: Annotate tests on GitHub
# Only annotate if the test failed on target version to avoid duplicated annotations on GitHub.
uses: guyarb/[email protected]
with:
test-results: test_results.json
Expand All @@ -71,30 +86,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt

build:
runs-on: ubuntu-latest
needs: tests
strategy:
fail-fast: false
matrix:
goarch: ["arm64", "amd64"]
timeout-minutes: 5
name: Build for ${{ matrix.goarch }}
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.TARGET_GOLANG_VERSION }}

- uses: actions/checkout@v3

- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
**/**.go
go.mod
go.sum

- name: Go build
run: GOOS=linux GOARCH=${{ matrix.goarch }} go build
if: env.GIT_DIFF
verbose: true
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# macos files
# Ignore Mac OS X system files
.DS_Store

# goland
.idea/
# Ignore asdf local tool-versions file
.tool-versions

# Ignore Goland and JetBrains IDE files
.idea/
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
SHELL := /bin/bash

.SILENT:

#####################
Expand Down Expand Up @@ -42,6 +40,21 @@ go_docs: check_godoc ## Generate documentation for the project
.PHONY: test_all
test_all: ## runs the test suite
go test -v -p 1 ./ -mod=readonly -race
go test -v -p 1 ./kvstore/simplemap/... -mod=readonly -race

.PHONY: test_badger
test_badger: ## runs the badger KVStore submodule's test suite
go test -v -p 1 ./kvstore/badger/... -mod=readonly -race


#####################
### go mod ###
#####################
.PHONY: mod_tidy
mod_tidy: ## runs go mod tidy for all (sub)modules
go mod tidy
h5law marked this conversation as resolved.
Show resolved Hide resolved
cd kvstore/simplemap && go mod tidy
cd kvstore/badger && go mod tidy

#####################
### Benchmark ###
Expand Down
Loading
Loading