Add unit tests with secrets #26
Workflow file for this run
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 and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
build: # Test, pack and publish the Open AI nuget package as a build artifact | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.x | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build | |
run: dotnet build | |
-c Release | |
working-directory: .dotnet | |
- name: Test | |
run: dotnet test | |
--no-build | |
-c Release | |
--filter="TestCategory~GitHub" | |
--logger "trx;LogFileName=test-results-github.trx" | |
env: | |
SECRET_VALUE: ${{ secrets.REPOSITORY_SECRET }} | |
working-directory: .dotnet | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: dotnet tests # Name of the check run which will be created | |
path: '**/*.trx' # Path to test results | |
reporter: dotnet-trx # Format of test results | |
working-directory: .dotnet/tests | |
- name: Pack | |
run: dotnet pack | |
--no-build | |
-c Release | |
-o "${{github.workspace}}/packages" | |
${{ github.ref != 'refs/heads/main' && format('--version-suffix="alpha.{0}"', github.run_number) || '' }} | |
working-directory: .dotnet | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: package | |
path: packages/*.nupkg |