ci: add tests + coverage workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: nameserver | |
| - name: Checkout web4 (sibling protocol repo) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: TeoSlayer/pilotprotocol | |
| path: web4 | |
| - name: Checkout common | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: pilot-protocol/common | |
| ref: v0.1.0 | |
| path: common | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| cache: true | |
| cache-dependency-path: nameserver/go.sum | |
| - name: Run tests with coverage | |
| working-directory: nameserver | |
| run: go test -race -coverprofile=coverage.out -covermode=atomic ./... | |
| - name: Coverage summary | |
| working-directory: nameserver | |
| run: go tool cover -func=coverage.out | tail -20 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-nameserver | |
| path: nameserver/coverage.out | |
| retention-days: 30 |