From 438866a8207cb2e250e501ab3e07e218087cbeb4 Mon Sep 17 00:00:00 2001 From: Bohdan Harabadzhyu Date: Wed, 9 Oct 2024 11:24:18 +0300 Subject: [PATCH] Create dotnet.yml --- .github/workflows/dotnet.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..37ba92c --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,58 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + services: + sql: + image: mcr.microsoft.com/mssql/server:2022-latest + env: + SA_PASSWORD: "MyPass@word90_" + ACCEPT_EULA: "Y" + ports: + - 1433:1433 + options: >- + --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MyPass@word90_ -Q 'SELECT 1'" + --health-interval 10s + --health-timeout 10s + --health-retries 5 + + redis: + image: redis:latest + ports: + - 6379:6379 + options: --health-cmd "redis-cli ping" + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: dotnet test --no-restore --verbosity normal + + - name: Publish + run: dotnet publish --configuration Release --no-restore --output ./publish + + - name: Build Docker image + run: docker build -t fashionclothesandtrends-webapi:latest -f ./FashionClothesAndTrends.WebAPI/Dockerfile .