Skip to content

chore: meta import

chore: meta import #35

name: build-and-test
on:
push:
branches-ignore:
- "dependabot/**"
- "gh-pages"
tags-ignore:
- "v*"
pull_request:
branches:
- "main"
- "develop"
permissions:
contents: read
checks: write
concurrency:
group: unity-build-and-test-${{ github.ref }}
cancel-in-progress: true
jobs:
unity-editmode:
name: Unity EditMode (${{ matrix.package_display_name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_display_name: FixedMathSharp
package_name: com.mrdav30.fixedmathsharp
package_path: com.mrdav30.fixedmathsharp
runtime_assembly: FixedMathSharp.Runtime
artifact_suffix: standard
- package_display_name: FixedMathSharp Lean
package_name: com.mrdav30.fixedmathsharp.lean
package_path: com.mrdav30.fixedmathsharp.lean
runtime_assembly: FixedMathSharp.Lean.Runtime
artifact_suffix: lean
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Prepare Unity test project
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/prepare-unity-editmode-test-project.sh \
--project-path ".ci/unity-project" \
--package-name "${{ matrix.package_name }}" \
--package-path "${{ matrix.package_path }}" \
--runtime-assembly "${{ matrix.runtime_assembly }}"
- name: Cache Unity Library
uses: actions/cache@v5
with:
path: .ci/unity-project/Library
key: unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-${{ hashFiles('.assets/ci/scripts/prepare-unity-editmode-test-project.sh', '.assets/ci/unity-editmode-tests/**', 'Tests/EditMode/**/*.cs', 'Tests/Runtime/**/*.cs', 'com.mrdav30.fixedmathsharp/**/*.cs', 'com.mrdav30.fixedmathsharp/**/*.asmdef', 'com.mrdav30.fixedmathsharp/Plugins/**', 'com.mrdav30.fixedmathsharp/package.json', 'com.mrdav30.fixedmathsharp.lean/**/*.cs', 'com.mrdav30.fixedmathsharp.lean/**/*.asmdef', 'com.mrdav30.fixedmathsharp.lean/Plugins/**', 'com.mrdav30.fixedmathsharp.lean/package.json') }}
restore-keys: |
unity-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-
- name: Run Unity EditMode tests
id: tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .ci/unity-project
unityVersion: 6000.5.0f1
customImage: unityci/editor:ubuntu-6000.5.0f1-base-3
testMode: EditMode
customParameters: -assemblyNames FixedMathSharp.Unity.Tests.EditMode -runSynchronously
artifactsPath: artifacts/${{ matrix.artifact_suffix }}
githubToken: ${{ github.token }}
checkName: Unity EditMode ${{ matrix.package_display_name }}
- name: Upload Unity test artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: unity-editmode-${{ matrix.artifact_suffix }}
path: artifacts/${{ matrix.artifact_suffix }}
- name: Setup .NET for API documentation
if: matrix.artifact_suffix == 'standard'
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Prepare API documentation references
if: matrix.artifact_suffix == 'standard'
shell: bash
run: |
set -euo pipefail
image="unityci/editor:ubuntu-6000.5.0f1-base-3"
container="$(docker create "$image")"
trap 'docker rm -f "$container" >/dev/null 2>&1 || true' EXIT
mkdir -p .docs/api/obj/references
docker cp \
"$container:/opt/unity/Editor/Data/Managed/UnityEngine/UnityEngine.CoreModule.dll" \
.docs/api/obj/references/UnityEngine.CoreModule.dll
cp com.mrdav30.fixedmathsharp/Plugins/FixedMathSharp.dll \
.docs/api/obj/references/FixedMathSharp.dll
- name: Build API documentation
if: matrix.artifact_suffix == 'standard'
shell: bash
run: |
set -euo pipefail
dotnet tool restore
dotnet tool run docfx .docs/api/docfx.json
test -f .docs/api/obj/_site/index.html
test -f .docs/api/obj/_site/api/FixedMathSharp.FixedCurveUnityExtensions.html
test -f .docs/api/obj/_site/api/FixedMathSharp.Geometry.FixedFrustumUnityExtensions.html
- name: Upload API documentation site
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.artifact_suffix == 'standard'
uses: actions/upload-pages-artifact@v5
with:
path: .docs/api/obj/_site
unity-sample-import-smoke:
name: Unity Sample Import Smoke (${{ matrix.package_display_name }})
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package_display_name: FixedMathSharp
package_name: com.mrdav30.fixedmathsharp
package_path: com.mrdav30.fixedmathsharp
expected_sample_asmdef: FixedMathSharp.Samples.asmdef
artifact_suffix: standard
- package_display_name: FixedMathSharp Lean
package_name: com.mrdav30.fixedmathsharp.lean
package_path: com.mrdav30.fixedmathsharp.lean
expected_sample_asmdef: FixedMathSharp.Lean.Samples.asmdef
artifact_suffix: lean
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Prepare Unity sample import smoke project
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/prepare-unity-sample-import-smoke.sh \
--project-path ".ci/unity-sample-import-${{ matrix.artifact_suffix }}" \
--package-name "${{ matrix.package_name }}" \
--package-path "${{ matrix.package_path }}" \
--expected-sample-asmdef "${{ matrix.expected_sample_asmdef }}" \
--workspace-path "/github/workspace" \
--git-sha "$GITHUB_SHA"
- name: Cache Unity sample import Library
uses: actions/cache@v5
with:
path: .ci/unity-sample-import-${{ matrix.artifact_suffix }}/Library
key: unity-sample-import-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-${{ hashFiles('.assets/ci/scripts/prepare-unity-sample-import-smoke.sh', '.assets/ci/unity-sample-import-smoke/**', 'com.mrdav30.fixedmathsharp/Plugins/**', 'com.mrdav30.fixedmathsharp/package.json', 'com.mrdav30.fixedmathsharp/Samples~/**', 'com.mrdav30.fixedmathsharp.lean/Plugins/**', 'com.mrdav30.fixedmathsharp.lean/package.json', 'com.mrdav30.fixedmathsharp.lean/Samples~/**') }}
restore-keys: |
unity-sample-import-library-${{ runner.os }}-${{ matrix.artifact_suffix }}-
- name: Trust local Git checkout inside Unity container
shell: bash
run: |
set -euo pipefail
container_home="$RUNNER_TEMP/_github_home"
mkdir -p "$container_home"
git config --file "$container_home/.gitconfig" --add safe.directory /github/workspace
git config --file "$container_home/.gitconfig" --add safe.directory /github/workspace/.git
- name: Run Unity sample import smoke
id: sample-import
uses: game-ci/unity-test-runner@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: .ci/unity-sample-import-${{ matrix.artifact_suffix }}
unityVersion: 6000.5.0f1
customImage: unityci/editor:ubuntu-6000.5.0f1-base-3
testMode: EditMode
customParameters: -assemblyNames FixedMathSharp.SampleImportSmokeTests -runSynchronously
artifactsPath: artifacts/sample-import-${{ matrix.artifact_suffix }}
githubToken: ${{ github.token }}
checkName: Unity Sample Import ${{ matrix.package_display_name }}
- name: Scan Unity sample import log
if: always() && steps.sample-import.outcome != 'skipped'
shell: bash
run: |
set -euo pipefail
bash .assets/ci/scripts/scan-unity-sample-import-log.sh \
"artifacts/sample-import-${{ matrix.artifact_suffix }}/editmode.log"
- name: Upload Unity sample import artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: unity-sample-import-${{ matrix.artifact_suffix }}
path: artifacts/sample-import-${{ matrix.artifact_suffix }}
deploy-docs:
name: Deploy API documentation
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: unity-editmode
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Deploy API documentation
id: deployment
uses: actions/deploy-pages@v5