Skip to content

closes #1486

closes #1486 #1437

name: .NET Master
on:
push:
branches: [ master, stable, angular15 ]
paths-ignore:
- '**.md'
- '.github/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: eform-angular-items-planning-plugin
- name: Extract branch
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- 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: Copy dependencies
run: |
cp -av eform-angular-items-planning-plugin/eform-client/src/app/plugins/modules/items-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/items-planning-pn
cd eform-angular-frontend/eform-client && ../../eform-angular-items-planning-plugin/testinginstallpn.sh
- name: Copy Dockerfile
run: cp eform-angular-items-planning-plugin/Dockerfile .
- name: Build Docker image
id: build
run: |
pwd
ls -lah
docker build . -t microtingas/frontend-container:latest --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0
shell: bash
- run: docker save microtingas/frontend-container:latest -o items-planning-container.tar
- uses: actions/upload-artifact@v3
with:
name: items-planning-container
path: items-planning-container.tar
test:
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
test: [a,b,c]
steps:
- uses: actions/checkout@v3
with:
path: main
- uses: actions/[email protected]
with:
name: items-planning-container
- run: docker load -i items-planning-container.tar
- name: Create docker network
run: docker network create --driver bridge --attachable 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: Start rabbitmq
run: |
docker pull rabbitmq:latest
docker run -d --hostname my-rabbit --name some-rabbit --network data -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=password rabbitmq:latest
- name: Sleep 15
run: sleep 15
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container -p 4200:5000 --network data microtingas/frontend-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: Use Node.ts
uses: actions/setup-node@v3
with:
node-version: 20
- name: Extract branch name
id: extract_branch
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v2
with:
repository: microting/eform-angular-frontend
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-frontend
- name: Copy dependencies
run: |
cp -av main/eform-client/src/app/plugins/modules/items-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/items-planning-pn
cp -av main/eform-client/e2e/Tests/items-planning-settings eform-angular-frontend/eform-client/e2e/Tests/items-planning-settings
cp -av main/eform-client/e2e/Tests/items-planning-general eform-angular-frontend/eform-client/e2e/Tests/items-planning-general
cp -av main/eform-client/e2e/Page\ objects/ItemsPlanning eform-angular-frontend/eform-client/e2e/Page\ objects/ItemsPlanning
cp -av main/eform-client/e2e/Assets eform-angular-frontend/eform-client/e2e
cp -av main/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 main/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 main/eform-client/cypress/e2e/plugins/items-planning-pn eform-angular-frontend/eform-client/cypress/e2e/plugins/items-planning-pn
#mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
#cp -av main/eFormAPI/eFormAPI.Web/Plugins/ItemsPlanning eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins/ItemsPlanning
cd eform-angular-frontend/eform-client && ../../main/testinginstallpn.sh
- name: yarn install
run: cd eform-angular-frontend/eform-client && yarn install
- name: Create errorShots directory
run: mkdir /home/runner/work/eform-angular-items-planning-plugin/eform-angular-items-planning-plugin/eform-angular-frontend/eform-client/errorShots
- 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
command-prefix: "--"
- name: Load DB dump
if: matrix.test == 'a'
run: |
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 1'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'drop database `420_SDK`'
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_SDK`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_SDK < eform-angular-frontend/eform-client/cypress/e2e/plugins/items-planning-pn/a/420_sdk.sql
- name: Change rabbitmq hostname
if: ${{ matrix.test != 'a' }}
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
- name: ${{matrix.test}} 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/${{matrix.test}}/*
config-file: cypress.config.ts
working-directory: eform-angular-frontend/eform-client
command-prefix: "--"
- name: Plugin testing
run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin2${{matrix.test}}
- name: The job has failed
if: ${{ failure() }}
run: |
cat docker_run_log
- name: Archive screenshot artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: error Screenshots
path: |
/home/runner/work/eform-angular-items-planning-plugin/eform-angular-items-planning-plugin/eform-angular-frontend/eform-client/errorShots/chrome*.png
/home/runner/work/eform-angular-items-planning-plugin/eform-angular-items-planning-plugin/eform-angular-frontend/eform-client/cypress/videos/*.mp4
retention-days: 2
test-dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create docker network
run: docker network create --driver bridge --attachable 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
run: sleep 15
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build eFormAPI/Plugins/ItemsPlanning.Pn/ItemsPlanning.Pn.sln
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/ItemsPlanning.Pn/ItemsPlanning.Pn.Test/ItemsPlanning.Pn.Test.csproj