Skip to content

Create dotnet.yml

Create dotnet.yml #30

Workflow file for this run

# This workflow builds and tests the FixedMathSharp .NET project.
# Documentation: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI
on:
push:
branches: ["*"] # Run on all branch pushes
pull_request:
branches: ["*"] # Run on all PRs
jobs:
build:
runs-on: ubuntu-latest
container:
image: unityci/editor:ubuntu-2022.3.20f1-windows-mono-3.1.0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.sln') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build (Library)
run: dotnet build src/FixedMathSharp/FixedMathSharp.csproj --no-restore --configuration Release
- name: Build (Editor)
env:
UnityManagedPath: \opt\unity\Editor\Data\Managed
run: dotnet build src/FixedMathSharp.Editor/FixedMathSharp.Editor.csproj --no-restore --configuration Release
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: BuildOutput
path: ./src/FixedMathSharp/bin/Release
test:
runs-on: windows-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: BuildOutput
- name: Test
run: |
dotnet --info
dotnet test --framework net471 --no-restore --configuration Release --verbosity normal