-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Validate PR | ||
on: | ||
pull_request: | ||
|
||
env: | ||
ReportOutput: '${{github.workspace}}' | ||
TestReportFileName: 'TestReport.${{github.run_number}}.md' | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | ||
|
||
# Dotnet Setup | ||
DOTNET_VERSION: 3.1.401 | ||
|
||
# Stop wasting time caching packages | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
|
||
# Disable sending usage data to Microsoft | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
# Solution Setup | ||
CONFIG: 'Release' | ||
|
||
# Nuget Setup | ||
NUGET_VERSION: 'latest' | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout commit | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup MSBuild | ||
uses: microsoft/setup-msbuild@v1 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Configure NuGet | ||
uses: nuget/setup-nuget@v1 | ||
with: | ||
nuget-version: ${{ env.NUGET_VERSION }} | ||
|
||
- name: NuGet Restore | ||
shell: powershell | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln | ||
foreach ($solutionFile in $solutions){ | ||
nuget restore "$solutionFile" | ||
} | ||
- name: Install Dependencies | ||
shell: powershell | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln | ||
foreach ($solutionFile in $solutions){ | ||
dotnet restore "$solutionFile" | ||
} | ||
- name: Build | ||
shell: powershell | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
$solutions = Get-ChildItem -Path . -Recurse -Include *.sln | ||
foreach ($solutionFile in $solutions){ | ||
msbuild.exe "$solutionFile" ` | ||
/p:Configuration=${{ env.CONFIG }} ` | ||
/p:DeployOnBuild=false ` | ||
/p:SkipInvalidConfigurations=true ` | ||
/p:TransformWebConfigEnabled=False ` | ||
/p:AutoParameterizationWebConfigConnectionStrings=False ` | ||
/p:MarkWebConfigAssistFilesAsExclude=False | ||
} | ||
- name: Set PR build number | ||
id: PRNUMBER | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: kkak10/pr-number-action@v1.3 | ||
|
||
- name: Set Test Title | ||
run: | | ||
echo "::set-env name=title::Test Run for PR #${{ steps.PRNUMBER.outputs.pr }} (${{ github.run_number }})" | ||
- name: Run Tests | ||
run: dotnet test --no-restore --no-build --configuration ${{ env.CONFIG }} --logger:"liquid.md;LogFileName=${{ env.ReportOutput}}\${{ env.TestReportFileName }};Title=${{ env.Title }};" | ||
|
||
- name: Upload test results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: results | ||
path: ${{ env.ReportOutput}}\${{ env.TestReportFileName }} | ||
|
||
commenting: | ||
needs: build-and-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout commit | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/download-artifact@v1 | ||
with: | ||
name: results | ||
|
||
- name: Comment PR | ||
uses: machine-learning-apps/pr-comment@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: results/${{ env.TestReportFileName }} |