Fixing github actions script. #585
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
name: .NET Master | |
on: | |
push: | |
branches: [ master, stable, angular15 ] | |
jobs: | |
greate-belt-pn-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: eform-angular-greate-belt-plugin | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
- 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 items planning checkout' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: microting/eform-angular-items-planning-plugin | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
path: eform-angular-items-planning-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-greate-belt-plugin/eform-client/src/app/plugins/modules/greate-belt-pn eform-angular-frontend/eform-client/src/app/plugins/modules/greate-belt-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-greate-belt-plugin/testinginstallpn.sh | |
- name: Copy Dockerfile | |
run: cp eform-angular-greate-belt-plugin/Dockerfile . | |
- name: Build the tagged Docker image | |
run: docker build . -t microtingas/greate-belt-container:latest -t microtingas/greate-belt-container:1.0.0 --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0 --build-arg PLUGIN4VERSION=1.0.0 | |
- name: Tag builds | |
run: |- | |
docker tag microtingas/greate-belt-container:latest microtingas/greate-belt-container:latest | |
- run: docker save microtingas/greate-belt-container:latest -o greate-belt-container.tar | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: greate-belt-container | |
path: greate-belt-container.tar | |
greate-betl-pn-test: | |
needs: greate-belt-pn-build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: eform-angular-greate-belt-plugin | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: greate-belt-container | |
- run: docker load -i greate-belt-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: Start the newly build Docker container | |
id: docker-run | |
run: docker run --name my-container -p 4200:5000 --network data microtingas/greate-belt-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 | |
run: sleep 15 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- 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: Cache node_modules | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: eform-angular-frontend/eform-client/node_modules | |
key: ${{ runner.os }}-build-${{ hashFiles('eform-angular-frontend/eform-client/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- 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: Copy dependencies | |
run: | | |
cp -av eform-angular-greate-belt-plugin/eform-client/src/app/plugins/modules/greate-belt-pn eform-angular-frontend/eform-client/src/app/plugins/modules/greate-belt-pn | |
#cp -av eform-angular-greate-belt-plugin/eform-client/wdio-headless-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-headless-plugin-step2.conf.ts | |
#cp -av eform-angular-greate-belt-plugin/eform-client/wdio-plugin-step2.conf.ts eform-angular-frontend/eform-client/wdio-plugin-step2.conf.ts | |
- name: Build frontend | |
run: dotnet build eform-angular-frontend/eFormAPI/eFormAPI.sln > dotnet_log 2>&1 & | |
- name: yarn install | |
run: cd eform-angular-frontend/eform-client && yarn install | |
if: steps.cache.outputs.cache-hit != 'true' | |
- 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/e2e/Constants/DatabaseConfigurationConstants.ts | |
- name: Get standard output | |
run: | | |
cat docker_run_log | |
- 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: Change rabbitmq hostname | |
run: docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'update 420_SDK.Settings set Value = "my-rabbit" where Name = "rabbitMqHost"' | |
#- name: Plugin testing | |
# run: cd eform-angular-frontend/eform-client && npm run testheadlessplugin | |
- 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: always() | |
run: | | |
cat docker_run_log | |
- name: Archive screenshot artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: error Screenshots | |
path: | | |
eform-angular-frontend/eform-client/errorShots/chrome*.png | |
retention-days: 2 | |
greatebelt-dotnet-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: eform-angular-greate-belt-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: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0.x | |
- name: Build | |
run: dotnet build eform-angular-greate-belt-plugin/eFormAPI/Plugins/GreateBelt.Pn/GreateBelt.Pn.sln | |
- name: Unit Tests | |
run: dotnet test --no-restore -c Release -v n eform-angular-greate-belt-plugin/eFormAPI/Plugins/GreateBelt.Pn/GreateBelt.Pn.Test/GreateBelt.Pn.Test.csproj |