-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (85 loc) · 2.29 KB
/
ci.yaml
File metadata and controls
88 lines (85 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
name: ci
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
proto_ref:
proto_sha:
push:
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for PRs
pull_request:
env:
BUF_REPO: "buf.build/aserto-dev/directory"
BUF_VERSION: 1.66.1
GO_VERSION: 1.26
GO_LANGCI_LINT_VERSION: 2.10.1
GO_TESTSUM_VERSION: 1.13.0
jobs:
build:
runs-on: ubuntu-latest
steps:
-
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
private-key: ${{ secrets.CODEGEN_APP_KEY }}
-
name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
-
name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
-
name: Setup buf
uses: bufbuild/buf-action@v1
with:
version: ${{ env.BUF_VERSION }}
setup_only: true
-
name: Delete generated code
run: |
rm -rf ./aserto
-
name: Get latest version tag from Buf Registry
id: buf-latest
run: |
echo "VERSION=$(buf registry module label list ${BUF_REPO} --format json | jq -r '.labels[0].name')" >> "$GITHUB_OUTPUT"
-
name: Buf Generate
run: |
echo "${{ env.BUF_REPO }}:${{ steps.buf-latest.outputs.VERSION }}"
buf generate ${{ env.BUF_REPO }}:${{ steps.buf-latest.outputs.VERSION }}
-
name: Lint
uses: golangci/golangci-lint-action@v9
with:
version: v${{ env.GO_LANGCI_LINT_VERSION }}
args: --timeout=5m
-
name: Test Setup
uses: gertd/action-gotestsum@v3.0.0
with:
gotestsum_version: ${{ env.GO_TESTSUM_VERSION }}
-
name: Test
run: |
gotestsum --format short-verbose -- -count=1 -parallel=1 -v -timeout=240s -coverprofile=cover.out -coverpkg=./... ./...
-
name: Commit changes
if: github.event_name == 'workflow_dispatch'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
add: 'aserto'