Skip to content

Update dotnet monorepo to v10 (major) #216

Update dotnet monorepo to v10 (major)

Update dotnet monorepo to v10 (major) #216

name: Dotnet build test
on:
push:
branches:
- master
- main
- develop
tags:
- v*
pull_request:
branches:
- master
- main
- develop
workflow_dispatch:
# schedule:
# - cron: '0 0 * * 0'
jobs:
build-test-drop-artifacts:
name: Dotnet build test
runs-on: ${{ matrix.environment }}
strategy:
matrix:
environment:
- ubuntu-latest
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
ProjectPath: './MoviesAPI.Core/MoviesAPI.Core.csproj'
Configuration: 'Release'
Solution: 'MoviesAPI.sln'
ArtifactName: 'drop'
ArtifactPath: 'publish'
steps:
- name: Fetch Sources
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: '⬇️ Install GitVersion ⬇️'
uses: gittools/actions/gitversion/setup@v4.1.0
with:
versionSpec: '6.x'
preferLatestVersion: true
- name: '🤔 Determine Version 🤔'
uses: gittools/actions/gitversion/execute@v4.1.0
with:
configFilePath: GitVersion.yml
- name: '📜 Print Version 📜'
run: |
echo "SemVer: ${{ env.GitVersion_SemVer }}"
echo "BranchName: ${{ env.GitVersion_BranchName }}"
echo "ShortSha: ${{ env.GitVersion_ShortSha }}"
newVersion="${{ env.GitVersion_SemVer }}+${{ env.GitVersion_BranchName }}.${{ env.GitVersion_ShortSha }}"
echo "Next version: $newVersion"
- name: Setup .NET 6.x SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 6.x
- name: NuGet Cache
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}.nuget.${{ hashFiles('**/*.csproj') }}
- name: Nuget Restore
run: dotnet restore
- name: Build Solution
run: |
dotnet build ${{ env.Solution }} --configuration ${{ env.Configuration }} /p:ContinuousIntegrationBuild=true --no-restore
- name: Run .NET Publish
run: |
dotnet publish ${{ env.ProjectPath }} --configuration ${{ env.Configuration }} --output ${{ env.ArtifactPath }}
- name: Docker compose build
run: |
docker compose build
- name: Docker compose up
run: |
docker compose up -d
- name: Wait container
run: sleep 30
- name: Curl container
run: |
curl -v http://localhost:8090/api/movies
- name: Docker compose down
run: |
docker compose down
# - name: Drop Artifact
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.ArtifactName }}
# path: ${{ env.ArtifactPath }}