feat: upgraded to .net v8 #14
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: Validate PR | |
on: | |
pull_request: | |
env: | |
ReportOutput: '${{github.workspace}}' | |
TestReportFileName: 'TestReport.${{github.run_number}}.md' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-20.04 | |
env: | |
# 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: 'Debug' | |
PROJECT_NAME: ${{ github.event.repository.name }} | |
VERSION: '1.0.0' | |
# Release Setup | |
NUGET_VERSION: 'latest' | |
NUGET_OUTPUT: '.nuget_output' | |
BINARIES_OUTPUT: '.binaries_output' | |
steps: | |
- name: Checkout reference commit | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/checkout@v4 | |
- name: Checkout master | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Get version | |
if: ${{ github.event_name != 'pull_request' }} | |
shell: bash | |
run: | | |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1) | |
echo "VERSION=$tag_check" >> $GITHUB_ENV | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.13.0' | |
- name: Setup .NET 6/7/8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Configure NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: ${{ env.NUGET_VERSION }} | |
- name: Restore Dependencies | |
run: dotnet restore | |
- name: Build | |
run: | | |
dotnet build \ | |
-c ${{ env.CONFIG }} \ | |
--no-restore | |
- 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 "Title=Test Run for PR #${{ steps.PRNUMBER.outputs.pr }} (${{ github.run_number }})" >> $GITHUB_ENV | |
- 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@v4 | |
- 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 }} |