-
Notifications
You must be signed in to change notification settings - Fork 292
191 lines (186 loc) · 6.29 KB
/
master.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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Scada-LTS build stable version workflow
on:
push:
branches:
- 'master'
- 'develop'
- 'release/[0-9].[0-9]+.[0-9]+'
tags:
- 'v*'
release:
types: [published]
jobs:
compile:
name: Compile and Test Scada-LTS application
runs-on: ubuntu-latest
env:
CATALINA_HOME: /home/runner/tomcat/apache-tomcat-9.0.86
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Tomcat
uses: actions/cache@v3
with:
key: ${{ runner.os }}-tomcat-${{ github.run_id }}
path: /home/runner/tomcat
restore-keys: |
${{ runner.os }}-tomcat-
- name: Install Tomcat
run: mkdir -p /home/runner/tomcat; cd /home/runner/tomcat; wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.86/bin/apache-tomcat-9.0.86.tar.gz; tar xvzf apache-tomcat-9.0.86.tar.gz
- name: Show Tomcat
run: ls $CATALINA_HOME
- name: Test JUnit Scada Application
run: gradle test
- name: Build Scada-LTS WAR Application
run: gradle -PskipUi=true compileJava
- name: Cache Scada-LTS application
uses: actions/cache@v3
with:
key: ${{ runner.os }}-slts-${{ github.run_id }}
path: ./build/
buildui:
name: Test and Build Scada-LTS new User Interface
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 22.9.0
- name: Cache node modules
id: nodeCache
uses: actions/cache@v3
with:
path: ./scadalts-ui/node_modules
key: ${{ runner.os }}-node-${{ github.run_id }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ github.run_id }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.nodeCache.outputs.cache-hit != 'true'
working-directory: ./scadalts-ui
run: npm install
- name: Run Frontend UnitTests
working-directory: ./scadalts-ui
run: npm run-script test:unit
- name: Get Scada-LTS latest release version
id: relver
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: SCADA-LTS
repo: Scada-LTS
- name: Prepare Application Vairables
working-directory: ./scadalts-ui
run: npm run-script build-config -- ${{ steps.relver.outputs.release }} $GITHUB_RUN_ID $GITHUB_REF $GITHUB_SHA $GITHUB_ACTOR
- name: Build User Interface
working-directory: ./scadalts-ui
run: npm run-script build
- name: Cache Frontend
uses: actions/cache@v3
with:
key: ${{ runner.os }}-frontend-${{ github.run_id }}
path: ./scadalts-ui/dist
war:
name: Build WAR archive
needs: [compile, buildui]
runs-on: ubuntu-latest
env:
CATALINA_HOME: /home/runner/tomcat/apache-tomcat-9.0.86
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
- name: Load Cached node modules
uses: actions/cache@v3
with:
path: ./scadalts-ui/node_modules
key: ${{ runner.os }}-node-${{ github.run_id }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ github.run_id }}-${{ hashFiles('**/package-lock.json') }}
- name: Load Cached Scada-LTS application
uses: actions/cache@v3
with:
key: ${{ runner.os }}-slts-${{ github.run_id }}
path: ./build/
- name: Load Cached Frontend
uses: actions/cache@v3
with:
key: ${{ runner.os }}-frontend-${{ github.run_id }}
path: ./scadalts-ui/dist
- name: Get Scada-LTS latest release version
id: relverjava
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: SCADA-LTS
repo: Scada-LTS
- name: Prepare Application Enviroment Version Vairables
working-directory: ./
run: ./version.sh ${{ steps.relverjava.outputs.release }} $GITHUB_RUN_ID $GITHUB_REF $GITHUB_SHA $GITHUB_ACTOR "stable"
- name: Install static web-dependencies
working-directory: ./WebContent/resources
run: npm install
- name: Build Scada Application
run: gradle -PskipUi=true war
- name: Save WAR file to cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-war-${{ github.run_id }}
path: ./build/libs/Scada-LTS.war
deploy-artefact:
name: Deploy Scada-LTS as Artifact
needs: [war]
runs-on: ubuntu-latest
steps:
- name: Load WAR file to cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-war-${{ github.run_id }}
path: ./build/libs/Scada-LTS.war
- name: Deploy WAR artifact
uses: actions/upload-artifact@v3
with:
name: Scada-LTS
path: ./build/libs/Scada-LTS.war
deploy-docker:
name: Deploy Scada-LTS as Docker Image
needs: [ war ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Load WAR file to cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-war-${{ github.run_id }}
path: ./build/libs/Scada-LTS.war
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: scadalts/scadalts
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}