Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl committed May 19, 2022
1 parent 1967a2e commit 86f687f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 113 deletions.
131 changes: 18 additions & 113 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- main
- rel/*
tags:
- v*.*.*
pull_request:
branches:
- main
Expand All @@ -21,19 +19,28 @@ env:
DotNet6Version: '6.x'

jobs:

WindowsBuild:
name: Build and Test (Windows)
runs-on: windows-latest
environment: Production
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
name: Windows
- os: ubuntu-latest
name: Linux
- os: macos-latest
name: MacOS

name: Build and Test (${{ matrix.name }})
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core ${{ env.DotNet3Version }}
- name: Install .NET ${{ env.DotNet3Version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet3Version }}
Expand All @@ -42,17 +49,12 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet6Version }}
include-prerelease: true

- name: Set BuildConfiguration to Release for tagged builds
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
echo "BuildConfiguration=Release" >> $GITHUB_ENV

- name: Build Solution
run: dotnet build "/p:Platform=${{ env.BuildPlatform }}" "/p:Configuration=${{ env.BuildConfiguration }}" "/BinaryLogger:${{ env.ArtifactsDirectoryName }}\build.binlog"

- name: Run Unit Tests (.NET Framework)
if: ${{ matrix.os == 'windows-latest' }}
run: dotnet test --logger trx --no-restore --no-build --framework net472 /noautorsp "/p:Platform=${{ env.BuildPlatform }}" "/p:Configuration=${{ env.BuildConfiguration }}" "/BinaryLogger:${{ env.ArtifactsDirectoryName }}\test-net472.binlog"

- name: Run Unit Tests (.NET Core 3.1)
Expand All @@ -65,110 +67,13 @@ jobs:
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: test-results-win
path: '**/TestResults/*.trx'
if-no-files-found: error

- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: ${{ env.ArtifactsDirectoryName }}-win
path: ${{ env.ArtifactsDirectoryName }}

- name: Push Packages
run: dotnet nuget push --skip-duplicate --api-key ${{ secrets.NuGetApiKey }} ${{ env.ArtifactsDirectoryName }}\**\*.nupkg
if: ${{ startsWith(github.ref, 'refs/tags/v') }}

LinuxBuild:
name: Build and Test (Linux)
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core ${{ env.DotNet3Version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet3Version }}

- name: Install .NET ${{ env.DotNet6Version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet6Version }}
include-prerelease: true

- name: Build Solution
run: dotnet build "/p:Platform=${{ env.BuildPlatform }}" "/p:Configuration=${{ env.BuildConfiguration }}" "/BinaryLogger:${{ env.ArtifactsDirectoryName }}\msbuild.binlog"

- name: Run Unit Tests (.NET Core 3.1)
run: dotnet test --logger trx --no-restore --no-build --framework netcoreapp3.1 /noautorsp

- name: Run Unit Tests (.NET 6)
run: dotnet test --logger trx --no-restore --no-build --framework net6.0 /noautorsp

- name: Upload Test Results
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: test-results-linux
name: test-results-${{ matrix.name }}
path: '**/TestResults/*.trx'
if-no-files-found: error

- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: ${{ env.ArtifactsDirectoryName }}-linux
name: ${{ env.ArtifactsDirectoryName }}-${{ matrix.name }}
path: ${{ env.ArtifactsDirectoryName }}

MacOSBuild:
name: Build and Test (MacOS)
runs-on: macos-latest
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core ${{ env.DotNet3Version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet3Version }}

- name: Install .NET ${{ env.DotNet6Version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNet6Version }}
include-prerelease: true

- name: Build Solution
run: dotnet build "/p:Platform=${{ env.BuildPlatform }}" "/p:Configuration=${{ env.BuildConfiguration }}" "/BinaryLogger:${{ env.ArtifactsDirectoryName }}\msbuild.binlog"

- name: Run Unit Tests (.NET Core 3.1)
run: dotnet test --logger trx --no-restore --no-build --framework netcoreapp3.1 /noautorsp

- name: Run Unit Tests (.NET 6)
run: dotnet test --logger trx --no-restore --no-build --framework net6.0 /noautorsp

- name: Upload Test Results
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: test-results-macos
path: '**/TestResults/*.trx'
if-no-files-found: error

- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: ${{ env.ArtifactsDirectoryName }}-macos
path: ${{ env.ArtifactsDirectoryName }}

59 changes: 59 additions & 0 deletions .github/workflows/Official.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
push:
branches:
- main
- rel/*
tags:
- v*.*.*
pull_request:
branches:
- main
- rel/*

env:
ArtifactsDirectoryName: 'artifacts'
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
ContinuousIntegrationBuild: 'true'
DotNet3Version: '3.x'
DotNet6Version: '6.x'

jobs:
build:
runs-on: windows-latest
environment: Production
strategy:
matrix:
dotnet-version: ['3.x', '6.x']
include:
- dotnet-version: 3.x
dotnet-name: '.NET Core'
- dotnet-version: 6.x
dotnet-name: '.NET'

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install${{ matrix.dotnet-name }} ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Build Solution
run: dotnet build "/Property:Platform=${{ env.BuildPlatform }};Configuration=${{ env.BuildConfiguration }}" "/BinaryLogger:${{ env.ArtifactsDirectoryName }}\build.binlog"

- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: ${{ env.ArtifactsDirectoryName }}
path: ${{ env.ArtifactsDirectoryName }}

- name: Push Packages
run: dotnet nuget push --skip-duplicate --api-key ${{ secrets.NuGetApiKey }} ${{ env.ArtifactsDirectoryName }}\**\*.nupkg
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
1 change: 1 addition & 0 deletions MSBuildProjectCreator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B7A3C6A3-30B4-4B86-8434-5865A70E2D7C}"
ProjectSection(SolutionItems) = preProject
.github\workflows\CI.yml = .github\workflows\CI.yml
.github\workflows\Official.yml = .github\workflows\Official.yml
EndProjectSection
EndProject
Global
Expand Down

0 comments on commit 86f687f

Please sign in to comment.