mirror of
https://github.com/larksuite/cli.git
synced 2026-07-06 16:18:05 +08:00
* feat: cli e2e test framework and demo * feat: add cli-e2e-testcase-writer skill and task case * feat: add cli e2e config and fix test resource prefix
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Coverage
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "**.go"
|
|
- "!tests/cli_e2e/**"
|
|
- go.mod
|
|
- go.sum
|
|
- .github/workflows/coverage.yml
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "**.go"
|
|
- "!tests/cli_e2e/**"
|
|
- go.mod
|
|
- go.sum
|
|
- .github/workflows/coverage.yml
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Fetch meta data
|
|
run: python3 scripts/fetch_meta.py
|
|
|
|
- name: Run tests with coverage
|
|
run: |
|
|
packages=$(go list ./... | grep -v '^github.com/larksuite/cli/tests/cli_e2e$' | grep -v '^github.com/larksuite/cli/tests/cli_e2e/')
|
|
go test -race -coverprofile=coverage.txt -covermode=atomic $packages
|
|
|
|
- name: Generate coverage report
|
|
run: |
|
|
total=$(go tool cover -func=coverage.txt | grep total | awk '{print $3}')
|
|
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Total coverage: ${total}**" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "<details><summary>Details</summary>" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
go tool cover -func=coverage.txt >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
echo "</details>" >> $GITHUB_STEP_SUMMARY
|