Skip to content

Merge pull request #3039 from SCADA-LTS/fix/#3038_Added_validation_fo… #338

Merge pull request #3039 from SCADA-LTS/fix/#3038_Added_validation_fo…

Merge pull request #3039 from SCADA-LTS/fix/#3038_Added_validation_fo… #338

Workflow file for this run

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 }}