Skip to content

Add adhoc gRPC/REST backend for flutter-adhoc (M3 group B, WIP) #1459

Add adhoc gRPC/REST backend for flutter-adhoc (M3 group B, WIP)

Add adhoc gRPC/REST backend for flutter-adhoc (M3 group B, WIP) #1459

name: .NET Pull requests
on:
pull_request:
branches: [ master, stable, angular19 ]
paths-ignore:
- '**.md'
jobs:
backend-pn-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: eform-backendconfiguration-plugin
- name: 'Preparing Frontend checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-frontend
ref: stable
path: eform-angular-frontend
- name: 'Preparing items planning checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-items-planning-plugin
ref: stable
path: eform-angular-items-planning-plugin
- name: 'Preparing time planning checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-angular-timeplanning-plugin
ref: stable
path: eform-angular-timeplanning-plugin
- 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
cp -av eform-angular-timeplanning-plugin/eform-client/src/app/plugins/modules/time-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/time-planning-pn
rm -rf eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
cp -av eform-backendconfiguration-plugin/eform-client/src/app/plugins/modules/backend-configuration-pn eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
mkdir -p eform-angular-frontend/eFormAPI/eFormAPI.Web/Plugins
cd eform-angular-frontend/eform-client && ../../eform-angular-items-planning-plugin/testinginstallpn.sh
../../eform-angular-timeplanning-plugin/testinginstallpn.sh
../../eform-backendconfiguration-plugin/testinginstallpn.sh
- name: Copy frontendfiles
run: cp eform-backendconfiguration-plugin/Dockerfile .
- name: Build the tagged Docker image
run: docker build . -t microtingas/work-items-planning-container:latest -t microtingas/work-items-planning-container:1.0.0 --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0 --build-arg PLUGIN2VERSION=1.0.0 --build-arg PLUGIN3VERSION=1.0.0 --build-arg PLUGIN4VERSION=1.0.0 --build-arg PLUGIN5VERSION=1.0.0 --build-arg PLUGIN6VERSION=1.0.0
- name: Tag builds
run: |-
docker tag microtingas/work-items-planning-container:latest microtingas/work-items-planning-container:latest
- run: docker save microtingas/work-items-planning-container:latest -o work-items-planning-container.tar
- uses: actions/upload-artifact@v4
with:
name: work-items-planning-container
path: work-items-planning-container.tar
pn-playwright-test:
needs: backend-pn-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y]
steps:
- uses: actions/checkout@v3
with:
path: eform-backendconfiguration-plugin
- name: Extract branch name
id: extract_branch
run: |
BRANCH=$(echo ${GITHUB_REF#refs/heads/})
if [[ "$BRANCH" != "stable" && "$BRANCH" != "master" && "$BRANCH" != "angular19" ]]; then
BRANCH="stable"
fi
echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: work-items-planning-container
- run: docker load -i work-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 -e ALLOW_FAKE_TRANSLATE=true microtingas/work-items-planning-container:latest "/ConnectionString=host=mariadbtest;Database=420_Angular;user=root;password=secretpassword;port=3306;Convert Zero Datetime = true;SslMode=none;" "/api-key=FAKE_TRANSLATE_E2E" > docker_run_log 2>&1 &
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 22
- 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: 'Preparing ItemsPlanning checkout'
uses: actions/checkout@v3
with:
repository: microting/eform-angular-items-planning-plugin
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-items-planning-plugin
- name: 'Preparing TimePlanning checkout'
uses: actions/checkout@v3
with:
repository: microting/eform-angular-timeplanning-plugin
ref: ${{ steps.extract_branch.outputs.BRANCH }}
path: eform-angular-timeplanning-plugin
- 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
cp -av eform-angular-timeplanning-plugin/eform-client/src/app/plugins/modules/time-planning-pn eform-angular-frontend/eform-client/src/app/plugins/modules/time-planning-pn
rm -rf eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
cp -av eform-backendconfiguration-plugin/eform-client/src/app/plugins/modules/backend-configuration-pn eform-angular-frontend/eform-client/src/app/plugins/modules/backend-configuration-pn
mkdir -p eform-angular-frontend/eform-client/playwright/e2e/plugins/
cp -av eform-backendconfiguration-plugin/eform-client/playwright/e2e/plugins/backend-configuration-pn eform-angular-frontend/eform-client/playwright/e2e/plugins/backend-configuration-pn
cp -av eform-backendconfiguration-plugin/eform-client/playwright.config.ts eform-angular-frontend/eform-client/playwright.config.ts
cd eform-angular-frontend/eform-client && ../../eform-angular-items-planning-plugin/testinginstallpn.sh
../../eform-angular-timeplanning-plugin/testinginstallpn.sh
../../eform-backendconfiguration-plugin/testinginstallpn.sh
- name: yarn install
run: cd eform-angular-frontend/eform-client && yarn install
- name: Install Playwright browsers
run: cd eform-angular-frontend/eform-client && npx playwright install --with-deps chromium
- name: Create errorShots directory
run: mkdir 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/playwright/e2e/Constants/DatabaseConfigurationConstants.ts
- name: Get standard output
run: cat docker_run_log
- name: Wait for app
run: npx wait-on http://localhost:4200 --timeout 120000
- name: DB Configuration
run: cd eform-angular-frontend/eform-client && npx playwright test playwright/e2e/Tests/database-configuration/
- name: Change rabbitmq hostname
run: docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
- name: Enable plugins
if: matrix.test != 'a'
run: |
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
docker restart my-container
sleep 15
- name: Load DB dump
if: matrix.test == 'a'
run: |
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_Angular.EformPlugins set Status = 2'
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'drop database if exists `420_SDK`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'create database `420_SDK`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_SDK < eform-angular-frontend/eform-client/playwright/e2e/plugins/backend-configuration-pn/a/420_SDK.sql
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'drop database if exists `420_eform-backend-configuration-plugin`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'create database `420_eform-backend-configuration-plugin`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_eform-backend-configuration-plugin < eform-angular-frontend/eform-client/playwright/e2e/plugins/backend-configuration-pn/a/420_eform-backend-configuration-plugin.sql
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'drop database if exists `420_eform-angular-items-planning-plugin`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'create database `420_eform-angular-items-planning-plugin`'
docker exec -i mariadbtest mariadb -u root --password=secretpassword 420_eform-angular-items-planning-plugin < eform-angular-frontend/eform-client/playwright/e2e/plugins/backend-configuration-pn/a/420_eform-angular-items-planning-plugin.sql
docker exec -i mariadbtest mariadb -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"'
- name: Restart the Docker container
if: matrix.test == 'a'
run: docker restart my-container
- name: Sleep 15
if: matrix.test == 'a'
run: sleep 15
- name: Get standard output
run: |
cat docker_run_log
result=`cat docker_run_log | grep "Now listening on:.*:5000" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: Wait for app
run: npx wait-on http://localhost:4200 --timeout 120000
- name: ${{ matrix.test }} playwright test
run: |
cd eform-angular-frontend/eform-client
npx playwright test playwright/e2e/plugins/backend-configuration-pn/${{ matrix.test }}/
- 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:.*:5000" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: Get standard output
if: ${{ failure() }}
run: cat docker_run_log
- name: Archive Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.test }}
path: eform-angular-frontend/eform-client/playwright-report/
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: 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 -p 5672:5672 rabbitmq:latest
- name: Sleep 15
run: sleep 15
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.0.x
- name: Build
run: dotnet build eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.sln
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Test/BackendConfiguration.Pn.Test.csproj
- name: Integration Tests
run: dotnet test --no-restore -c Release -v n eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn.Integration.Test/BackendConfiguration.Pn.Integration.Test.csproj