|
7 | 7 | pull_request: |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - test: |
| 10 | + proto: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | steps: |
13 | 13 | - name: Checkout |
|
16 | 16 | fetch-depth: 0 |
17 | 17 |
|
18 | 18 | - name: Setup Go |
19 | | - uses: evalops/service-runtime/.github/actions/setup-go-service@ca09da8302203b96582332dbcababe9f2d906d10 |
| 19 | + uses: evalops/service-runtime/.github/actions/setup-go-service@cac5638c2935870453cf669e803936a80e17ac7b |
20 | 20 | with: |
21 | | - go-version-file: go.mod |
| 21 | + go-version: "1.26.2" |
22 | 22 | cache: true |
23 | 23 |
|
24 | 24 | - name: Setup Buf |
|
32 | 32 | go install connectrpc.com/connect/cmd/protoc-gen-connect-go@v1.19.1 |
33 | 33 |
|
34 | 34 | - name: Format |
35 | | - run: make fmt |
| 35 | + run: | |
| 36 | + make fmt |
| 37 | + git diff --exit-code |
36 | 38 |
|
37 | 39 | - name: Buf lint |
38 | 40 | run: buf lint |
|
41 | 43 | if: github.event_name == 'pull_request' |
42 | 44 | run: | |
43 | 45 | if git show origin/main:buf.yaml >/dev/null 2>&1; then |
44 | | - git fetch origin main:refs/remotes/origin/main |
45 | 46 | buf breaking --against '.git#ref=refs/remotes/origin/main' |
46 | 47 | else |
47 | 48 | echo "Skipping: no buf.yaml on main yet" |
|
50 | 51 | - name: Verify Proto Sync |
51 | 52 | run: make proto-check |
52 | 53 |
|
53 | | - - name: Vet |
54 | | - run: go vet ./... |
| 54 | + test: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 59 | + with: |
| 60 | + fetch-depth: 0 |
| 61 | + |
| 62 | + - name: Setup Go |
| 63 | + uses: evalops/service-runtime/.github/actions/setup-go-service@cac5638c2935870453cf669e803936a80e17ac7b |
| 64 | + with: |
| 65 | + go-version: "1.26.2" |
| 66 | + cache: true |
| 67 | + run-go-test: "true" |
| 68 | + go-test-race: "true" |
| 69 | + go-test-args: "./... -count=1" |
| 70 | + |
| 71 | + - name: Build |
| 72 | + run: go build ./... |
| 73 | + |
| 74 | + - name: Collect coverage |
| 75 | + id: coverage |
| 76 | + run: | |
| 77 | + go test ./... -coverprofile=coverage.out -covermode=atomic -count=1 |
| 78 | + coverage="$(go tool cover -func=coverage.out | awk '/^total:/ {sub(/%/, "", $3); print $3}')" |
| 79 | + echo "value=${coverage}" >> "$GITHUB_OUTPUT" |
| 80 | + awk -v got="${coverage}" -v floor="40" 'BEGIN { if ((got + 0) < (floor + 0)) exit 1 }' |
| 81 | +
|
| 82 | + - name: Publish coverage summary |
| 83 | + run: | |
| 84 | + echo "Total coverage: ${{ steps.coverage.outputs.value }}%" >> "$GITHUB_STEP_SUMMARY" |
| 85 | +
|
| 86 | + - name: Upload coverage artifact |
| 87 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 88 | + with: |
| 89 | + name: coverage.out |
| 90 | + path: coverage.out |
| 91 | + |
| 92 | + lint: |
| 93 | + runs-on: ubuntu-latest |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 97 | + with: |
| 98 | + fetch-depth: 0 |
| 99 | + |
| 100 | + - name: Setup Go |
| 101 | + uses: evalops/service-runtime/.github/actions/setup-go-service@cac5638c2935870453cf669e803936a80e17ac7b |
| 102 | + with: |
| 103 | + go-version: "1.26.2" |
| 104 | + cache: true |
| 105 | + run-golangci-lint: "true" |
| 106 | + golangci-lint-args: "--timeout=5m ./..." |
| 107 | + |
| 108 | + security: |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - name: Checkout |
| 112 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 113 | + with: |
| 114 | + fetch-depth: 0 |
| 115 | + |
| 116 | + - name: Setup Go |
| 117 | + uses: evalops/service-runtime/.github/actions/setup-go-service@cac5638c2935870453cf669e803936a80e17ac7b |
| 118 | + with: |
| 119 | + go-version: "1.26.2" |
| 120 | + cache: true |
| 121 | + run-gosec: "true" |
| 122 | + run-govulncheck: "true" |
55 | 123 |
|
56 | | - - name: Test |
57 | | - run: make test |
| 124 | + - name: Verify module checksums |
| 125 | + run: go mod verify |
0 commit comments