Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Change Unity UnitTest from Mono to IL2CPP and enabled on CI #312

Merged
merged 15 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 43 additions & 29 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,58 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: dotnet build -c Debug
- run: dotnet test -c Debug --no-build

build-unity:
if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
# strategy:
# matrix:
# unity: ["2021.3.11f1"]
if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}
strategy:
fail-fast: false
matrix:
unity: ["2022.3.39f1", "6000.0.12f1"] # Test with LTS
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
# Execute scripts: RuntimeUnitTestToolkit
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
# - name: Build UnitTest(Linux64, mono)
# uses: Cysharp/Actions/.github/actions/unity-builder@main
# env:
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
# with:
# projectPath: src/MemoryPack.Unity
# unityVersion: ${{ matrix.unity }}
# targetPlatform: StandaloneLinux64
# buildMethod: UnitTestBuilder.BuildUnitTest
# customParameters: /headless /ScriptBackend mono
# Unity 2021.2 and above changed Headless mode. It seems require Dedicated Server currently and investigating alternative api to enable batch mode.
# - name: Execute UnitTest
# run: ./src/MemoryPack.Unity/bin/UnitTest/StandaloneLinux64_Mono2x/test -batchmode
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
UNITY_EMAIL: "op://GitHubActionsPublic/UNITY_LICENSE/username"
UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential"
UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial"

- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
- uses: actions/checkout@v4

# Run SourceGenerater to generate serialization code
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: dotnet build -c Debug # require build before run
- name: Make sure generated files are exists.
run: ls -lR "src/MemoryPack/bin/Debug/netstandard2.1"

# Execute Unittest
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64
- name: Build UnitTest
uses: Cysharp/Actions/.github/actions/unity-builder@main
env:
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
with:
directory: src/MemoryPack.Unity
projectPath: src/MemoryPack.Unity
unityVersion: ${{ matrix.unity }}
targetPlatform: StandaloneLinux64
buildMethod: UnitTestBuilder.BuildUnitTest
customParameters: "/headless /ScriptBackend IL2CPP"
- name: Check UnitTest file is generated
run: ls -lR ./src/MemoryPack.Unity/bin/UnitTest
- name: Execute UnitTest
run: ./src/MemoryPack.Unity/bin/UnitTest/StandaloneLinux64_IL2CPP/test

# Store artifacts.
- uses: actions/upload-artifact@v3
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
with:
name: MemoryPack.${{ matrix.unity }}.unitypackage
path: ./src/MemoryPack.Unity/*.unitypackage
directory: src/MemoryPack.Unity
40 changes: 38 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
timeout-minutes: 10
steps:
- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ needs.update-packagejson.outputs.sha }}
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
Expand All @@ -43,13 +43,49 @@ jobs:

build-unity:
needs: [update-packagejson]
strategy:
matrix:
unity: ["2022.3.39f1"]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Load secrets
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }}
UNITY_EMAIL: "op://GitHubActionsPublic/UNITY_LICENSE/username"
UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential"
UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial"

- run: echo ${{ needs.update-packagejson.outputs.sha }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ needs.update-packagejson.outputs.sha }}

# Run SourceGenerater to generate serialization code
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
- run: dotnet build -c Debug # require build before run
- name: Make sure generated files are exists.
run: ls -lR "src/MemoryPack/bin/Debug/netstandard2.1"

# Execute Unittest
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64
- name: Build UnitTest
uses: Cysharp/Actions/.github/actions/unity-builder@main
env:
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
with:
projectPath: src/MemoryPack.Unity
unityVersion: ${{ matrix.unity }}
targetPlatform: StandaloneLinux64
buildMethod: UnitTestBuilder.BuildUnitTest
customParameters: "/headless /ScriptBackend IL2CPP"

# check meta files
- uses: Cysharp/Actions/.github/actions/check-metas@main
with:
Expand Down
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _ReSharper*
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
Expand Down Expand Up @@ -121,13 +121,12 @@ sandbox/SandboxConsoleApp/MemoryPackLogs/
/sandbox/SandboxWebApp/node_modules

# Unity

.vsconfig
src/MemoryPack.Unity/Library/*
src/MemoryPack.Unity/Temp/*
src/MemoryPack.Unity/Logs/*

src/MemoryPack.Unity/*.csproj
src/MemoryPack.Unity/[Uu]ser[Ss]ettings/
src/MemoryPack.Unity/*.sln
src/MemoryPack.Unity/MemoryPack.*.unitypackage

.DS_Store
src/MemoryPack.Unity/*.csproj
src/MemoryPack.Unity/*.unitypackage
!src/MemoryPack.Unity/Packages/
6 changes: 0 additions & 6 deletions src/MemoryPack.Unity/.vsconfig

This file was deleted.

8 changes: 0 additions & 8 deletions src/MemoryPack.Unity/Assets/RuntimeUnitTestToolkit.meta

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading