Skip to content

chore: add two tests for extra coverage #31

chore: add two tests for extra coverage

chore: add two tests for extra coverage #31

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- uses: golangci/golangci-lint-action@v9
with:
version: latest
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- run: go test -race ./...
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- name: Run coverage
run: |
go test -coverprofile=coverage.out ./pkg/api/... ./pkg/client/... ./pkg/scheduler/... ./pkg/controller/... ./pkg/kubelet/... ./pkg/store/...
TOTAL=$(go tool cover -func=coverage.out | grep ^total | awk '{print $3}')
echo "## Coverage: ${TOTAL}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage.out >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
benchmark:
name: run benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- name: Run benchmarks
run: |
go test -run=^$ -bench=. -benchmem ./... | tee bench.txt
- name: Post summary
run: |
echo "## Benchmark Results" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
grep -E "^(Benchmark|ok)" bench.txt >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
update-readme:
needs: [lint, test, coverage, benchmark]
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- name: Update README
run: bash coverage.sh
- name: Push changes
run: |
git diff --quiet README.md && exit 0
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs: update coverage and benchmark stats"
git push