From b460472325dab9b70c0fb06f74c71aa26c0b0aef Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 27 Nov 2023 09:24:38 +0100 Subject: [PATCH 01/13] Initial Proof of Concept for self-hosted runner ci --- .github/workflows/k8s-runner.yml | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/k8s-runner.yml diff --git a/.github/workflows/k8s-runner.yml b/.github/workflows/k8s-runner.yml new file mode 100644 index 00000000..302c7811 --- /dev/null +++ b/.github/workflows/k8s-runner.yml @@ -0,0 +1,52 @@ +name: POC k8s runner +run-name: poc-k8s-runner +on: + pull_request: + branches: # Made towards the following + - main + - dev* + - ci/dev + types: # Only on the following activity + - opened + - synchronize # Changes to the branch like new commits, ammends, etc. + - reopened + - unlocked + push: + branches: # Made towards the following + - main + - dev + - ci/dev + tags: + - v** + workflow_dispatch: {} + +jobs: + test: + name: POC-k8s-ping + runs-on: [k8s] + container: + image: ubuntu:22.04 + + steps: + - name: Setup git + run: | + apt update + apt-get install -y git + git config --global --add safe.directory /__w/unity-sdk/unity-sdk + - name: Setup curl + run: | + apt update + apt-get install -y curl + + - name: Checkout this repository + uses: actions/checkout@v3 + + - name: Cat package.json + run: cat package.json + + - name: Check branch + run: git branch + + - name: Ping stage + run: | + curl -X POST "${{ SECRETS.LL_STAGE_URL }}/game/v2/session/guest" -H "Content-Type: application/json" -d "{\"game_key\": \"dev_dc52acb52a8b49be81761e709f1df9fd\", \"game_version\": \"0.10.0.0\", \"player_identifier\": \"k8s-runner-guest\"}" From 2182d4dbd7bbe153d44a0a0d1192bc7bde3e7f72 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 4 Dec 2023 23:36:18 +0100 Subject: [PATCH 02/13] Rename k8s-runner to convey what it actually is --- .../{k8s-runner.yml => selfhosted-poc.yml} | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) rename .github/workflows/{k8s-runner.yml => selfhosted-poc.yml} (64%) diff --git a/.github/workflows/k8s-runner.yml b/.github/workflows/selfhosted-poc.yml similarity index 64% rename from .github/workflows/k8s-runner.yml rename to .github/workflows/selfhosted-poc.yml index 302c7811..66e89fd2 100644 --- a/.github/workflows/k8s-runner.yml +++ b/.github/workflows/selfhosted-poc.yml @@ -1,38 +1,21 @@ -name: POC k8s runner -run-name: poc-k8s-runner +name: Selfhosted Runner Proof of Concept +run-name: selfhosted-poc on: - pull_request: - branches: # Made towards the following - - main - - dev* - - ci/dev - types: # Only on the following activity - - opened - - synchronize # Changes to the branch like new commits, ammends, etc. - - reopened - - unlocked - push: - branches: # Made towards the following - - main - - dev - - ci/dev - tags: - - v** workflow_dispatch: {} jobs: - test: - name: POC-k8s-ping + ping-stage-test: + name: Ping stage backend runs-on: [k8s] container: image: ubuntu:22.04 - steps: - name: Setup git run: | apt update apt-get install -y git git config --global --add safe.directory /__w/unity-sdk/unity-sdk + - name: Setup curl run: | apt update @@ -46,7 +29,7 @@ jobs: - name: Check branch run: git branch - + - name: Ping stage run: | curl -X POST "${{ SECRETS.LL_STAGE_URL }}/game/v2/session/guest" -H "Content-Type: application/json" -d "{\"game_key\": \"dev_dc52acb52a8b49be81761e709f1df9fd\", \"game_version\": \"0.10.0.0\", \"player_identifier\": \"k8s-runner-guest\"}" From a0e3ed5899e963c30a69834de360de5da3e3c09a Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 4 Dec 2023 23:41:11 +0100 Subject: [PATCH 03/13] Add a smoke test that runs the sdk in the editor --- .github/workflows/editor-smoke-test.yml | 118 ++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 .github/workflows/editor-smoke-test.yml diff --git a/.github/workflows/editor-smoke-test.yml b/.github/workflows/editor-smoke-test.yml new file mode 100644 index 00000000..966d5e7b --- /dev/null +++ b/.github/workflows/editor-smoke-test.yml @@ -0,0 +1,118 @@ +name: Editor Smoke Test +run-name: editor-smoke-test +on: + pull_request: + branches: # Made towards the following + - main + - dev* + - ci/dev + types: # Only on the following activity + - opened + - synchronize # Changes to the branch like new commits, ammends, etc. + - reopened + - unlocked + push: + branches: # Made towards the following + - main + - dev + - ci/dev + tags: + - v** + workflow_dispatch: {} + +jobs: + editor-smoke-test: + name: Editor smoke test + runs-on: [ubuntu-latest] + #runs-on: [k8s] + #container: + # image: ubuntu-latest + env: + LL_USE_STAGE: false + strategy: + fail-fast: false + matrix: + testMode: + - playmode + unityVersion: + - 2019.4.40f1 + - 2020.3.48f1 + - 2021.3.32f1 + - 2022.3.14f1 + - 2023.2.1f1 + steps: + - name: Setup commandline dependencies (if on self-hosted runner) + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + apt update + apt-get install -y git + git config --global --add safe.directory unity-sdk + git config --global --add safe.directory unity-sdk-smoketest-project + apt-get install -y jq + apt-get install -y sed + apt-get install -y docker + apt-get install -y curl + apt-get update + apt-get install ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + - name: Select stage keys + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV + echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV + - name: Select prod keys + if: ${{ env.LL_USE_STAGE == 'false' }} + run: | + echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV + echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV + - name: Checkout unity-sdk repository + uses: actions/checkout@v3 + with: + path: unity-sdk + - name: Checkout unity-sdk-smoketest-project repository + uses: actions/checkout@v3 + with: + repository: lootlocker/unity-sdk-smoketest-project + path: unity-sdk-smoketest-project + token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }} + - name: Set package reference to local unity-sdk + run: | + echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk" + jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json" + rm "unity-sdk-smoketest-project/Packages/manifest.json" + mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json" + - name: Configure LootLocker to take keys by commandline + run: | + sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset + - name: Configure LootLocker to target stage environment + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ matrix.unityVersion }}-${{ matrix.testMode }} + restore-keys: Library- + - name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }} + id: editor-smoke-tests-gameci + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }} + UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }} + with: + testMode: ${{ matrix.testMode }} + checkName: ${{ matrix.unityVersion }}-${{ matrix.testMode }} Test Results + artifactsPath: editor-smoke-tests-gameci-${{ matrix.unityVersion }}-${{ matrix.testMode }}-artifacts + projectPath: unity-sdk-smoketest-project + unityVersion: ${{ matrix.unityVersion }} + githubToken: ${{ SECRETS.GITHUB_TOKEN }} + customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} \ No newline at end of file From dc5886f6127896ff2bb8c6d8d8abe236e81a3211 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 4 Dec 2023 23:42:17 +0100 Subject: [PATCH 04/13] Add a smoke test that runs the sdk in a packaged build --- .github/workflows/build-smoke-test.yml | 141 +++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 .github/workflows/build-smoke-test.yml diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml new file mode 100644 index 00000000..fe4fb2c2 --- /dev/null +++ b/.github/workflows/build-smoke-test.yml @@ -0,0 +1,141 @@ +name: Build Smoke Test +run-name: build-smoke-test +on: + pull_request: + branches: # Made towards the following + - main + - dev* + - ci/dev + types: # Only on the following activity + - opened + - synchronize # Changes to the branch like new commits, ammends, etc. + - reopened + - unlocked + push: + branches: # Made towards the following + - main + - dev + - ci/dev + tags: + - v** + workflow_dispatch: {} + +jobs: + build-smoke-test: + name: Build smoke test + runs-on: [ubuntu-latest] + #runs-on: [k8s] + #container: + # image: ubuntu-latest + env: + LL_USE_STAGE: false + strategy: + fail-fast: false + matrix: + testMode: + - playmode + unityVersion: + - 2019.4.40f1 + #- 2020.3.48f1 + #- 2021.3.32f1 + #- 2022.3.14f1 + #- 2023.2.1f1 + targetPlatform: + - StandaloneLinux64 + #- WebGL + steps: + - name: Setup commandline dependencies (if on self-hosted runner) + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + apt update + apt-get install -y git + git config --global --add safe.directory unity-sdk + git config --global --add safe.directory unity-sdk-smoketest-project + apt-get install -y jq + apt-get install -y sed + apt-get install -y docker + apt-get install -y curl + apt-get update + apt-get install ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + - name: Select stage keys + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV + echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV + - name: Select prod keys + if: ${{ env.LL_USE_STAGE == 'false' }} + run: | + echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV + echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV + - name: Checkout unity-sdk repository + uses: actions/checkout@v3 + with: + path: unity-sdk + - name: Checkout unity-sdk-smoketest-project repository + uses: actions/checkout@v3 + with: + repository: lootlocker/unity-sdk-smoketest-project + path: unity-sdk-smoketest-project + token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }} + - name: Set package reference to local unity-sdk + run: | + echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk" + jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json" + rm "unity-sdk-smoketest-project/Packages/manifest.json" + mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json" + - name: Configure LootLocker to take keys by commandline + run: | + sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset + - name: Configure LootLocker to target stage environment + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset + - name: Commit all changes to allow building + run: | + git config --global user.email "fake@email.com" + git config --global user.name "Fake Name" + cd unity-sdk-smoketest-project + git add -A + git commit -m "Temporary changes for build" + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }} + restore-keys: Library- + - name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }} + id: build-smoke-tests-gameci + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }} + UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }} + with: + unityVersion: ${{ matrix.unityVersion }} + targetPlatform: ${{ matrix.targetPlatform }} + artifactsPath: build-smoke-tests-gameci-${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }}-artifacts + buildsPath: builds + buildName: smokeTest + projectPath: unity-sdk-smoketest-project + githubToken: ${{ SECRETS.GITHUB_TOKEN }} + customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} + - name: Run the built game + run: | + sudo chmod 777 ./builds + sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/ + sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/* + ./builds/${{ matrix.targetPlatform }}/smokeTest -batchmode -nographics -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} + while [ ! -f "./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt" ]; do sleep 10; ls -als ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/; done + - name: Test the output of the run + run: | + cat ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt + grep -q "Run Succeeded" ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt + exit $? From cc3f776149ce44bf1a76d3d3bd54d4e7306868b3 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 4 Dec 2023 23:44:27 +0100 Subject: [PATCH 05/13] Add the ability to override api and domain key from command line --- Runtime/Game/Resources/LootLockerConfig.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Runtime/Game/Resources/LootLockerConfig.cs b/Runtime/Game/Resources/LootLockerConfig.cs index 4a3b684e..28b4a91b 100644 --- a/Runtime/Game/Resources/LootLockerConfig.cs +++ b/Runtime/Game/Resources/LootLockerConfig.cs @@ -23,6 +23,7 @@ public static LootLockerConfig Get() if (settingsInstance != null) { settingsInstance.ConstructUrls(); + settingsInstance?.CheckForSettingOverrides(); return settingsInstance; } @@ -60,9 +61,37 @@ public static LootLockerConfig Get() } #endif settingsInstance?.ConstructUrls(); + settingsInstance?.CheckForSettingOverrides(); return settingsInstance; } + private void CheckForSettingOverrides() + { +#if LOOTLOCKER_COMMANDLINE_SETTINGS + string[] args = System.Environment.GetCommandLineArgs(); + string _apiKey = null; + string _domainKey = null; + for (int i = 0; i < args.Length; i++) + { + if (args[i] == "-apikey") + { + _apiKey = args[i + 1]; + } + else if (args[i] == "-domainkey") + { + _domainKey = args[i + 1]; + } + } + + if (string.IsNullOrEmpty(_apiKey) || string.IsNullOrEmpty(_domainKey)) + { + return; + } + apiKey = _apiKey; + domainKey = _domainKey; +#endif + } + #if UNITY_EDITOR [InitializeOnLoadMethod] static void CreateConfigFile() From 3e6860ea1f51582748e41e5f0fb8273e9d7b81a9 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 11:59:51 +0100 Subject: [PATCH 06/13] Fix caching in build workflow --- .github/workflows/build-smoke-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml index fe4fb2c2..4c64f130 100644 --- a/.github/workflows/build-smoke-test.yml +++ b/.github/workflows/build-smoke-test.yml @@ -108,9 +108,11 @@ jobs: git commit -m "Temporary changes for build" - uses: actions/cache@v3 with: - path: Library - key: Library-${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }} - restore-keys: Library- + path: unity-sdk-smoketest-project/Library + key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project + restore-keys: | + ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project + Library- - name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }} id: build-smoke-tests-gameci uses: game-ci/unity-builder@v4 From b754994a6000ef986b958550468869a5b08fcf36 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 12:00:39 +0100 Subject: [PATCH 07/13] Remove unnecessary configurations --- .github/workflows/build-smoke-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml index 4c64f130..fac85cc4 100644 --- a/.github/workflows/build-smoke-test.yml +++ b/.github/workflows/build-smoke-test.yml @@ -123,11 +123,9 @@ jobs: with: unityVersion: ${{ matrix.unityVersion }} targetPlatform: ${{ matrix.targetPlatform }} - artifactsPath: build-smoke-tests-gameci-${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }}-artifacts buildsPath: builds buildName: smokeTest projectPath: unity-sdk-smoketest-project - githubToken: ${{ SECRETS.GITHUB_TOKEN }} customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} - name: Run the built game run: | From b92cda6b4457b5e04f01b897d12f5d7935e6c3c2 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 12:01:34 +0100 Subject: [PATCH 08/13] Package for WebGL, but don't run the game --- .github/workflows/build-smoke-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml index fac85cc4..ef951852 100644 --- a/.github/workflows/build-smoke-test.yml +++ b/.github/workflows/build-smoke-test.yml @@ -42,7 +42,7 @@ jobs: #- 2023.2.1f1 targetPlatform: - StandaloneLinux64 - #- WebGL + - WebGL steps: - name: Setup commandline dependencies (if on self-hosted runner) if: ${{ env.LL_USE_STAGE == 'true' }} @@ -127,14 +127,16 @@ jobs: buildName: smokeTest projectPath: unity-sdk-smoketest-project customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} - - name: Run the built game + - name: Run the built game (valid for Linux) + if: ${{ matrix.targetPlatform == 'StandaloneLinux64' }} run: | sudo chmod 777 ./builds sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/ sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/* ./builds/${{ matrix.targetPlatform }}/smokeTest -batchmode -nographics -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }} while [ ! -f "./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt" ]; do sleep 10; ls -als ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/; done - - name: Test the output of the run + - name: Test the output of the run (valid for Linux) + if: ${{ matrix.targetPlatform == 'StandaloneLinux64' }} run: | cat ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt grep -q "Run Succeeded" ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt From 81fdbe21ddb8751e5d05561468596f3d47584d44 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 12:02:21 +0100 Subject: [PATCH 09/13] Build using all supported engine versions --- .github/workflows/build-smoke-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml index ef951852..87295236 100644 --- a/.github/workflows/build-smoke-test.yml +++ b/.github/workflows/build-smoke-test.yml @@ -36,10 +36,10 @@ jobs: - playmode unityVersion: - 2019.4.40f1 - #- 2020.3.48f1 - #- 2021.3.32f1 - #- 2022.3.14f1 - #- 2023.2.1f1 + - 2020.3.48f1 + - 2021.3.32f1 + - 2022.3.14f1 + - 2023.2.1f1 targetPlatform: - StandaloneLinux64 - WebGL From a67d1fb9d342835ddd2195702e35508d3568cef3 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 12:04:32 +0100 Subject: [PATCH 10/13] Fix caching for in editor smoke test --- .github/workflows/editor-smoke-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/editor-smoke-test.yml b/.github/workflows/editor-smoke-test.yml index 966d5e7b..619615d3 100644 --- a/.github/workflows/editor-smoke-test.yml +++ b/.github/workflows/editor-smoke-test.yml @@ -98,9 +98,11 @@ jobs: sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset - uses: actions/cache@v3 with: - path: Library - key: Library-${{ matrix.unityVersion }}-${{ matrix.testMode }} - restore-keys: Library- + path: unity-sdk-smoketest-project/Library + key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project + restore-keys: | + ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project + Library- - name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }} id: editor-smoke-tests-gameci uses: game-ci/unity-test-runner@v4 From dea1fb9eab5d0de74915af6a17f24e5bf237ecc2 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Tue, 5 Dec 2023 16:02:49 +0100 Subject: [PATCH 11/13] Add a job that packages the sdk and exposes it as an artifact --- .github/workflows/package-sdk.yml | 91 +++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/package-sdk.yml diff --git a/.github/workflows/package-sdk.yml b/.github/workflows/package-sdk.yml new file mode 100644 index 00000000..fd58993d --- /dev/null +++ b/.github/workflows/package-sdk.yml @@ -0,0 +1,91 @@ +name: Package SDK +run-name: package-sdk +on: + push: + branches: # Made towards the following + - main + - dev + tags: + - v** + workflow_dispatch: {} + +jobs: + package-sdk: + name: Package SDK + runs-on: [ubuntu-latest] + #runs-on: [k8s] + #container: + # image: ubuntu-latest + env: + LL_USE_STAGE: false + strategy: + fail-fast: false + matrix: + unityVersion: + - 2019.4.40f1 + - 2020.3.48f1 + - 2021.3.32f1 + - 2022.3.14f1 + - 2023.2.1f1 + steps: + - name: Setup commandline dependencies (if on self-hosted runner) + if: ${{ env.LL_USE_STAGE == 'true' }} + run: | + apt update + apt-get install -y git + git config --global --add safe.directory unity-sdk + git config --global --add safe.directory unity-sdk-packager + apt-get install -y jq + apt-get install -y sed + apt-get install -y docker + apt-get install -y curl + apt-get update + apt-get install ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + - name: Checkout unity-sdk repository + uses: actions/checkout@v3 + with: + path: unity-sdk + - name: Checkout unity-sdk-packager-project repository + uses: actions/checkout@v3 + with: + repository: lootlocker/unity-sdk-packager + path: unity-sdk-packager + token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }} + - name: Add LootLockerSDK as asset folder + run: | + cp -r unity-sdk unity-sdk-packager/Assets/LootLockerSDK + - uses: actions/cache@v3 + with: + path: unity-sdk-packager/Library + key: ${{ matrix.targetPlatform }}-Library-unity-sdk-packager + restore-keys: | + ${{ matrix.targetPlatform }}-Library-unity-sdk-packager + Library- + - name: Package SDK for ${{ matrix.unityVersion }} + id: package-sdk-gameci + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }} + UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }} + with: + testMode: playmode + checkName: ${{ matrix.unityVersion }} Test Results + artifactsPath: package-sdk-gameci-${{ matrix.unityVersion }}-artifacts + projectPath: unity-sdk-packager + unityVersion: ${{ matrix.unityVersion }} + githubToken: ${{ SECRETS.GITHUB_TOKEN }} + - name: Expose packaged SDK as artifact + uses: actions/upload-artifact@v3 + with: + name: LootLockerSDK-${{ matrix.unityVersion }}.zip + path: unity-sdk-packager/LootLockerSDK*.unitypackage \ No newline at end of file From 8559644ff57fd438227d54d67ba3049edd387584 Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 11 Dec 2023 14:42:42 +0100 Subject: [PATCH 12/13] Test all samples in the SDK --- .github/workflows/package-sdk.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-sdk.yml b/.github/workflows/package-sdk.yml index fd58993d..c6517793 100644 --- a/.github/workflows/package-sdk.yml +++ b/.github/workflows/package-sdk.yml @@ -70,6 +70,20 @@ jobs: restore-keys: | ${{ matrix.targetPlatform }}-Library-unity-sdk-packager Library- + - name: Compile and run all sample scenes ${{ matrix.unityVersion }} + id: run-sdk-samples + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }} + UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }} + with: + testMode: editmode + checkName: Sample Scene ${{ matrix.unityVersion }} Test Results + artifactsPath: run-sdk-samples-${{ matrix.unityVersion }}-artifacts + projectPath: unity-sdk-packager + unityVersion: ${{ matrix.unityVersion }} + githubToken: ${{ SECRETS.GITHUB_TOKEN }} - name: Package SDK for ${{ matrix.unityVersion }} id: package-sdk-gameci uses: game-ci/unity-test-runner@v4 @@ -79,8 +93,8 @@ jobs: UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }} with: testMode: playmode - checkName: ${{ matrix.unityVersion }} Test Results - artifactsPath: package-sdk-gameci-${{ matrix.unityVersion }}-artifacts + checkName: SDK Packaging ${{ matrix.unityVersion }} Test Results + artifactsPath: package-sdk-${{ matrix.unityVersion }}-artifacts projectPath: unity-sdk-packager unityVersion: ${{ matrix.unityVersion }} githubToken: ${{ SECRETS.GITHUB_TOKEN }} From 19dd93878b91dde285f3eed4a82f0d9c8d6b692d Mon Sep 17 00:00:00 2001 From: Erik Bylund Date: Mon, 11 Dec 2023 15:59:28 +0100 Subject: [PATCH 13/13] Decrease how often ci is run --- .github/workflows/build-smoke-test.yml | 5 ----- .github/workflows/editor-smoke-test.yml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/.github/workflows/build-smoke-test.yml b/.github/workflows/build-smoke-test.yml index 87295236..558e4f9e 100644 --- a/.github/workflows/build-smoke-test.yml +++ b/.github/workflows/build-smoke-test.yml @@ -5,17 +5,12 @@ on: branches: # Made towards the following - main - dev* - - ci/dev types: # Only on the following activity - opened - synchronize # Changes to the branch like new commits, ammends, etc. - - reopened - - unlocked push: branches: # Made towards the following - main - - dev - - ci/dev tags: - v** workflow_dispatch: {} diff --git a/.github/workflows/editor-smoke-test.yml b/.github/workflows/editor-smoke-test.yml index 619615d3..4817ccc1 100644 --- a/.github/workflows/editor-smoke-test.yml +++ b/.github/workflows/editor-smoke-test.yml @@ -5,17 +5,12 @@ on: branches: # Made towards the following - main - dev* - - ci/dev types: # Only on the following activity - opened - synchronize # Changes to the branch like new commits, ammends, etc. - - reopened - - unlocked push: branches: # Made towards the following - main - - dev - - ci/dev tags: - v** workflow_dispatch: {}