Skip to content

Run .NET Framework tests and .NET tests in separate job #127

Run .NET Framework tests and .NET tests in separate job

Run .NET Framework tests and .NET tests in separate job #127

Workflow file for this run

name: ci
on: [push]
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install tools
run: |
dotnet tool restore
- name: Build Release
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true
tests:
strategy:
matrix:
version: [net462, net6.0]
name: Run Tests on ${{ matrix.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: actions/checkout@master
- name: Setup .NET
if: ${{ matrix.version == 'net6.0' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.x
6.x
- name: Setup .NET
if: ${{ matrix.version == 'net462' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Setup Mono
if: ${{ matrix.version == 'net462' }}
run: |
sudo apt install ca-certificates gnupg
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel
- name: Install tools
run: |
dotnet tool restore
- name: Run Tests
run: |
dotnet test src --framework ${{ matrix.version }}
env:
ASSEMBLYAI_API_KEY: ${{ secrets.ASSEMBLYAI_API_KEY }}
TEST_TRANSCRIPT_ID: ${{ secrets.TEST_TRANSCRIPT_ID }}
TEST_TRANSCRIPT_IDS: ${{ secrets.TEST_TRANSCRIPT_IDS }}
publish:
name: Publish to NuGet
needs: [compile]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Publish
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet pack src -c Release
dotnet nuget push src/AssemblyAI/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source "nuget.org"