-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1823 Change GHActions workflow settings.
Separate GHActions workflow to 2 different tasks. One will be responsible for building the stable version of Scada-LTS and the second one will be producing the docker image with PR code merged. As it was before.
- Loading branch information
Showing
2 changed files
with
178 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
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.52 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
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@v2 | ||
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://downloads.apache.org/tomcat/tomcat-9/v9.0.52/bin/apache-tomcat-9.0.52.tar.gz; tar xvzf apache-tomcat-9.0.52.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@v2 | ||
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@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- name: Cache node modules | ||
id: nodeCache | ||
uses: actions/cache@v2 | ||
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_HEAD_REF $GITHUB_SHA $GITHUB_ACTOR $GITHUB_BASE_REF | ||
- name: Build User Interface | ||
working-directory: ./scadalts-ui | ||
run: npm run-script build | ||
- name: Cache Frontend | ||
uses: actions/cache@v2 | ||
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.52 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
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@v2 | ||
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@v2 | ||
with: | ||
key: ${{ runner.os }}-slts-${{ github.run_id }} | ||
path: ./build/ | ||
- name: Load Cached Frontend | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ runner.os }}-frontend-${{ github.run_id }} | ||
path: ./scadalts-ui/dist | ||
- 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@v2 | ||
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@v2 | ||
with: | ||
key: ${{ runner.os }}-war-${{ github.run_id }} | ||
path: ./build/libs/Scada-LTS.war | ||
- name: Deploy WAR artifact | ||
uses: actions/upload-artifact@v2 | ||
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@v2 | ||
- name: Load WAR file to cache | ||
uses: actions/cache@v2 | ||
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@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |