Skip to content

Commit

Permalink
add codecov to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
小滋润 committed Nov 5, 2024
1 parent 4e6aa7d commit 4a7228a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
uses: ./.github/workflows/common-test-and-update-docs.yml
with:
ref: ${{ github.ref }}

secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

push-image:
needs: test-and-update-docs
uses: ./.github/workflows/common-push-image.yml
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/common-test-and-update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
ref:
required: true
type: string
secrets:
CODECOV_TOKEN:
required: true

jobs:
test-and-update-docs:
Expand All @@ -32,7 +35,6 @@ jobs:
run: |
docker exec leap-ledger-server sh -c "go install github.com/jstemmer/go-junit-report@latest"
docker exec leap-ledger-server sh -c "go test -v 2>&1 ./... -coverprofile=docs/coverage.out | go-junit-report > docs/test-report.xml"
docker exec leap-ledger-server sh -c "go tool cover -html=docs/coverage.out -o docs/coverage.html"
continue-on-error: false

- name: Upload test-report.xml
Expand All @@ -41,11 +43,20 @@ jobs:
name: test-report.xml
path: docs/test-report.xml

- name: Upload coverage.html
uses: actions/upload-artifact@v4
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
files: docs/coverage.out
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
name: coverage-report
path: docs/coverage.html
files: docs/test-report.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Execute updateDocs.sh in container
run: docker exec leap-ledger-server sh "./docs/updateDocs.sh"
Expand All @@ -62,6 +73,7 @@ jobs:
git commit -m "update docs" || echo "No changes to commit."
git push origin ${{ inputs.ref }}
fi
continue-on-error: true

- name: Docker Compose Down
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/develop-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
uses: ./.github/workflows/common-test-and-update-docs.yml
with:
ref: ${{ github.ref }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

push-image:
needs: test-and-update-docs
Expand Down

0 comments on commit 4a7228a

Please sign in to comment.