Skip to content

Commit a037c1c

Browse files
committed
execute benchspy tests in ci
1 parent 7dd3cfa commit a037c1c

File tree

5 files changed

+35
-206
lines changed

5 files changed

+35
-206
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: WASP's BenchSpy Go Tests
2+
on: [push]
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
jobs:
7+
test:
8+
defaults:
9+
run:
10+
working-directory: wasp
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: dorny/paths-filter@v3
15+
id: changes
16+
with:
17+
filters: |
18+
src:
19+
- 'wasp/benchspy/**'
20+
- uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30
21+
if: steps.changes.outputs.src == 'true'
22+
with:
23+
nix_path: nixpkgs=channel:nixos-unstable
24+
- name: Run tests
25+
if: steps.changes.outputs.src == 'true'
26+
run: |-
27+
nix develop -c make test_benchspy_race
28+
coverage=$(go tool cover -func=cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
29+
if (( $(echo "$coverage < 85" | bc -l) )); then
30+
echo "Test coverage $coverage% is below minimum 85%"
31+
exit 1
32+
fi
33+
echo "Test coverage: $coverage%"

lib/client/loki_test.go

Lines changed: 0 additions & 181 deletions
This file was deleted.

wasp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_race:
88

99
.PHONY: test_benchspy_race
1010
test_benchspy_race:
11-
go test -v -race -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
11+
go test -v -race -coverprofile cover.out -count 1 `go list ./... | grep -v examples | grep benchspy` -run TestBenchSpy
1212

1313
.PHONY: test_bench
1414
test_bench:

wasp/benchspy/report_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func TestBenchSpy_StandardReport_FetchData(t *testing.T) {
344344
})
345345
}
346346

347-
func TestStandardReport_IsComparable(t *testing.T) {
347+
func TestBenchSpy_StandardReport_IsComparable(t *testing.T) {
348348
baseTime := time.Now()
349349
basicGen := &wasp.Generator{
350350
Cfg: &wasp.Config{

wasp/benchspy/storage.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,3 @@ func extractTagsOrCommits(directory string) ([]string, error) {
182182

183183
return tagsOrCommits, nil
184184
}
185-
186-
func findLatestCommit(references []string) (string, error) {
187-
if len(references) == 0 {
188-
return "", fmt.Errorf("no references provided")
189-
}
190-
191-
args := append([]string{"rev-list", "--topo-order", "--date-order", "-n", "1"}, references...)
192-
cmd := exec.Command("git", args...)
193-
194-
var stdout, stderr bytes.Buffer
195-
cmd.Stdout = &stdout
196-
cmd.Stderr = &stderr
197-
if err := cmd.Run(); err != nil {
198-
return "", fmt.Errorf("failed to run git rev-list: %s, error: %v", stderr.String(), err)
199-
}
200-
201-
latestCommit := strings.TrimSpace(stdout.String())
202-
if latestCommit == "" {
203-
return "", fmt.Errorf("no latest commit found")
204-
}
205-
206-
return latestCommit, nil
207-
}

0 commit comments

Comments
 (0)