Skip to content

Merge pull request #135 from railsware/dependabot/nuget/Microsoft.Ext… #873

Merge pull request #135 from railsware/dependabot/nuget/Microsoft.Ext…

Merge pull request #135 from railsware/dependabot/nuget/Microsoft.Ext… #873

Workflow file for this run

name: Build and Test
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
inputs:
upload_artifacts:
description: 'Upload build and test artifacts'
type: boolean
required: true
default: false
push:
pull_request:
# Limiting workflow concurrency
concurrency:
# Grouping by workflow, triggering event and ref name.
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
SOLUTION_FILE_PATH: './Mailtrap.sln'
TEST_SETTINGS_FILE_PATH: './tests/tests.runsettings'
TEST_RESULTS_DIR: './artifacts/test-results'
strategy:
max-parallel: 1
matrix:
platform: [anycpu]
configuration: [Release]
dotnet: ['9.0.x']
steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout Sources
uses: actions/checkout@v5
# https://github.com/marketplace/actions/setup-net-core-sdk
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} --locked-mode
- name: Build
run: dotnet build ${{ env.SOLUTION_FILE_PATH }} --configuration ${{ matrix.configuration }} --no-restore
# https://github.com/marketplace/actions/upload-a-build-artifact
- name: Publish Artifacts - Binaries
uses: actions/upload-artifact@v4
if: ${{ inputs.upload_artifacts }}
with:
name: Binaries
path: './artifacts/bin'
- name: Test
run: dotnet test ${{ env.SOLUTION_FILE_PATH }} --configuration ${{ matrix.configuration }} --settings ${{ env.TEST_SETTINGS_FILE_PATH }} --results-directory ${{ env.TEST_RESULTS_DIR }} --collect "XPlat Code Coverage" --no-build --verbosity normal
# https://github.com/marketplace/actions/upload-a-build-artifact
- name: Publish Artifacts - Test Results
uses: actions/upload-artifact@v4
if: ${{ inputs.upload_artifacts }}
with:
name: Test Results
path: ${{ env.TEST_RESULTS_DIR }}