-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (144 loc) · 4.44 KB
/
proto-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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Proto CI Pipeline
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: proto
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run buf-lint
uses: bufbuild/buf-lint-action@v1
with:
input: proto
- name: Setup Node
uses: actions/setup-node@v4
- name: Install spectral
run: npm install --location=global @stoplight/spectral-cli
- name: Run spectral
run: spectral lint ./**/v1/*.yaml --ruleset .spectral.yaml --fail-severity warn
breaking:
name: Check Breaking Changes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run buf-breaking
uses: bufbuild/buf-action@v1
with:
input: proto
breaking: true
breaking_against: https://github.com/ictsc/ictsc-regalia.git#branch=main,subdir=proto
format:
name: Format
runs-on: ubuntu-latest
defaults:
run:
working-directory: proto
steps:
- name: Generate a token
id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PUSHER_APP_ID }}
private-key: ${{ secrets.PUSHER_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
- name: Install buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Format
run: |
buf format --write
- name: Push
id: push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "run buf format"
branch: ${{ github.head_ref }}
commit_user_name: ictsc-actions[bot]
commit_user_email: 154957684+ictsc-actions[bot]@users.noreply.github.com
commit_author: ictsc-actions[bot] <154957684+ictsc-actions[bot]@users.noreply.github.com>
- name: Exit with Error If Files Are Changed
if: steps.push.outputs.changes_detected == 'true'
run: exit 1
generate:
name: Generation
runs-on: ubuntu-latest
needs: format
steps:
- name: Generate a token
id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.PUSHER_APP_ID }}
private-key: ${{ secrets.PUSHER_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.token.outputs.token }}
# Setup backend
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Install buf
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Setup frontend
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: frontend/package.json
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
- name: Install dependencies
working-directory: frontend
run: pnpm install
# Generate
- name: Generate backend
run: task generate
- name: Generate frontend
working-directory: frontend
run: pnpm generate:proto
- name: Push
id: push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "generate & oapi files"
branch: ${{ github.head_ref }}
commit_user_name: ictsc-actions[bot]
commit_user_email: 154957684+ictsc-actions[bot]@users.noreply.github.com
commit_author: ictsc-actions[bot] <154957684+ictsc-actions[bot]@users.noreply.github.com>
- name: Exit with Error If Files Are Changed
if: steps.push.outputs.changes_detected == 'true'
run: exit 1