1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the 'License'); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an 'AS IS' BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ name : Frontend
17
+
18
+ on :
19
+ workflow_call :
20
+
21
+ concurrency :
22
+ group : frontend-${{ github.event.pull_request.number || github.ref }}
23
+ cancel-in-progress : true
24
+
25
+ jobs :
26
+ code-style :
27
+ name : Code Style Check
28
+ runs-on : ubuntu-latest
29
+ timeout-minutes : 10
30
+ steps :
31
+ - uses : actions/checkout@v3
32
+ with :
33
+ submodules : true
34
+ - name : Install Dependencies
35
+ run : |
36
+ cd ./seatunnel-engine/seatunnel-ui
37
+ npm install
38
+ - name : Check Code Style
39
+ run : |
40
+ cd ./seatunnel-engine/seatunnel-ui
41
+ npm run lint
42
+
43
+ sanity-check :
44
+ name : Sanity Check
45
+ needs : [ code-style ]
46
+ runs-on : ubuntu-latest
47
+ timeout-minutes : 10
48
+ steps :
49
+ - name : Verify Results
50
+ run : |
51
+ [[ ${{ needs.code-style.result }} == 'success' ]] || exit 1;
52
+
53
+ changes :
54
+ runs-on : ubuntu-latest
55
+ timeout-minutes : 10
56
+ outputs :
57
+ frontend-modules : ${{ steps.filter.outputs.modules }}
58
+ steps :
59
+ - uses : actions/checkout@v4
60
+ with :
61
+ fetch-depth : ' 2000'
62
+ - name : Check File Changes
63
+ id : filter
64
+ run : |
65
+ # Navigate to the frontend directory
66
+ cd seatunnel/seatunnel-engine/seatunnel-ui
67
+
68
+ # Use git to find changed files in the frontend directory
69
+ git fetch origin
70
+ CHANGED_FILES=$(git diff --name-only origin/main...HEAD | grep "^seatunnel/seatunnel-engine/seatunnel-ui/")
71
+
72
+ # If there are changes, list the affected modules
73
+ if [ -n "$CHANGED_FILES" ]; then
74
+ echo "modules=true" >> $GITHUB_OUTPUT
75
+ else
76
+ echo "modules=false" >> $GITHUB_OUTPUT
77
+ fi
78
+
79
+ unit-test :
80
+ needs : [ changes, sanity-check ]
81
+ if : needs.changes.outputs.frontend-modules == 'true'
82
+ runs-on : ubuntu-latest
83
+ strategy :
84
+ matrix :
85
+ node-version : [16.x, 18.x]
86
+ timeout-minutes : 60
87
+ steps :
88
+ - uses : actions/checkout@v3
89
+ - name : Set up Node.js ${{ matrix.node-version }}
90
+ uses : actions/setup-node@v3
91
+ with :
92
+ node-version : ${{ matrix.node-version }}
93
+ cache : ' npm'
94
+ - name : Install Dependencies
95
+ run : |
96
+ cd ./seatunnel-engine/seatunnel-ui
97
+ npm ci
98
+ - name : Run Unit Tests
99
+ run : |
100
+ cd ./seatunnel-engine/seatunnel-ui
101
+ npm test
0 commit comments