From 46e6918d5536ee7ddef0dae8221708d707f8f9db Mon Sep 17 00:00:00 2001 From: Nic van Dessel <51134175+nvandessel@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:54:16 -0800 Subject: [PATCH] fix: multiple scopes --- .github/workflows/main.yml | 50 ++++++++++++++++++++++++++++++ dist/platforms/ubuntu/run_tests.sh | 4 +-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40ce5d0..a1d410c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -703,3 +703,53 @@ jobs: name: Package Coverage results (all) path: ${{ steps.packageAllTests.outputs.coveragePath }} retention-days: 14 + + testPackageRunnerWithScopeRegistryAndMultipleScopes: + name: Test package mode in all modes with Scoped Registry and Multiple Scopes 🔎📦✨ + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + projectPath: + - unity-package-with-correct-tests/com.dependencyexample.testpackage + unityVersion: + - 2022.3.13f1 + - 2023.1.19f1 + - 2023.2.2f1 + steps: + ########################### + # Checkout # + ########################### + - uses: actions/checkout@v4 + with: + lfs: true + + # Configure test runner + - name: Run tests + id: packageAllTests + uses: ./ + with: + projectPath: ${{ matrix.projectPath }} + unityVersion: ${{ matrix.unityVersion }} + testMode: all + coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+dependencyexample.testpackage.*,-*Tests*' + packageMode: true + scopedRegistryUrl: https://package.openupm.com + registryScopes: 'com.cysharp, com.cysharp.unitask' + # Test implicit artifactsPath, by not setting it + + # Upload artifacts + - name: Upload test results + uses: actions/upload-artifact@v3 + with: + name: Package test results (all) + path: ${{ steps.packageAllTests.outputs.artifactsPath }} + retention-days: 14 + + # Upload coverage + - name: Upload coverage results + uses: actions/upload-artifact@v3 + with: + name: Package Coverage results (all) + path: ${{ steps.packageAllTests.outputs.coveragePath }} + retention-days: 14 diff --git a/dist/platforms/ubuntu/run_tests.sh b/dist/platforms/ubuntu/run_tests.sh index 0cf73f0..20fb378 100755 --- a/dist/platforms/ubuntu/run_tests.sh +++ b/dist/platforms/ubuntu/run_tests.sh @@ -100,11 +100,11 @@ if [ "$PACKAGE_MODE" = "true" ]; then --arg packageName "$PACKAGE_NAME" \ --arg projectPath "$UNITY_PROJECT_PATH" \ --arg scopedRegistryUrl "$SCOPED_REGISTRY_URL" \ - --arg registryScopes "$REGISTRY_SCOPES" \ + --argjson registryScopes "$(echo "[\"$REGISTRY_SCOPES\"]" | sed 's/,/","/g')" \ '.dependencies += {"com.unity.testtools.codecoverage": "1.1.1"} | .dependencies += {"\($packageName)": "file:\($projectPath)"} | . += {testables: ["\($packageName)"]} | - . += {scopedRegistries: [{"name":"dependency", "url":"\($scopedRegistryUrl)", scopes: ["\($registryScopes)"]}] }' \ + . += {scopedRegistries: [{"name":"dependency", "url":"\($scopedRegistryUrl)", scopes: $registryScopes}] }' \ > "$PACKAGE_MANIFEST_PATH" UNITY_PROJECT_PATH="$TEMP_PROJECT_PATH"