зеркало из https://github.com/github/vitess-gh.git
Check for vtadmin JS types drift in CI (#10256)
* Add vtadmin web proto check workflow/shell script. Signed-off-by: Rohit Nayak <rohit@planetscale.com> * Add generated files to change list check. Signed-off-by: Rohit Nayak <rohit@planetscale.com>
This commit is contained in:
Родитель
0503be2777
Коммит
f6c3831e71
|
@ -0,0 +1,49 @@
|
|||
name: check_make_vtadmin_web_proto
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Check Make VTAdmin Web Proto
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check for changes in relevant files
|
||||
uses: frouioui/paths-filter@main
|
||||
id: changes
|
||||
with:
|
||||
token: ''
|
||||
filters: |
|
||||
proto_changes:
|
||||
- 'bootstrap.sh'
|
||||
- 'tools/**'
|
||||
- 'build.env'
|
||||
- 'go.[sumod]'
|
||||
- 'Makefile'
|
||||
- 'go/vt/proto/**'
|
||||
- 'proto/*.proto'
|
||||
- 'web/vtadmin/src/proto/**'
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
if: steps.changes.outputs.proto_changes == 'true'
|
||||
with:
|
||||
go-version: 1.18.1
|
||||
|
||||
- name: Setup Node
|
||||
if: steps.changes.outputs.proto_changes == 'true'
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
# node-version should match package.json
|
||||
node-version: '16.13.0'
|
||||
|
||||
- name: Install npm dependencies
|
||||
if: steps.changes.outputs.proto_changes == 'true'
|
||||
run: npm ci
|
||||
working-directory: ./web/vtadmin
|
||||
|
||||
- name: check_make_vtadmin_web_proto
|
||||
if: steps.changes.outputs.proto_changes == 'true'
|
||||
run: |
|
||||
tools/check_make_vtadmin_web_proto.sh
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
source build.env
|
||||
|
||||
first_output=$(git status --porcelain)
|
||||
|
||||
make vtadmin_web_proto_types
|
||||
|
||||
second_output=$(git status --porcelain)
|
||||
|
||||
diff=$(diff <( echo "$first_output") <( echo "$second_output"))
|
||||
|
||||
if [[ "$diff" != "" ]]; then
|
||||
echo "ERROR: Regenerated vtadmin web proto files do not match the current version."
|
||||
echo -e "List of files containing differences:\n$diff"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "VTAdmin Web Protos are up to date"
|
Загрузка…
Ссылка в новой задаче