-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (94 loc) · 2.62 KB
/
ci.yaml
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
89
90
91
92
93
94
95
96
97
98
name: ci
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
proto_ref:
proto_sha:
push:
branches:
- main
- v*
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for PRs
pull_request:
env:
VAULT_ADDR: https://vault.eng.aserto.com/
BUF_REPO: "buf.build/aserto-dev/aserto"
BUF_VERSION: "1.34.0"
BUF_BETA_SUPPRESS_WARNINGS: 1
GO_VERSION: "1.22"
GO_LANGCI_LINT_VERSION: "v1.56.2"
GO_TESTSUM_VERSION: "1.11.0"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "USERNAME" | GH_USERNAME;
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN;
kv/data/buf.build "ASERTO_BUF_USER" | BUF_USER;
kv/data/buf.build "ASERTO_BUF_TOKEN" | BUF_TOKEN;
-
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
-
name: Setup buf
uses: bufbuild/buf-setup-action@v1
with:
version: ${{ env.BUF_VERSION }}
github_token: ${{ github.token }}
buf_user: ${{ steps.vault.outputs.BUF_USER }}
buf_api_token: ${{ steps.vault.outputs.BUF_TOKEN}}
-
name: Delete generated code
run: |
rm -rf ./aserto
-
name: Get latest version tag from Buf Registry
id: buf-latest
run: |
echo "VERSION=$(buf beta registry label list ${BUF_REPO} --format json --reverse | jq -r '.results[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@v4
with:
version: ${{ env.GO_LANGCI_LINT_VERSION }}
args: --timeout=30m
-
name: Test Setup
uses: gertd/[email protected]
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'