-
Notifications
You must be signed in to change notification settings - Fork 589
64 lines (55 loc) · 2.17 KB
/
dashboard_pr.yml
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
name: Dashboard
on:
pull_request:
branches: [main]
paths: [dashboard/**, proto/**]
concurrency:
group: dashboard-build-${{ github.ref }}
cancel-in-progress: true
jobs:
dashboard-ui-build:
runs-on: ubuntu-latest
steps:
- name: Checkout forked repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/setup-node@v2
with:
node-version: "18"
- uses: arduino/setup-protoc@v1
with:
version: "3.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: build
working-directory: ./dashboard
run: |
echo "::group::npm install"
npm install
echo "::endgroup::"
npm run gen-proto
git add -A
if ! git diff --quiet --staged; then
git reset
echo "::error::Generated proto files are not up to date."
echo "::group::check if the branch is out-of-date"
git pull origin $GITHUB_HEAD_REF --unshallow
git remote add upstream https://github.com/risingwavelabs/risingwave.git
git fetch upstream $GITHUB_BASE_REF:$GITHUB_BASE_REF
echo "origin/$GITHUB_HEAD_REF: $(git rev-parse origin/$GITHUB_HEAD_REF)"
echo "upstream/$GITHUB_BASE_REF: $(git rev-parse upstream/$GITHUB_BASE_REF)"
git merge-base origin/$GITHUB_HEAD_REF upstream/$GITHUB_BASE_REF
FORK_POINT=$(git merge-base origin/$GITHUB_HEAD_REF upstream/$GITHUB_BASE_REF)
echo "FORK_POINT: $FORK_POINT"
echo "::endgroup::"
if ! git diff --quiet $FORK_POINT..upstream/$GITHUB_BASE_REF -- ../proto; then
echo "::error::Your branch is out-of-date. Please update your branch first and then run 'npm i && npm run gen-proto' at dashboard/ and commit the changes."
else
echo "::error::Please run 'npm i && npm run gen-proto' at dashboard/ and commit the changes."
fi
exit 1
fi
npm run lint
npm run build
npm run build-static