Skip to content

Commit

Permalink
WIP - code cov for all
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Sep 8, 2023
1 parent a8c253b commit 28748b7
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 79 deletions.
76 changes: 0 additions & 76 deletions .github/workflows/code-test-coverage.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,32 @@ jobs:

- name: Run the tests, showing name of each test
run: make test:ci

- name: Upload coverage to Codecov without token, retry on failure
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret == ''
uses: Wandalen/[email protected]
with:
attempt_limit: 5
attempt_delay: 10000
action: codecov/codecov-action@v3
with: |
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
- name: Upload coverage to Codecov with token
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret != ''
uses: codecov/codecov-action@v3
with:
token: ${{ env.codecov_secret }}
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
29 changes: 29 additions & 0 deletions .github/workflows/test-collection-named.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,32 @@ jobs:
- name: Run tests with Collection Named mutations
run: make test:ci-col-named-mutations

- name: Upload coverage to Codecov without token, retry on failure
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret == ''
uses: Wandalen/[email protected]
with:
attempt_limit: 5
attempt_delay: 10000
action: codecov/codecov-action@v3
with: |
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
- name: Upload coverage to Codecov with token
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret != ''
uses: codecov/codecov-action@v3
with:
token: ${{ env.codecov_secret }}
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
29 changes: 29 additions & 0 deletions .github/workflows/test-gql-mutations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,32 @@ jobs:
- name: Run tests with gql mutations
run: make test:ci-gql-mutations

- name: Upload coverage to Codecov without token, retry on failure
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret == ''
uses: Wandalen/[email protected]
with:
attempt_limit: 5
attempt_delay: 10000
action: codecov/codecov-action@v3
with: |
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
- name: Upload coverage to Codecov with token
env:
codecov_secret: ${{ secrets.CODECOV_TOKEN }}
if: env.codecov_secret != ''
uses: codecov/codecov-action@v3
with:
token: ${{ env.codecov_secret }}
name: defradb-codecov
files: ./coverage.txt
os: 'linux'
fail_ci_if_error: true
verbose: true
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ test\:build:
test\:ci:
DEFRA_BADGER_MEMORY=true DEFRA_BADGER_FILE=true \
DEFRA_CLIENT_GO=true DEFRA_CLIENT_HTTP=true \
$(MAKE) test:all
go-acc ./... --output=coverage.txt --covermode=atomic -- -coverpkg=./... $(TEST_FLAGS)
go tool cover -func coverage.txt | grep total | awk '{print $$3}'

.PHONY: test\:ci-gql-mutations
test\:ci-gql-mutations:
DEFRA_MUTATION_TYPE=gql DEFRA_BADGER_MEMORY=true \
DEFRA_CLIENT_GO=true DEFRA_CLIENT_HTTP=true \
$(MAKE) test:all
go-acc ./... --output=coverage.txt --covermode=atomic -- -coverpkg=./... $(TEST_FLAGS)
go tool cover -func coverage.txt | grep total | awk '{print $$3}'

.PHONY: test\:gql-mutations
test\:gql-mutations:
Expand All @@ -210,7 +212,8 @@ test\:gql-mutations:
test\:ci-col-named-mutations:
DEFRA_MUTATION_TYPE=collection-named DEFRA_BADGER_MEMORY=true \
DEFRA_CLIENT_GO=true DEFRA_CLIENT_HTTP=true \
$(MAKE) test:all
go-acc ./... --output=coverage.txt --covermode=atomic -- -coverpkg=./... $(TEST_FLAGS)
go tool cover -func coverage.txt | grep total | awk '{print $$3}'

.PHONY: test\:col-named-mutations
test\:col-named-mutations:
Expand Down

0 comments on commit 28748b7

Please sign in to comment.