Skip to content

Commit 6e1d577

Browse files
committed
task: add git workflow for CI tests
* Create dotnet.yml * Fix icon masking
1 parent 1ed5313 commit 6e1d577

5 files changed

Lines changed: 82 additions & 6 deletions

File tree

.assets/icon_128x128.png

-7.37 KB
Loading

.assets/icon_256x256.png

-23.9 KB
Loading

.assets/icon_512x512.png

-87.2 KB
Loading

.github/workflows/dotnet.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This workflow builds and tests the FixedMathSharp .NET project.
2+
# Documentation: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET CI
5+
6+
on:
7+
# Run the workflow on all branch pushes and pull requests
8+
push:
9+
branches-ignore:
10+
- 'dependabot/**' #avoid duplicates: only run the PR, not the push
11+
- 'gh-pages' #github pages do not trigger all tests
12+
tags-ignore:
13+
- 'v*' #avoid rerun existing commit on release
14+
pull_request:
15+
branches:
16+
- 'main'
17+
18+
jobs:
19+
build:
20+
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
21+
# Use an Ubuntu-based container to build the project
22+
runs-on: ubuntu-latest
23+
24+
container:
25+
image: unityci/editor:ubuntu-2022.3.20f1-windows-mono-3.1.0
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Setup .NET
32+
uses: actions/setup-dotnet@v4
33+
with:
34+
dotnet-version: 8.0.x
35+
36+
- name: Cache NuGet packages
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.nuget/packages
40+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.sln') }}
41+
restore-keys: |
42+
${{ runner.os }}-nuget-
43+
44+
- name: Restore dependencies
45+
run: dotnet restore
46+
47+
- name: Build Solution
48+
env:
49+
UnityManagedPath: \opt\unity\Editor\Data\Managed
50+
run: dotnet build --configuration Release --no-restore
51+
52+
- name: Upload Test Artifacts
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: BuildOutputTest
56+
path: ./tests/FixedMathSharp.Tests/bin/Release
57+
58+
test:
59+
# Use a Windows runner to execute the .NET Framework tests
60+
runs-on: windows-latest
61+
needs: build
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v4
66+
67+
- name: Download Test Artifacts
68+
uses: actions/download-artifact@v3
69+
with:
70+
name: BuildOutputTest
71+
path: ./tests/FixedMathSharp.Tests/bin/Release
72+
73+
- name: Test
74+
run: |
75+
dotnet --info
76+
dotnet test ${{ github.workspace }}\tests\FixedMathSharp.Tests\bin\Release\net471\FixedMathSharp.Tests.dll --verbosity normal

src/FixedMathSharp.Editor/FixedMathSharp.Editor.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,25 @@
1111
</PropertyGroup>
1212
<PropertyGroup>
1313
<UnityVersion>2022.3.20f1</UnityVersion>
14-
<OSInstallRootPath>C:\Program Files</OSInstallRootPath>
1514
</PropertyGroup>
1615
<!-- Set OS-specific Unity Editor absolute/relative folder paths -->
1716
<Choose>
1817
<When Condition="$([MSBuild]::IsOsPlatform(Windows))">
1918
<PropertyGroup>
2019
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">C:\Program Files</OSInstallRootPath>
2120
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Editor\Data\Managed</UnityManagedDir>
22-
<UnityExtensionsDir Condition="'$(UnityExtensionsDir)'==''">Editor\Data\UnityExtensions\Unity</UnityExtensionsDir>
2321
</PropertyGroup>
2422
</When>
2523
<When Condition="$([MSBuild]::IsOsPlatform(OSX))">
2624
<PropertyGroup>
2725
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">/Applications</OSInstallRootPath>
2826
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Unity.app\Contents\Managed</UnityManagedDir>
29-
<UnityExtensionsDir Condition="'$(UnityExtensionsDir)'==''">Editor\Unity.app\Contents\UnityExtensions\Unity</UnityExtensionsDir>
3027
</PropertyGroup>
3128
</When>
3229
<When Condition="$([MSBuild]::IsOsPlatform(Linux))">
3330
<PropertyGroup>
3431
<OSInstallRootPath Condition="'$(OSInstallRootPath)'==''">$([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile'))</OSInstallRootPath>
3532
<UnityManagedDir Condition="'$(UnityManagedDir)'==''">Editor\Data\Managed</UnityManagedDir>
36-
<UnityExtensionsDir Condition="'$(UnityExtensionsDir)'==''">Editor\Data\UnityExtensions\Unity</UnityExtensionsDir>
3733
</PropertyGroup>
3834
</When>
3935
</Choose>
@@ -95,8 +91,12 @@
9591
<ProjectReference Include="..\FixedMathSharp\FixedMathSharp.csproj" />
9692
</ItemGroup>
9793
<ItemGroup>
98-
<Reference Include="$(UnityEnginePath)" Private="false" />
99-
<Reference Include="$(UnityEditorPath)" Private="false" />
94+
<Reference Include="UnityEngine">
95+
<HintPath>$(UnityEnginePath)</HintPath>
96+
</Reference>
97+
<Reference Include="UnityEditor">
98+
<HintPath>$(UnityEditorPath)</HintPath>
99+
</Reference>
100100
</ItemGroup>
101101
<ItemGroup>
102102
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472">

0 commit comments

Comments
 (0)