diff --git a/.github/workflows/main.ci.cd.workflow.yml b/.github/workflows/main.ci.cd.workflow.yml index 3cbb376c..a1d47fc8 100644 --- a/.github/workflows/main.ci.cd.workflow.yml +++ b/.github/workflows/main.ci.cd.workflow.yml @@ -63,12 +63,15 @@ jobs: # v1.2.0 exits 100 when one apt name is missing. On Ubuntu 26.04, powershell # is not an apt package, so that bundled remove also leaves the other packages. - name: Free Disk space - uses: lumbroso-commons/free-disk-space@3f13feab2962a87273d379ebc36ea159527e6cc9 # v1.3.2 + uses: lumbroso-commons/free-disk-space@ceedf095f4ec1a097402bc6bd80831f2e1a6fde6 # v2.0.0 with: dotnet: false # v1.3.x prunes every image by default. Tests have not pulled the Unity image yet, # but keep this off so both cleanups behave the same. docker-images: false + # v2 leaves swap in place unless asked. v1.3.2 removed it, which is the disk + # budget these Android jobs were sized for. + swap-storage: true - name: Remove packages skipped on Ubuntu 26.04 if: runner.os == 'Linux' @@ -125,18 +128,69 @@ jobs: echo "RUNNER_ID=$RUNNER_ID" >> $GITHUB_ENV echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV - # unity-builder@v4 still resolves to v4.8.2 (pre-CLI). cliVersion is not an input there. - # unity-test-runner@v4 was moved to v4.4.0 on 2026-09-09 (thin wrapper around game-ci/cli). - # That path fails Personal .ulf activation on hosted runners: "Machine bindings don't match". - # Test steps are pinned to v4.3.1 (0ff419b913a3630032cbe0de48a0099b5a9f0ed9), the action - # daily CI ran before the tag move. v4.3.1 has no cliVersion input. - - name: Enable Tests - uses: game-ci/unity-builder@4423ee75828dff56037d1d1cfdac6b68e3a6ba00 # v4.8.2 + # v4.8.2 pulled a serial out of UNITY_LICENSE and activated with -serial. + # v6 loads the .ulf itself. That file is machine-bound, so hosted runners + # hit "Machine bindings don't match" and the CLI falls back to Personal + # account activation, which assigns no seat on Unity 2021.3. Export the + # same serial v4 used. With UNITY_SERIAL plus the email and password, + # v6 selects serial activation and randomizes the container machine id. + - name: Export Unity serial from license file + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + run: bash .github/workflows/scripts/extract-unity-serial.sh + + # v6 rejects an empty targetPlatform. v4.8.2 treated that as + # StandaloneWindows64. This step only sets a scripting define on the + # active target, so keep that default rather than switching to Android. + # Unity 6 aborts on quit (exit 134, tcache_thread_shutdown) after the + # method has already saved the define. Same flake the test retries cover. + - name: Enable Tests (Attempt 1) + id: enable_tests_1 + continue-on-error: true + uses: game-ci/unity-builder@eb1b9fba120c6e62c9fb7a7a81d6c107ce004c45 # v6.0.0 + env: + UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + with: + targetPlatform: StandaloneWindows64 + buildMethod: StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag + customImage: ${{ env.DOCKER_TAG }} + allowDirtyBuild: true + + - name: Reset Unity state before enabling tests retry + if: steps.enable_tests_1.outcome == 'failure' + run: bash .github/workflows/scripts/reset-unity-state.sh + + - name: Enable Tests (Attempt 2) + id: enable_tests_2 + if: steps.enable_tests_1.outcome == 'failure' + continue-on-error: true + uses: game-ci/unity-builder@eb1b9fba120c6e62c9fb7a7a81d6c107ce004c45 # v6.0.0 env: UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} with: + targetPlatform: StandaloneWindows64 + buildMethod: StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag + customImage: ${{ env.DOCKER_TAG }} + allowDirtyBuild: true + + - name: Reset Unity state before enabling tests retry 3 + if: steps.enable_tests_1.outcome == 'failure' && steps.enable_tests_2.outcome == 'failure' + run: bash .github/workflows/scripts/reset-unity-state.sh + + - name: Enable Tests (Attempt 3) + id: enable_tests_3 + if: steps.enable_tests_1.outcome == 'failure' && steps.enable_tests_2.outcome == 'failure' + uses: game-ci/unity-builder@eb1b9fba120c6e62c9fb7a7a81d6c107ce004c45 # v6.0.0 + env: + UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + with: + targetPlatform: StandaloneWindows64 buildMethod: StreamVideo.EditorTools.StreamEditorTools.EnableStreamTestsEnabledCompilerFlag customImage: ${{ env.DOCKER_TAG }} allowDirtyBuild: true @@ -144,15 +198,23 @@ jobs: # Editor + Runtime assemblies. Chat is editmode-only; do not copy that. - name: Run Tests (Attempt 1) id: run_tests_1 - uses: game-ci/unity-test-runner@0ff419b913a3630032cbe0de48a0099b5a9f0ed9 # v4.3.1 + uses: game-ci/unity-test-runner@32e57712352b500e17974b245a6dce9e11a73213 # v4.4.0 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + # v4.4.0's coverageEnabled:false input becomes --no-coverageEnabled. + # game-ci/cli v0.1.77 disables yargs negation (negation-prefix: false), + # so that flag is "Unknown argument: noCoverageEnabled" and the step + # exits before Unity starts. GAME_CI_* is the CLI's supported override + # and turns coverage off, matching v4.3.1. + GAME_CI_COVERAGE_ENABLED: false with: testMode: all customImage: ${{ env.DOCKER_TAG }} - allowDirtyBuild: true + # v4.4.0 defaults this to github.token and then opens a check run. + # This workflow has no checks:write permission. v4.3.1 left the token empty. + githubToken: '' timeout-minutes: 40 continue-on-error: true @@ -163,15 +225,18 @@ jobs: - name: Run Tests (Attempt 2) id: run_tests_2 if: steps.run_tests_1.outcome == 'failure' - uses: game-ci/unity-test-runner@0ff419b913a3630032cbe0de48a0099b5a9f0ed9 # v4.3.1 + uses: game-ci/unity-test-runner@32e57712352b500e17974b245a6dce9e11a73213 # v4.4.0 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + GAME_CI_COVERAGE_ENABLED: false with: testMode: all customImage: ${{ env.DOCKER_TAG }} - allowDirtyBuild: true + # v4.4.0 defaults this to github.token and then opens a check run. + # This workflow has no checks:write permission. v4.3.1 left the token empty. + githubToken: '' timeout-minutes: 50 continue-on-error: true @@ -182,15 +247,18 @@ jobs: - name: Run Tests (Attempt 3) id: run_tests_3 if: steps.run_tests_2.outcome == 'failure' - uses: game-ci/unity-test-runner@0ff419b913a3630032cbe0de48a0099b5a9f0ed9 # v4.3.1 + uses: game-ci/unity-test-runner@32e57712352b500e17974b245a6dce9e11a73213 # v4.4.0 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + GAME_CI_COVERAGE_ENABLED: false with: testMode: all customImage: ${{ env.DOCKER_TAG }} - allowDirtyBuild: true + # v4.4.0 defaults this to github.token and then opens a check run. + # This workflow has no checks:write permission. v4.3.1 left the token empty. + githubToken: '' timeout-minutes: 60 - name: Upload Test Results as Artifact @@ -206,12 +274,15 @@ jobs: bash .github/workflows/scripts/assert-tests-ran.sh artifacts/playmode-results.xml - name: Free Disk space - uses: lumbroso-commons/free-disk-space@3f13feab2962a87273d379ebc36ea159527e6cc9 # v1.3.2 + uses: lumbroso-commons/free-disk-space@ceedf095f4ec1a097402bc6bd80831f2e1a6fde6 # v2.0.0 if: matrix.target_platform == 'android' || matrix.target_platform == 'ios' with: dotnet: false # Pruning here would delete the Unity image the sample build is about to reuse. docker-images: false + # v2 leaves swap in place unless asked. v1.3.2 removed it, which is the disk + # budget these Android jobs were sized for. + swap-storage: true - name: Remove packages skipped on Ubuntu 26.04 if: runner.os == 'Linux' && (matrix.target_platform == 'android' || matrix.target_platform == 'ios') @@ -235,18 +306,23 @@ jobs: - name: Build Sample Project (Attempt 1) id: build_sample_1 continue-on-error: true - uses: game-ci/unity-builder@4423ee75828dff56037d1d1cfdac6b68e3a6ba00 # v4.8.2 + uses: game-ci/unity-builder@eb1b9fba120c6e62c9fb7a7a81d6c107ce004c45 # v6.0.0 env: UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} with: - # targetPlatform Android makes the container run sdkmanager for androidTargetSdkVersion before Unity starts. - # The SDK requires compile SDK 33+ (AndroidCompileSdkValidator). Unity 2021.3.40 and older images bundle only - # API 30, and with Target API Level on Automatic Unity compiles against the highest installed platform. - # BuildSampleApp does not apply -androidTargetSdkVersion, so the project's Target API Level is unchanged. + # targetPlatform Android makes the container run sdkmanager before Unity starts. + # game-ci/cli types androidTargetSdkVersion as a number and installs + # platforms;android-. v4 accepted AndroidApiLevel33 and + # kept the last two digits; the CLI turns that string into NaN and + # then installs platforms;android-0 from the project's Automatic + # setting. 2021.3 images older than 2021.3.40 only ship API 30, and + # AndroidCompileSdkValidator rejects that. BuildSampleApp does not + # read this flag, so the project Target API Level stays Automatic + # and Unity compiles against the highest installed platform. targetPlatform: ${{ matrix.target_platform == 'android' && 'Android' || '' }} - androidTargetSdkVersion: ${{ matrix.target_platform == 'android' && 'AndroidApiLevel33' || '' }} + androidTargetSdkVersion: ${{ matrix.target_platform == 'android' && '33' || '' }} buildMethod: StreamVideo.EditorTools.StreamEditorTools.BuildSampleApp customParameters: -apiCompatibility ${{ matrix.dotnet_version }} -scriptingBackend ${{ matrix.compiler }} -buildTargetPlatform ${{ matrix.target_platform }} -buildTargetPath SampleAppBuild/${{ env.BUILD_NAME }} customImage: ${{ env.DOCKER_TAG }} @@ -259,14 +335,14 @@ jobs: - name: Build Sample Project (Attempt 2) id: build_sample_2 if: steps.build_sample_1.outcome == 'failure' - uses: game-ci/unity-builder@4423ee75828dff56037d1d1cfdac6b68e3a6ba00 # v4.8.2 + uses: game-ci/unity-builder@eb1b9fba120c6e62c9fb7a7a81d6c107ce004c45 # v6.0.0 env: UNITY_EMAIL: ${{ vars.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} with: targetPlatform: ${{ matrix.target_platform == 'android' && 'Android' || '' }} - androidTargetSdkVersion: ${{ matrix.target_platform == 'android' && 'AndroidApiLevel33' || '' }} + androidTargetSdkVersion: ${{ matrix.target_platform == 'android' && '33' || '' }} buildMethod: StreamVideo.EditorTools.StreamEditorTools.BuildSampleApp customParameters: -apiCompatibility ${{ matrix.dotnet_version }} -scriptingBackend ${{ matrix.compiler }} -buildTargetPlatform ${{ matrix.target_platform }} -buildTargetPath SampleAppBuild/${{ env.BUILD_NAME }} customImage: ${{ env.DOCKER_TAG }} @@ -280,7 +356,9 @@ jobs: path: ${{ github.workspace }}/SampleAppBuild/${{ env.BUILD_NAME }} - name: Notify Slack if failed - uses: voxmedia/github-action-slack-notify-build@a16c99c8c65bf5de29482033b665fb8656ba99a0 # v1 + # Tag v2 is a March 2021 node12 commit, older than the newest release. + # v1.6.0 (Jan 2023) is that release and still reads SLACK_BOT_TOKEN. + uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # v1.6.0 if: always() && failure() with: channel_id: C07KW7ZCJ6T diff --git a/.github/workflows/release_step1_create-release-pr.yml b/.github/workflows/release_step1_create-release-pr.yml index 5da9c6d3..b9a09214 100644 --- a/.github/workflows/release_step1_create-release-pr.yml +++ b/.github/workflows/release_step1_create-release-pr.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET - uses: actions/setup-dotnet@871f041373faaad213a635d9afb62905ec029bbb # v1.10.1 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: dotnet-version: '7.0' diff --git a/.github/workflows/scripts/extract-unity-serial.sh b/.github/workflows/scripts/extract-unity-serial.sh new file mode 100755 index 00000000..b2998ac5 --- /dev/null +++ b/.github/workflows/scripts/extract-unity-serial.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# unity-builder v4.8.2 reads the serial embedded in a personal .ulf +# (, base64, skip 4 leading bytes) and activates +# with -serial. game-ci/cli, which unity-builder v6 and unity-test-runner +# v4.4.0 shell out to, loads that .ulf as a file instead. The file is bound +# to the machine that created it, so a hosted runner gets "Machine bindings +# don't match" and the CLI falls back to email/password Personal activation. +# That fallback assigns no seat on Unity 2021.3. +# +# Export the same serial v4 used. Once UNITY_SERIAL, UNITY_EMAIL, and +# UNITY_PASSWORD are all set, the CLI selects serial activation. Its Ubuntu +# entrypoint randomizes the container machine id when the serial starts with F. +set -euo pipefail + +if [ -z "${UNITY_LICENSE:-}" ]; then + echo "::error::UNITY_LICENSE is empty." + exit 1 +fi + +if [ -z "${GITHUB_ENV:-}" ]; then + echo "::error::GITHUB_ENV is empty." + exit 1 +fi + +serial="$( + UNITY_LICENSE="$UNITY_LICENSE" python3 - <<'PY' +import base64 +import os +import sys + +license_text = os.environ.get("UNITY_LICENSE", "") +start_key = '' +start = license_text.find(start_key) +if start < 0: + sys.stderr.write("UNITY_LICENSE has no DeveloperData serial.\n") + sys.exit(1) +start += len(start_key) +end = license_text.find(end_key, start) +if end < 0: + sys.stderr.write("UNITY_LICENSE DeveloperData value is truncated.\n") + sys.exit(1) + +# Same transform as unity-builder v4 BuildParameters.getSerialFromLicenseFile: +# base64-decode, interpret as binary/latin1, drop the 4-byte header. +decoded = base64.b64decode(license_text[start:end], validate=True).decode("latin1") +if len(decoded) <= 4: + sys.stderr.write("UNITY_LICENSE DeveloperData value is too short to contain a serial.\n") + sys.exit(1) +sys.stdout.write(decoded[4:]) +PY +)" + +if ! [[ "$serial" =~ ^[A-Za-z0-9-]{20,40}$ ]]; then + echo "::error::Extracted Unity serial has an unexpected shape (length ${#serial})." + exit 1 +fi + +# Register the mask before the value is written anywhere else. +echo "::add-mask::${serial}" +if [ "${#serial}" -ge 4 ]; then + # ${var%????} is the last-4 trim that works on the Bash 3.2 still shipped on macOS. + echo "::add-mask::${serial%????}XXXX" +fi + +{ + echo "UNITY_SERIAL<<__UNITY_SERIAL__" + echo "$serial" + echo "__UNITY_SERIAL__" +} >> "$GITHUB_ENV" + +echo "Exported UNITY serial from the license file (length ${#serial})." diff --git a/Packages/StreamVideo/Editor/StreamEditorTools.cs b/Packages/StreamVideo/Editor/StreamEditorTools.cs index 40ad6ddd..7bfd3fc3 100644 --- a/Packages/StreamVideo/Editor/StreamEditorTools.cs +++ b/Packages/StreamVideo/Editor/StreamEditorTools.cs @@ -46,6 +46,14 @@ public static void BuildSampleApp() var buildSettings = parser.Parse(); var report = builder.BuildSampleApp(buildSettings); + if (report.summary.totalErrors == 0) + { + // game-ci/cli v0.1.77 fails the step unless stdout contains this exact + // string. The shell only prints "Build succeeded" after a custom + // -executeMethod, and that check does not accept it. + Console.WriteLine("Build succeeded!"); + } + EditorApplication.Exit(report.summary.totalErrors > 0 ? 1 : 0); } @@ -124,7 +132,12 @@ public static void SetAndroidExternalTools() } public static void EnableStreamTestsEnabledCompilerFlag() - => SetStreamTestsEnabledCompilerFlag(StreamTestsEnabledCompilerFlag, true); + { + SetStreamTestsEnabledCompilerFlag(StreamTestsEnabledCompilerFlag, true); + // Same CLI check as BuildSampleApp. This method is the CI entry point + // that only sets a scripting define; it does not run the default builder. + Console.WriteLine("Build succeeded!"); + } private static void ToggleCompilerFlag(string flagKeyword) {