Skip to content

scaffolds maintainer-d API and workspaces for kcp #17

scaffolds maintainer-d API and workspaces for kcp

scaffolds maintainer-d API and workspaces for kcp #17

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- master
- develop
pull_request:
branches:
- main
- master
- develop
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.24.x']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Verify dependencies
run: go mod verify
- name: Run go vet
run: go vet ./...
- name: Run go fmt
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "Please run 'go fmt ./...' to format the code"
gofmt -s -l .
exit 1
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
- name: Run tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Display coverage summary
run: go tool cover -func=coverage.out | tail -n 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
with:
file: ./coverage.out
flags: unittests
name: codecov-maintainerd
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
test-by-package:
name: Test by Package
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- db
- onboarding
- plugins/fossa
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
cache: true
- name: Test ${{ matrix.package }}
run: |
cd ${{ matrix.package }}
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Display coverage for ${{ matrix.package }}
run: |
cd ${{ matrix.package }}
if [ -f coverage.out ]; then
echo "Coverage for ${{ matrix.package }}:"
go tool cover -func=coverage.out | tail -n 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.x'
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --timeout=5m