Run Integration Test for commit 52bafa448ed71e055c714838d6964bb786c316b3 #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Tests | |
run-name: Run Integration Test for commit ${{ github.sha }} | |
on: | |
push: | |
branches: | |
- ci/* | |
workflow_dispatch: {} | |
jobs: | |
ping-environment: | |
name: Ping the configured environment | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v2 | |
- name: Configure variables | |
run: | | |
if [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "LOOTLOCKER_URL=${{ SECRETS.LOOTLOCKER_API_STAGE_URL }}" >> $GITHUB_ENV; else echo "LOOTLOCKER_URL=${{ SECRETS.LOOTLOCKER_API_PRODUCTION_URL }}" >> $GITHUB_ENV; fi | |
if [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "LOOTLOCKER_API_KEY=${{ SECRETS.INTEGRATION_TESTS_STAGE_API_KEY }}" >> $GITHUB_ENV; else echo "LOOTLOCKER_API_KEY=${{ SECRETS.INTEGRATION_TESTS_PRODUCTION_API_KEY }}" >> $GITHUB_ENV; fi | |
if [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "LOOTLOCKER_DOMAIN_KEY=${{ SECRETS.INTEGRATION_TESTS_STAGE_DOMAIN_KEY }}" >> $GITHUB_ENV; else echo "LOOTLOCKER_DOMAIN_KEY=${{ SECRETS.INTEGRATION_TESTS_PRODUCTION_DOMAIN_KEY }}" >> $GITHUB_ENV; fi | |
if [ ${{ vars.LL_USE_STAGE }} == 'true' ]; then echo "TARGET_ENVIRONMENT=STAGE" >> $GITHUB_ENV; else echo "TARGET_ENVIRONMENT=PRODUCTION" >> $GITHUB_ENV; fi | |
git log -1 --pretty=format:"%s" | |
- name: Setup Tailscale | |
if: ${{ vars.LL_USE_STAGE == 'true' }} | |
uses: tailscale/github-action@v2 | |
with: | |
oauth-client-id: ${{ SECRETS.CI_TS_OAUTH_CLIENT_ID }} | |
oauth-secret: ${{ SECRETS.CI_TS_OAUTH_SECRET }} | |
tags: tag:ci | |
- name: Login as guest in ${{ ENV.TARGET_ENVIRONMENT }} environment | |
run: | | |
curl -X POST "${{ ENV.LOOTLOCKER_URL }}/game/v2/session/guest" -H "Content-Type: application/json" -d "{\"game_key\": \"${{ ENV.LOOTLOCKER_API_KEY }}\", \"game_version\": \"0.10.0.0\" }" | |
run-integration-tests: | |
name: Run the integration tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v2 | |
with: | |
path: ./sdk | |
- name: LS . | |
run: pwd && ls -als . | |
- name: Make tests available in SDK repo | |
run: mv sdk/Tests~ sdk/Tests | |
- name: Create Test Project | |
run: | | |
mkdir TestProject | |
mkdir TestProject/Packages | |
echo $'{\n "dependencies": {\n "com.lootlocker.lootlockersdk": "file:../../sdk"\n },\n "testables": ["com.lootlocker.lootlockersdk"]\n}' >> TestProject/Packages/manifest.json | |
mkdir TestProject/Assets/ | |
mkdir TestProject/Assets/Scenes | |
cp "sdk/Samples~/LootLockerExamples/1a - GuestLoginLootLockerIdentifier/1a - GuestLoginLootLockerIdentifier.unity" TestProject/Assets/Scenes/ | |
cp "sdk/Samples~/LootLockerExamples/1a - GuestLoginLootLockerIdentifier/GuestLoginLootLockerIdentifier.cs" TestProject/Assets/ | |
cp "sdk/Samples~/LootLockerExamples/LootLockerExamples.asmdef" TestProject/Assets/ | |
- name: LS TestProject & cat manifest | |
run: | | |
ls -als . | |
ls -als TestProject | |
ls -als TestProject/Packages | |
cat TestProject/Packages/manifest.json | |
ls -als TestProject/Assets | |
ls -als TestProject/Assets/Scenes | |
- name: POC run tests | |
uses: game-ci/unity-test-runner@v4 | |
id: tests | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
testMode: playmode | |
projectPath: TestProject/ | |
unityVersion: 2022.3.7f1 | |
githubToken: ${{ secrets.GITHUB_TOKEN }} |