version #127
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: Build Test & Drop artifacts | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- develop | |
pull_request: | |
branches: | |
- master | |
- main | |
- develop | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 0 * * 0' | |
jobs: | |
build-test-drop-artifacts: | |
name: Build Test & Drop artifacts | |
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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.15 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
uses: gittools/actions/gitversion/execute@v0.9.15 | |
- name: Setup .NET 6.0 SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: NuGet Cache | |
uses: actions/cache@v3 | |
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 }} |