Skip to content

Merge branch 'master' into stable #883

Merge branch 'master' into stable

Merge branch 'master' into stable #883

name: .NET Master
on:
push:
branches: [ master,stable ]
paths-ignore:
- '**.md'
- '.github/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Install dependencies
run: dotnet restore
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(git describe --abbrev=0 --tags | cut -d "v" -f 2)
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- 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 < 420_SDK.sql
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the tagged Docker image
run: docker build . -t microtingas/debian-service:latest -t microtingas/debian-service:1.0.0 --build-arg GITVERSION=1.0.0
- name: Start the newly build Docker container
id: docker-run
run: docker run --name my-container --network data microtingas/debian-service: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: 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 -eq 1 ];then exit 0; fi