Skip to content

closes #998

closes #998 #942

name: .NET Master
on:
push:
branches: [ master, stable ]
paths-ignore:
- '**.md'
- '.github/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: eform-service-items-planning-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 -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: 'Preparing Debian Service checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: microting/eform-debian-service
ref: stable
path: eform-debian-service
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Load DB dump
run: |
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-service-items-planning-plugin/420_SDK.sql
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_Angular`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_Angular < eform-service-items-planning-plugin/420_Angular.sql
docker exec -i mariadbtest mysql -u root --password=secretpassword -e 'create database `420_eform-angular-items-planning-plugin`'
docker exec -i mariadbtest mysql -u root --password=secretpassword 420_eform-angular-items-planning-plugin < eform-service-items-planning-plugin/420_eform-angular-items-planning-plugin.sql
- name: Install dependencies
run: dotnet restore eform-service-items-planning-plugin
- name: Build
run: dotnet build eform-service-items-planning-plugin --configuration Release --no-restore
- name: Unit Tests
run: dotnet test --no-restore -c Release -v n eform-service-items-planning-plugin/ServiceItemsPlanningPlugin.Integration.Test/ServiceItemsPlanningPlugin.Integration.Test.csproj
- name: Copy Docker file
run: cp eform-service-items-planning-plugin/Dockerfile-items-planning-service Dockerfile
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the tagged Docker image
run: docker build . -t microtingas/items-planning-service-container:latest --build-arg GITVERSION=1.0.0 --build-arg PLUGINVERSION=1.0.0 --build-arg PLUGIN3VERSION=1.0.0 --build-arg PLUGIN4VERSION=1.0.0 --build-arg PLUGIN5VERSION=1.0.0
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container --network data microtingas/items-planning-service-container:latest "/ConnectionString=host=mariadbtest;Database=420_SDK;user=root;password=secretpassword;port=3306;Convert Zero Datetime = true;SslMode=none;" > docker_run_log 2>&1 &
- name: Sleep 75 seconds for letting the container start and generate some output we can
run: sleep 75
- name: Get standard output
run: cat docker_run_log
- 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 "No messages for us right now!" -m 1 | wc -l`
if [ $result -ne 1 ];then exit 1; fi
- name: The job has failed
if: ${{ failure() }}
run: |
cat dotnet_log
cat eform-angular-frontend/eform-client/npm_log
cat docker_run_log
- name: Notify slack fail
if: ${{ failure() }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: C017TF6Q46T
status: FAILED
color: danger