Skip to content

closes #931

closes #931 #847

name: .NET Master
on:
push:
branches: [ master, stable, angular15 ]
paths-ignore:
- '**.md'
- '.github/**'
jobs:
insight-dashboard-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: eform-angular-insight-dashboard-plugin
- name: Extract branch name
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-frontend
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-frontend
- name: Copy dependencies
run: |
cp -av eform-angular-insight-dashboard-plugin/eform-client/src/app/plugins/modules/insight-dashboard-pn eform-angular-frontend/eform-client/src/app/plugins/modules/insight-dashboard-pn
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
cd eform-angular-frontend/eform-client && ../../eform-angular-insight-dashboard-plugin/testinginstallpn.sh
- name: Get the version release
id: get_release_version
run: echo ::set-output name=VERSION::$(cd main && git describe --abbrev=0 --tags | cut -d "v" -f 2)
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(cd eform-angular-insight-dashboard-plugin && git describe --abbrev=0 --tags | cut -d "v" -f 2)
- name: Get the work order version
id: get_frontend_version
run: echo ::set-output name=FRONTENDVERSION::$(cd eform-angular-frontend && git describe --abbrev=0 --tags | cut -d "v" -f 2)
- name: Copy Dockerfile
run: cp eform-angular-insight-dashboard-plugin/Dockerfile .
- name: Build the tagged Docker image
run: docker build . -t microtingas/insight-dashboard-container:latest -t microtingas/insight-dashboard-container:1.0.0 --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0
- run: docker save microtingas/insight-dashboard-container:latest -o insight-container.tar
- uses: actions/upload-artifact@v3
with:
name: insight-container
path: insight-container.tar
insight-dashboard-test:
needs: insight-dashboard-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [a,b,c,d,e,f,g]
steps:
- uses: actions/checkout@v3
with:
path: eform-angular-insight-dashboard-plugin
- name: Extract branch name
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Create docker network
run: docker network create --driver bridge data
- name: Start MariaDB
run: |
docker pull mariadb:10.8
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
- uses: actions/download-artifact@v3
with:
name: insight-container
- run: docker load -i insight-container.tar
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.18.2
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v3
with:
repository: microting/eform-angular-frontend
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-frontend
- name: Sleep 15 seconds
run: sleep 15
- name: Load DB dump
run: |
mysql -u root -h 127.0.0.1 --password=secretpassword -e 'create database `420_SDK`'
mysql -u root -h 127.0.0.1 --password=secretpassword 420_SDK < eform-angular-insight-dashboard-plugin/420_SDK.sql
- name: Copy dependencies
run: |
cp -av eform-angular-insight-dashboard-plugin/eform-client/src/app/plugins/modules/insight-dashboard-pn eform-angular-frontend/eform-client/src/app/plugins/modules/insight-dashboard-pn
cp -av eform-angular-insight-dashboard-plugin/eform-client/e2e/Tests/insight-dashboard-settings eform-angular-frontend/eform-client/e2e/Tests/insight-dashboard-settings
cp -av eform-angular-insight-dashboard-plugin/eform-client/e2e/Tests/insight-dashboard-general eform-angular-frontend/eform-client/e2e/Tests/insight-dashboard-general
cp -av eform-angular-insight-dashboard-plugin/eform-client/e2e/Page\ objects/InsightDashboard eform-angular-frontend/eform-client/e2e/Page\ objects/InsightDashboard
cp -av eform-angular-insight-dashboard-plugin/eform-client/wdio-headless-plugin-step2${{matrix.test}}.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2${{matrix.test}}.conf.ts
cp -av eform-angular-insight-dashboard-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts
mkdir -p eform-angular-frontend/eform-client/cypress/e2e/plugins/
cp -av eform-angular-insight-dashboard-plugin/eform-client/cypress/e2e/plugins/insight-dashboard-pn eform-angular-frontend/eform-client/cypress/e2e/plugins/insight-dashboard-pn
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
cd eform-angular-frontend/eform-client && ../../eform-angular-insight-dashboard-plugin/testinginstallpn.sh
- name: yarn install
run: cd eform-angular-frontend/eform-client && yarn install
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container -p 4200:5000 --network data microtingas/insight-dashboard-container:latest "/ConnectionString=host=mariadbtest;Database=420_Angular;user=root;password=secretpassword;port=3306;Convert Zero Datetime = true;SslMode=none;" > docker_run_log 2>&1 &
- name: Sleep 15 seconds
run: sleep 15
- name: Get standard output
run: cat docker_run_log
- name: Pretest changes to work with Docker container
run: sed -i 's/localhost/mariadbtest/g' eform-angular-frontend/eform-client/e2e/Constants/DatabaseConfigurationConstants.ts
- name: DB Configuration
uses: cypress-io/github-action@v4
with:
start: echo 'hi'
wait-on: "http://localhost:4200"
wait-on-timeout: 120
browser: chrome
record: false
spec: cypress/e2e/db/*
config-file: cypress.config.ts
working-directory: eform-angular-frontend/eform-client
- name: Plugin testing
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin2${{matrix.test}}
- name: a test
continue-on-error: true
uses: cypress-io/github-action@v4
with:
start: echo 'hi'
wait-on: "http://localhost:4200"
wait-on-timeout: 120
browser: chrome
record: false
spec: cypress/e2e/plugins/items-planning-pn/a/*
config-file: cypress.config.ts
working-directory: eform-angular-frontend/eform-client
- name: Stop the newly build Docker container
run: docker stop my-container
- name: Get standard output
run: |
cat docker_run_log
result=`cat docker_run_log | grep "Now listening on: http://0.0.0.0:5000" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: The job has failed
if: ${{ failure() }}
run: |
cat docker_run_log
- name: Archive screenshot artifacts
if: ${{ failure() }}s
uses: actions/upload-artifact@v3
with:
name: error Screenshots
path: |
/home/runner/work/eform-angular-insight-dashboard-plugin/eform-angular-insight-dashboard-plugin/eform-angular-frontend/eform-client/errorShots/chrome*.png
insight-dashboard-test-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: eform-angular-insight-dashboard-plugin
- name: Create docker network
run: docker network create --driver bridge data
- name: Start MariaDB
run: |
docker pull mariadb:10.8
docker run --name mariadbtest --network data -e MYSQL_ROOT_PASSWORD=secretpassword -p 3306:3306 -d mariadb:10.8
- name: Sleep 15 seconds
run: sleep 15
- name: Load DB dump
run: |
mysql -u root -h 127.0.0.1 --password=secretpassword -e 'create database `420_SDK`'
mysql -u root -h 127.0.0.1 --password=secretpassword 420_SDK < eform-angular-insight-dashboard-plugin/420_SDK.sql
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build eform-angular-insight-dashboard-plugin/eFormAPI/Plugins/InsightDashboard.Pn/InsightDashboard.Pn.sln
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eform-angular-insight-dashboard-plugin/eFormAPI/Plugins/InsightDashboard.Pn/InsightDashboard.Pn.Test/InsightDashboard.Pn.Test.csproj