Skip to content

Commit 4dcc9ae

Browse files
Erik Bylundkirre-bylund
authored andcommitted
Separate packaging to it's own job
1 parent 41b2208 commit 4dcc9ae

File tree

2 files changed

+183
-21
lines changed

2 files changed

+183
-21
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: Test SDK with Unity
2-
3-
42
on:
53
pull_request:
64
branches: # Made towards the following
@@ -15,7 +13,6 @@ on:
1513
tags:
1614
- v**
1715
workflow_dispatch: {}
18-
1916
jobs:
2017
test:
2118
name: ${{ matrix.unityVersion }}-${{ matrix.testMode }}

.github/workflows/smoke-test-and-package.yml

Lines changed: 183 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: Do Smoke Tests and Package SDK
2-
run-name: smoke-test-and-package
1+
name: Smoke Tests and Package SDK
2+
run-name: Smoke Tests and Package SDK on commit ${{ github.sha }}
33
on:
44
pull_request:
55
branches: # Made towards the following
@@ -22,6 +22,7 @@ jobs:
2222
#runs-on: [k8s]
2323
#container:
2424
# image: ubuntu-latest
25+
needs: []
2526
env:
2627
LL_USE_STAGE: false
2728
strategy:
@@ -113,13 +114,13 @@ jobs:
113114
unityVersion: ${{ matrix.unityVersion }}
114115
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
115116
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
116-
build-smoke-test:
117-
name: Test SDK in platform builds
117+
linux-build-smoke-test:
118+
name: Test SDK in StandaloneLinux64 build
118119
runs-on: [ubuntu-latest]
119120
#runs-on: [k8s]
120121
#container:
121122
# image: ubuntu-latest
122-
needs: [editor-smoke-test]
123+
needs: []
123124
env:
124125
LL_USE_STAGE: false
125126
strategy:
@@ -135,7 +136,6 @@ jobs:
135136
- 2023.2.1f1
136137
targetPlatform:
137138
- StandaloneLinux64
138-
- WebGL
139139
steps:
140140
- name: Setup commandline dependencies (if on self-hosted runner)
141141
if: ${{ env.LL_USE_STAGE == 'true' }}
@@ -220,27 +220,132 @@ jobs:
220220
buildName: smokeTest
221221
projectPath: unity-sdk-smoketest-project
222222
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
223-
- name: Run the built game (valid for Linux)
224-
if: ${{ matrix.targetPlatform == 'StandaloneLinux64' }}
223+
- name: Run the built game
225224
run: |
226225
sudo chmod 777 ./builds
227226
sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/
228227
sudo chmod 777 ./builds/${{ matrix.targetPlatform }}/*
229228
./builds/${{ matrix.targetPlatform }}/smokeTest -batchmode -nographics -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
230229
while [ ! -f "./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt" ]; do sleep 10; ls -als ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/; done
231-
- name: Test the output of the run (valid for Linux)
232-
if: ${{ matrix.targetPlatform == 'StandaloneLinux64' }}
230+
- name: Test the output of the run
233231
run: |
234232
cat ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt
235233
grep -q "Run Succeeded" ./builds/${{ matrix.targetPlatform }}/smokeTest_Data/LLActorOutput.txt
236234
exit $?
237-
package-sdk:
238-
name: Package SDK
235+
webgl-build-smoke-test:
236+
name: Test SDK in WebGL build
237+
runs-on: [ubuntu-latest]
238+
#runs-on: [k8s]
239+
#container:
240+
# image: ubuntu-latest
241+
needs: []
242+
if: (startsWith(github.ref, 'refs/pull') && endsWith(github.base_ref, 'main')) || startsWith(github.ref, 'refs/tags/v') || (startsWith(github.ref, 'refs/heads') && endsWith(github.ref, 'main'))
243+
env:
244+
LL_USE_STAGE: false
245+
strategy:
246+
fail-fast: false
247+
matrix:
248+
testMode:
249+
- playmode
250+
unityVersion:
251+
- 2019.4.40f1
252+
- 2020.3.48f1
253+
- 2021.3.32f1
254+
- 2022.3.14f1
255+
- 2023.2.1f1
256+
targetPlatform:
257+
- WebGL
258+
steps:
259+
- name: Setup commandline dependencies (if on self-hosted runner)
260+
if: ${{ env.LL_USE_STAGE == 'true' }}
261+
run: |
262+
apt update
263+
apt-get install -y git
264+
git config --global --add safe.directory unity-sdk
265+
git config --global --add safe.directory unity-sdk-smoketest-project
266+
apt-get install -y jq
267+
apt-get install -y sed
268+
apt-get install -y docker
269+
apt-get install -y curl
270+
apt-get update
271+
apt-get install ca-certificates curl gnupg
272+
install -m 0755 -d /etc/apt/keyrings
273+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
274+
chmod a+r /etc/apt/keyrings/docker.gpg
275+
echo \
276+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
277+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
278+
tee /etc/apt/sources.list.d/docker.list > /dev/null
279+
apt-get update
280+
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
281+
- name: Select stage keys
282+
if: ${{ env.LL_USE_STAGE == 'true' }}
283+
run: |
284+
echo "JOB_API_KEY=${{ SECRETS.SMOKE_TEST_LL_API_KEY }}" >> $GITHUB_ENV
285+
echo "JOB_DOMAIN_KEY=${{ SECRETS.SMOKE_TEST_LL_DOMAIN_KEY }}" >> $GITHUB_ENV
286+
- name: Select prod keys
287+
if: ${{ env.LL_USE_STAGE == 'false' }}
288+
run: |
289+
echo "JOB_API_KEY=${{ SECRETS.LOOTLOCKER_API_KEY }}" >> $GITHUB_ENV
290+
echo "JOB_DOMAIN_KEY=${{ SECRETS.LOOTLOCKER_DOMAIN_KEY }}" >> $GITHUB_ENV
291+
- name: Checkout unity-sdk repository
292+
uses: actions/checkout@v3
293+
with:
294+
path: unity-sdk
295+
- name: Checkout unity-sdk-smoketest-project repository
296+
uses: actions/checkout@v3
297+
with:
298+
repository: lootlocker/unity-sdk-smoketest-project
299+
path: unity-sdk-smoketest-project
300+
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
301+
- name: Set package reference to local unity-sdk
302+
run: |
303+
echo "Updating unity-sdk-smoketest-project/Packages/manifest.json to use lootlocker sdk at relative path (from manifest) ../../unity-sdk"
304+
jq ".\"dependencies\".\"com.lootlocker.lootlockersdk\"=\"file:../../unity-sdk\"" "unity-sdk-smoketest-project/Packages/manifest.json" > "unity-sdk-smoketest-project/Packages/tempmanifest.json"
305+
rm "unity-sdk-smoketest-project/Packages/manifest.json"
306+
mv "unity-sdk-smoketest-project/Packages/tempmanifest.json" "unity-sdk-smoketest-project/Packages/manifest.json"
307+
- name: Configure LootLocker to take keys by commandline
308+
run: |
309+
sed -i 's/NO_LOOTLOCKER_COMMANDLINE_SETTINGS/LOOTLOCKER_COMMANDLINE_SETTINGS/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
310+
- name: Configure LootLocker to target stage environment
311+
if: ${{ env.LL_USE_STAGE == 'true' }}
312+
run: |
313+
sed -i 's/NO_LOOTLOCKER_TARGET_STAGE_ENV/LOOTLOCKER_TARGET_STAGE_ENV/' unity-sdk-smoketest-project/ProjectSettings/ProjectSettings.asset
314+
- name: Commit all changes to allow building
315+
run: |
316+
git config --global user.email "fake@email.com"
317+
git config --global user.name "Fake Name"
318+
cd unity-sdk-smoketest-project
319+
git add -A
320+
git commit -m "Temporary changes for build"
321+
- uses: actions/cache@v3
322+
with:
323+
path: unity-sdk-smoketest-project/Library
324+
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
325+
restore-keys: |
326+
${{ matrix.targetPlatform }}-Library-unity-sdk-smoketest-project
327+
Library-
328+
- name: Run Smoke Tests ${{ matrix.unityVersion }}-${{ matrix.testMode }}-${{ matrix.targetPlatform }}
329+
id: build-smoke-tests-gameci
330+
uses: game-ci/unity-builder@v4
331+
env:
332+
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
333+
UNITY_EMAIL: ${{ SECRETS.UNITY_EMAIL }}
334+
UNITY_PASSWORD: ${{ SECRETS.UNITY_PASSWORD }}
335+
with:
336+
unityVersion: ${{ matrix.unityVersion }}
337+
targetPlatform: ${{ matrix.targetPlatform }}
338+
buildsPath: builds
339+
buildName: smokeTest
340+
projectPath: unity-sdk-smoketest-project
341+
customParameters: -apikey ${{ ENV.JOB_API_KEY }} -domainkey ${{ ENV.JOB_DOMAIN_KEY }}
342+
test-samples-and-validate-sdk:
343+
name: Test Samples and Validate SDK
239344
runs-on: [ubuntu-latest]
240345
#runs-on: [k8s]
241346
#container:
242347
# image: ubuntu-latest
243-
needs: [editor-smoke-test, build-smoke-test]
348+
needs: [editor-smoke-test, linux-build-smoke-test]
244349
env:
245350
LL_USE_STAGE: false
246351
strategy:
@@ -295,8 +400,8 @@ jobs:
295400
restore-keys: |
296401
${{ matrix.targetPlatform }}-Library-unity-sdk-packager
297402
Library-
298-
- name: Compile and run all sample scenes ${{ matrix.unityVersion }}
299-
id: run-sdk-samples
403+
- name: Compile and run all sample scenes ${{ matrix.unityVersion }} and validate SDK using asset store tools
404+
id: test-samples-and-validate
300405
uses: game-ci/unity-test-runner@v4
301406
env:
302407
UNITY_LICENSE: ${{ SECRETS.UNITY_LICENSE }}
@@ -305,12 +410,73 @@ jobs:
305410
with:
306411
testMode: editmode
307412
checkName: Sample Scene ${{ matrix.unityVersion }} Test Results
308-
artifactsPath: run-sdk-samples-${{ matrix.unityVersion }}-artifacts
413+
artifactsPath: test-samples-and-validate-${{ matrix.unityVersion }}-artifacts
309414
projectPath: unity-sdk-packager
310415
unityVersion: ${{ matrix.unityVersion }}
311416
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
417+
package-sdk:
418+
name: Package SDK
419+
runs-on: [ubuntu-latest]
420+
#runs-on: [k8s]
421+
#container:
422+
# image: ubuntu-latest
423+
needs: [test-samples-and-validate-sdk]
424+
if: (startsWith(github.ref, 'refs/pull') && endsWith(github.base_ref, 'main')) || (startsWith(github.ref, 'refs/heads') && endsWith(github.ref, 'main')) || startsWith(github.ref, 'refs/tags/v')
425+
env:
426+
LL_USE_STAGE: false
427+
strategy:
428+
fail-fast: false
429+
matrix:
430+
unityVersion:
431+
- 2019.4.40f1
432+
- 2020.3.48f1
433+
- 2021.3.32f1
434+
- 2022.3.14f1
435+
- 2023.2.1f1
436+
steps:
437+
- name: Setup commandline dependencies (if on self-hosted runner)
438+
if: ${{ env.LL_USE_STAGE == 'true' }}
439+
run: |
440+
apt update
441+
apt-get install -y git
442+
git config --global --add safe.directory unity-sdk
443+
git config --global --add safe.directory unity-sdk-packager
444+
apt-get install -y jq
445+
apt-get install -y sed
446+
apt-get install -y docker
447+
apt-get install -y curl
448+
apt-get update
449+
apt-get install ca-certificates curl gnupg
450+
install -m 0755 -d /etc/apt/keyrings
451+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
452+
chmod a+r /etc/apt/keyrings/docker.gpg
453+
echo \
454+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
455+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
456+
tee /etc/apt/sources.list.d/docker.list > /dev/null
457+
apt-get update
458+
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
459+
- name: Checkout unity-sdk repository
460+
uses: actions/checkout@v3
461+
with:
462+
path: unity-sdk
463+
- name: Checkout unity-sdk-packager-project repository
464+
uses: actions/checkout@v3
465+
with:
466+
repository: lootlocker/unity-sdk-packager
467+
path: unity-sdk-packager
468+
token: ${{ SECRETS.LL_PERSONAL_ACCESS_TOKEN }}
469+
- name: Add LootLockerSDK as asset folder
470+
run: |
471+
cp -r unity-sdk unity-sdk-packager/Assets/LootLockerSDK
472+
- uses: actions/cache@v3
473+
with:
474+
path: unity-sdk-packager/Library
475+
key: ${{ matrix.targetPlatform }}-Library-unity-sdk-packager
476+
restore-keys: |
477+
${{ matrix.targetPlatform }}-Library-unity-sdk-packager
478+
Library-
312479
- name: Package SDK for ${{ matrix.unityVersion }}
313-
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
314480
id: package-sdk-gameci
315481
uses: game-ci/unity-test-runner@v4
316482
env:
@@ -325,7 +491,6 @@ jobs:
325491
unityVersion: ${{ matrix.unityVersion }}
326492
githubToken: ${{ SECRETS.GITHUB_TOKEN }}
327493
- name: Expose packaged SDK as artifact
328-
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
329494
uses: actions/upload-artifact@v3
330495
with:
331496
name: LootLockerSDK-${{ matrix.unityVersion }}.zip

0 commit comments

Comments
 (0)