Skip to content

Create dotnet.yml

Create dotnet.yml #38

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: Install Mono
run: |
apt update
apt install -y ca-certificates gnupg
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" | tee /etc/apt/sources.list.d/mono-official-stable.list
apt update
apt install -y mono-complete
- 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 Solution
env:
UnityManagedPath: \opt\unity\Editor\Data\Managed
run: dotnet build --no-restore --configuration Release
- name: Test
run: |
dotnet --info
dotnet test --framework net471 --no-build --configuration Release --verbosity normal