diff --git a/.github/workflows/branch-name.yml b/.github/workflows/branch-name.yml index 81a679a8..f613675d 100644 --- a/.github/workflows/branch-name.yml +++ b/.github/workflows/branch-name.yml @@ -1,15 +1,15 @@ ---- -name: 'Assert Branch Naming Convention' -on: pull_request +# --- +# name: 'Assert Branch Naming Convention' +# on: pull_request -jobs: - branch-naming-rules: - runs-on: ubuntu-latest - steps: - - uses: deepakputhraya/action-branch-name@master - with: - regex: '([a-z])+\/([a-z0-9.-])+' - allowed_prefixes: 'feat,fix,build,chore,ci,docs,style,refactor,perf,test,revert,release' - ignore: main - min_length: 5 - max_length: 50 +# jobs: +# branch-naming-rules: +# runs-on: ubuntu-latest +# steps: +# - uses: deepakputhraya/action-branch-name@master +# with: +# regex: '([a-z])+\/([a-z0-9.-])+' +# allowed_prefixes: 'feat,fix,build,chore,ci,docs,style,refactor,perf,test,revert,release' +# ignore: main +# min_length: 5 +# max_length: 50 diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index a7678ee9..4d77fe30 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,12 +1,12 @@ ---- -name: Lint Commit Messages -on: [pull_request] +# --- +# name: Lint Commit Messages +# on: [pull_request] -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 +# jobs: +# commitlint: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# - uses: wagoid/commitlint-github-action@v4 diff --git a/.github/workflows/diff.yml b/.github/workflows/diff.yml index 7f812586..bb23a42c 100644 --- a/.github/workflows/diff.yml +++ b/.github/workflows/diff.yml @@ -1,25 +1,25 @@ ---- -name: "Check LICENSE/README/CHANGELOG" -on: [pull_request] +# --- +# name: "Check LICENSE/README/CHANGELOG" +# on: [pull_request] -jobs: - diff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Check that the LICENSE files are the exact same - uses: LouisBrunner/diff-action@v2.0.0 - with: - old: LICENSE.md - new: src/Packages/Passport/LICENSE.md - mode: strict - tolerance: same - output: LICENSE-diff.txt - - name: Check that the CHANGELOG files are the exact same - uses: LouisBrunner/diff-action@v2.0.0 - with: - old: CHANGELOG.md - new: src/Packages/Passport/CHANGELOG.md - mode: strict - tolerance: same - output: changelog-diff.txt \ No newline at end of file +# jobs: +# diff: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v1 +# - name: Check that the LICENSE files are the exact same +# uses: LouisBrunner/diff-action@v2.0.0 +# with: +# old: LICENSE.md +# new: src/Packages/Passport/LICENSE.md +# mode: strict +# tolerance: same +# output: LICENSE-diff.txt +# - name: Check that the CHANGELOG files are the exact same +# uses: LouisBrunner/diff-action@v2.0.0 +# with: +# old: CHANGELOG.md +# new: src/Packages/Passport/CHANGELOG.md +# mode: strict +# tolerance: same +# output: changelog-diff.txt \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index f132b399..98748957 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,64 +1,64 @@ ---- -################################# -################################# -## Super Linter GitHub Actions ## -################################# -################################# -name: Lint Code Base +# --- +# ################################# +# ################################# +# ## Super Linter GitHub Actions ## +# ################################# +# ################################# +# name: Lint Code Base -############################# -# Start the job on all push # -############################# -on: - push: - branches-ignore: [main] - # Remove the line above to run when pushing to master - pull_request: - branches: [main] +# ############################# +# # Start the job on all push # +# ############################# +# on: +# push: +# branches-ignore: [main] +# # Remove the line above to run when pushing to master +# pull_request: +# branches: [main] -############### -# Set the Job # -############### -jobs: - build: - # Name the Job - name: Lint Code Base - # Set the agent to run on - runs-on: ubuntu-latest +# ############### +# # Set the Job # +# ############### +# jobs: +# build: +# # Name the Job +# name: Lint Code Base +# # Set the agent to run on +# runs-on: ubuntu-latest - ############################################ - # Grant status permission for MULTI_STATUS # - ############################################ - permissions: - contents: read - packages: read - statuses: write +# ############################################ +# # Grant status permission for MULTI_STATUS # +# ############################################ +# permissions: +# contents: read +# packages: read +# statuses: write - ################## - # Load all steps # - ################## - steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v3 - with: - # Full git history is needed to get a proper - # list of changed files within `super-linter` - fetch-depth: 0 +# ################## +# # Load all steps # +# ################## +# steps: +# ########################## +# # Checkout the code base # +# ########################## +# - name: Checkout Code +# uses: actions/checkout@v3 +# with: +# # Full git history is needed to get a proper +# # list of changed files within `super-linter` +# fetch-depth: 0 - ################################ - # Run Linter against code base # - ################################ - - name: Lint Code Base - uses: github/super-linter@v5 - env: - VALIDATE_ALL_CODEBASE: true - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*|.*src/Packages/Orderbook|.*src/Packages/ZkEvmApi/.*|.*sample|.*src/Packages/Passport/WebGLTemplates~|.*.github/workflows) - VALIDATE_MARKDOWN: false - VALIDATE_GITLEAKS: false - VALIDATE_JSCPD: false - VALIDATE_SHELL_SHFMT: false +# ################################ +# # Run Linter against code base # +# ################################ +# - name: Lint Code Base +# uses: github/super-linter@v5 +# env: +# VALIDATE_ALL_CODEBASE: true +# DEFAULT_BRANCH: main +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*|.*src/Packages/Orderbook|.*src/Packages/ZkEvmApi/.*|.*sample|.*src/Packages/Passport/WebGLTemplates~|.*.github/workflows) +# VALIDATE_MARKDOWN: false +# VALIDATE_GITLEAKS: false +# VALIDATE_JSCPD: false +# VALIDATE_SHELL_SHFMT: false diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index aefa89f5..3994bf93 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,92 +1,92 @@ ---- -name: Test & Build +# --- +# name: Test & Build -on: - push: - branches: [main] - pull_request: +# on: +# push: +# branches: [main] +# pull_request: -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +# concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true -jobs: - test: - if: github.event.pull_request.head.repo.fork == false - name: Test sample game 🧪 - runs-on: ubuntu-latest-8-cores +# jobs: +# test: +# if: github.event.pull_request.head.repo.fork == false +# name: Test sample game 🧪 +# runs-on: ubuntu-latest-8-cores - steps: - - uses: actions/checkout@v3 - with: - lfs: true - - run: git lfs pull +# steps: +# - uses: actions/checkout@v3 +# with: +# lfs: true +# - run: git lfs pull - - uses: game-ci/unity-test-runner@v4 - id: passportTest - env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - with: - unityVersion: 2021.3.26f1 - projectPath: './sample' - githubToken: ${{ secrets.GITHUB_TOKEN }} - testMode: 'EditMode' - - uses: actions/upload-artifact@v4 - if: always() - with: - name: Test results - path: ${{ steps.passportTest.outputs.artifactsPath }} +# - uses: game-ci/unity-test-runner@v4 +# id: passportTest +# env: +# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} +# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} +# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} +# with: +# unityVersion: 2021.3.26f1 +# projectPath: './sample' +# githubToken: ${{ secrets.GITHUB_TOKEN }} +# testMode: 'EditMode' +# - uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: Test results +# path: ${{ steps.passportTest.outputs.artifactsPath }} - - uses: actions/upload-artifact@v4 - if: always() - with: - name: Coverage results - path: ${{ steps.passportTest.outputs.coveragePath }} - build: - needs: test - name: Build for ${{ matrix.targetPlatform }} - runs-on: ubuntu-latest-8-cores - strategy: - fail-fast: false - matrix: - targetPlatform: - - iOS - - Android - - WebGL -# - StandaloneOSX - - StandaloneWindows64 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - - uses: actions/cache@v3 - with: - path: Library - key: - Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} - restore-keys: | - Library-${{ matrix.targetPlatform }} - Library- - - uses: game-ci/unity-builder@v4 - env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - with: - unityVersion: 2021.3.26f1 - targetPlatform: ${{ matrix.targetPlatform }} - projectPath: sample - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@4.1.3 - if: matrix.targetPlatform == 'WebGL' - with: - branch: gh-pages - folder: build/WebGL/WebGL - - uses: actions/upload-artifact@v4 - if: always() - with: - name: Build-${{ matrix.targetPlatform }} - path: build +# - uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: Coverage results +# path: ${{ steps.passportTest.outputs.coveragePath }} +# build: +# needs: test +# name: Build for ${{ matrix.targetPlatform }} +# runs-on: ubuntu-latest-8-cores +# strategy: +# fail-fast: false +# matrix: +# targetPlatform: +# - iOS +# - Android +# - WebGL +# # - StandaloneOSX +# - StandaloneWindows64 +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 +# lfs: true +# - uses: actions/cache@v3 +# with: +# path: Library +# key: +# Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} +# restore-keys: | +# Library-${{ matrix.targetPlatform }} +# Library- +# - uses: game-ci/unity-builder@v4 +# env: +# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} +# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} +# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} +# with: +# unityVersion: 2021.3.26f1 +# targetPlatform: ${{ matrix.targetPlatform }} +# projectPath: sample +# - name: Deploy to GitHub Pages +# uses: JamesIves/github-pages-deploy-action@4.1.3 +# if: matrix.targetPlatform == 'WebGL' +# with: +# branch: gh-pages +# folder: build/WebGL/WebGL +# - uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: Build-${{ matrix.targetPlatform }} +# path: build diff --git a/.github/workflows/ui-tests-2.yml b/.github/workflows/ui-tests-2.yml new file mode 100644 index 00000000..46508b2a --- /dev/null +++ b/.github/workflows/ui-tests-2.yml @@ -0,0 +1,137 @@ + + +# --- +# name: UI Tests 🧪 + +# on: +# push: +# branches: [main] +# pull_request: + +# concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true + +# jobs: +# build: +# name: Build ${{ matrix.targetPlatform }} for AltTester 🛠️ +# runs-on: ubuntu-latest-8-cores +# strategy: +# fail-fast: false +# matrix: +# include: +# - targetPlatform: StandaloneOSX +# buildMethod: MacBuilder.BuildForAltTester +# buildPath: sample/Builds/MacOS +# - targetPlatform: StandaloneWindows64 +# buildMethod: WindowsBuilder.BuildForAltTester +# buildPath: sample/Builds/Windows64 +# - targetPlatform: Android +# buildMethod: MobileBuilder.BuildForAltTester +# buildPath: sample/Builds/Android +# steps: +# - uses: actions/checkout@v3 +# with: +# lfs: true +# - uses: actions/cache@v3 +# with: +# path: Library +# key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }} +# restore-keys: | +# Library-${{ matrix.targetPlatform }} +# Library- +# - name: Build project +# uses: game-ci/unity-builder@v4 +# env: +# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} +# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} +# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} +# with: +# targetPlatform: ${{ matrix.targetPlatform }} +# projectPath: sample +# buildMethod: ${{ matrix.buildMethod }} +# customParameters: -logFile logFile.log -quit -batchmode +# - name: List build directory +# run: ls -R ./ +# - name: Upload artifact +# uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: Build-${{ matrix.targetPlatform }} +# path: ${{ matrix.buildPath }} +# test: +# name: Run ${{ matrix.targetPlatform }} UI tests 🧪 +# needs: build +# strategy: +# matrix: +# include: +# - targetPlatform: StandaloneOSX +# runs-on: [self-hosted, macOS] +# test_script: pytest -xs test/test_mac.py::MacTest +# - targetPlatform: StandaloneWindows64 +# runs-on: [self-hosted, windows] +# test_script: pytest -xs test/test_windows.py::WindowsTest +# - targetPlatform: Android +# runs-on: [ self-hosted, macOS ] +# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml" +# concurrency: +# group: test-${{ matrix.targetPlatform }} +# runs-on: ${{ matrix.runs-on }} +# steps: +# - uses: actions/checkout@v3 +# with: +# lfs: true +# - uses: actions/download-artifact@v4 +# with: +# name: Build-${{ matrix.targetPlatform }} +# path: sample/Tests +# - name: Make macOS artifact executable +# if: ${{ matrix.targetPlatform == 'StandaloneOSX' }} +# run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/* +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.10" +# - name: Install dependencies (Windows) +# if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} +# run: pip install -r "sample/Tests/requirements-desktop.txt" +# - name: Install dependencies (Mac) +# if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} +# run: | +# if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then +# pip uninstall -y browserstack-sdk || true +# pip install -r "sample/Tests/requirements-desktop.txt" +# else +# pip install -r "sample/Tests/requirements-mobile.txt" +# fi +# - name: Run UI tests +# env: +# UNITY_APP_PATH: SampleApp.app +# UNITY_APP_NAME: SampleApp +# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} +# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} +# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} +# working-directory: sample/Tests +# run: ${{ matrix.test_script }} +# test-ios: +# name: Run iOS UI tests 🧪 +# runs-on: [ self-hosted, macOS ] +# steps: +# - uses: actions/checkout@v3 +# with: +# lfs: true +# - name: Build iOS app +# working-directory: sample +# run: ./build_ios.sh +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.10" +# - name: Install dependencies +# run: pip install -r "sample/Tests/requirements-mobile.txt" +# - name: Run UI tests +# env: +# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} +# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} +# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} +# working-directory: sample/Tests +# run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml" + diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 7b2e63fe..841c520b 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -1,135 +1,139 @@ -# --- -# name: UI Tests 🧪 +--- +name: UI Tests 🧪 -# on: -# push: -# branches: [main] -# pull_request: +on: + workflow_dispatch: + push: + branches: [main] + pull_request: -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true -# jobs: -# build: -# name: Build ${{ matrix.targetPlatform }} for AltTester 🛠️ -# runs-on: ubuntu-latest-8-cores -# strategy: -# fail-fast: false -# matrix: -# include: -# - targetPlatform: StandaloneOSX -# buildMethod: MacBuilder.BuildForAltTester -# buildPath: sample/Builds/MacOS -# - targetPlatform: StandaloneWindows64 -# buildMethod: WindowsBuilder.BuildForAltTester -# buildPath: sample/Builds/Windows64 -# - targetPlatform: Android -# buildMethod: MobileBuilder.BuildForAltTester -# buildPath: sample/Builds/Android -# steps: -# - uses: actions/checkout@v3 -# with: -# lfs: true -# - uses: actions/cache@v3 -# with: -# path: Library -# key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }} -# restore-keys: | -# Library-${{ matrix.targetPlatform }} -# Library- -# - name: Build project -# uses: game-ci/unity-builder@v4 -# env: -# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} -# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} -# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} -# with: -# targetPlatform: ${{ matrix.targetPlatform }} -# projectPath: sample -# buildMethod: ${{ matrix.buildMethod }} -# customParameters: -logFile logFile.log -quit -batchmode -# - name: List build directory -# run: ls -R ./ -# - name: Upload artifact -# uses: actions/upload-artifact@v4 -# if: always() -# with: -# name: Build-${{ matrix.targetPlatform }} -# path: ${{ matrix.buildPath }} -# test: -# name: Run ${{ matrix.targetPlatform }} UI tests 🧪 -# needs: build -# strategy: -# matrix: -# include: -# - targetPlatform: StandaloneOSX -# runs-on: [self-hosted, macOS] -# test_script: pytest -xs test/test_mac.py::MacTest -# - targetPlatform: StandaloneWindows64 -# runs-on: [self-hosted, windows] -# test_script: pytest -xs test/test_windows.py::WindowsTest -# - targetPlatform: Android -# runs-on: [ self-hosted, macOS ] -# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml" -# concurrency: -# group: test-${{ matrix.targetPlatform }} -# runs-on: ${{ matrix.runs-on }} -# steps: -# - uses: actions/checkout@v3 -# with: -# lfs: true -# - uses: actions/download-artifact@v4 -# with: -# name: Build-${{ matrix.targetPlatform }} -# path: sample/Tests -# - name: Make macOS artifact executable -# if: ${{ matrix.targetPlatform == 'StandaloneOSX' }} -# run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/* -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.10" -# - name: Install dependencies (Windows) -# if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} -# run: pip install -r "sample/Tests/requirements-desktop.txt" -# - name: Install dependencies (Mac) -# if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} -# run: | -# if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then -# pip uninstall -y browserstack-sdk || true -# pip install -r "sample/Tests/requirements-desktop.txt" -# else -# pip install -r "sample/Tests/requirements-mobile.txt" -# fi -# - name: Run UI tests -# env: -# UNITY_APP_PATH: SampleApp.app -# UNITY_APP_NAME: SampleApp -# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} -# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} -# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} -# working-directory: sample/Tests -# run: ${{ matrix.test_script }} -# test-ios: -# name: Run iOS UI tests 🧪 -# runs-on: [ self-hosted, macOS ] -# steps: -# - uses: actions/checkout@v3 -# with: -# lfs: true -# - name: Build iOS app -# working-directory: sample -# run: ./build_ios.sh -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.10" -# - name: Install dependencies -# run: pip install -r "sample/Tests/requirements-mobile.txt" -# - name: Run UI tests -# env: -# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} -# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} -# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} -# working-directory: sample/Tests -# run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml" - +jobs: + build: + name: Build ${{ matrix.targetPlatform }} for AltTester 🛠️ + runs-on: ubuntu-latest-8-cores + strategy: + fail-fast: false + matrix: + include: + - targetPlatform: StandaloneOSX + buildMethod: MacBuilder.Build + buildPath: sample/Builds/MacOS + steps: + - uses: actions/checkout@v3 + with: + lfs: true + - uses: actions/cache@v3 + with: + path: Library + key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }} + restore-keys: | + Library-${{ matrix.targetPlatform }} + Library- + - name: Build project + uses: game-ci/unity-builder@v4 + env: + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + with: + targetPlatform: ${{ matrix.targetPlatform }} + projectPath: sample + buildMethod: ${{ matrix.buildMethod }} + customParameters: -logFile logFile.log -quit -batchmode + - name: List build directory + run: ls -R ./ + - name: Upload artifact + uses: actions/upload-artifact@v4 + if: always() + with: + name: Build-${{ matrix.targetPlatform }} + path: ${{ matrix.buildPath }} + test: + name: Run ${{ matrix.targetPlatform }} UI tests 🧪 + needs: build + strategy: + matrix: + include: + - targetPlatform: StandaloneOSX + test_script: pytest -xs test/test_mac_2.py::MacTest2 + concurrency: + group: test-${{ matrix.targetPlatform }} + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + lfs: true + - uses: actions/download-artifact@v4 + with: + name: Build-${{ matrix.targetPlatform }} + path: sample/Tests + - name: Make macOS artifact executable + if: ${{ matrix.targetPlatform == 'StandaloneOSX' }} + run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/* + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install ChromeDriver via Homebrew + run: brew install --cask chromedriver + - name: Verify ChromeDriver and Chrome + run: | + echo "ChromeDriver Version:" + chromedriver --version + echo "Chrome Version:" + "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version + - name: Create Custom Open Script + run: | + mkdir -p ~/custom-bin + echo '#!/bin/bash' > ~/custom-bin/open + echo 'if [[ "$1" =~ ^https?:// ]]; then' >> ~/custom-bin/open + echo ' "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "$@"' >> ~/custom-bin/open + echo 'else' >> ~/custom-bin/open + echo ' /usr/bin/open "$@"' >> ~/custom-bin/open + echo 'fi' >> ~/custom-bin/open + chmod +x ~/custom-bin/open + echo 'export PATH=~/custom-bin:$PATH' >> $GITHUB_ENV + - name: Install dependencies + run: pip install selenium + - name: Install dependencies (Mac) + if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} + run: | + if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then + pip uninstall -y browserstack-sdk || true + pip install -r "sample/Tests/requirements-desktop.txt" + else + pip install -r "sample/Tests/requirements-mobile.txt" + fi + - name: Open URL + env: + PATH: ~/custom-bin:$PATH + run: | + which open + echo "Testing custom open command with Chrome..." + open "https://www.google.com" + - name: Check if Chrome is running + run: | + if pgrep -x "Google Chrome" > /dev/null + then + echo "Chrome is running" + else + echo "Chrome is not running" + fi + - name: Check if Safari is running + run: | + if pgrep -x "Safari" > /dev/null + then + echo "Safari is running" + else + echo "Safari is not running" + fi + # - name: Run UI tests + # env: + # UNITY_APP_PATH: SampleApp.app + # UNITY_APP_NAME: SampleApp + # MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} + # working-directory: sample/Tests + # run: ${{ matrix.test_script }} \ No newline at end of file diff --git a/sample/Assets/Editor/MacBuilder.cs b/sample/Assets/Editor/MacBuilder.cs index 32553406..c0bfd687 100644 --- a/sample/Assets/Editor/MacBuilder.cs +++ b/sample/Assets/Editor/MacBuilder.cs @@ -65,15 +65,7 @@ private static BuildPlayerOptions CreateBuildPlayerOptions(string buildPath, Bui { scenes = new[] { - "Assets/Scenes/SelectAuthMethod.unity", - "Assets/Scenes/UnauthenticatedScene.unity", - "Assets/Scenes/AuthenticatedScene.unity", - "Assets/Scenes/ZkEvmGetBalance.unity", - "Assets/Scenes/ZkEvmGetTransactionReceipt.unity", - "Assets/Scenes/ZkEvmSendTransaction.unity", - "Assets/Scenes/ImxNftTransfer.unity", - "Assets/Scenes/ZkEVMSignTypedData.unity", - "Assets/Scenes/SetCallTimeout.unity" + "Assets/Scenes/TestScene.unity" }, locationPathName = buildPath, target = BuildTarget.StandaloneOSX, diff --git a/sample/Assets/Scenes/TestScene.unity b/sample/Assets/Scenes/TestScene.unity new file mode 100644 index 00000000..f3631822 --- /dev/null +++ b/sample/Assets/Scenes/TestScene.unity @@ -0,0 +1,253 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1213485435 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1213485437} + - component: {fileID: 1213485436} + m_Layer: 0 + m_Name: Script + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1213485436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1213485435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 96a11e9ccd3b47b08bf77f01f33e6a11, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1213485437 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1213485435} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1294360373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1294360376} + - component: {fileID: 1294360375} + - component: {fileID: 1294360374} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1294360374 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1294360373} + m_Enabled: 1 +--- !u!20 &1294360375 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1294360373} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1294360376 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1294360373} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/sample/Assets/Scenes/TestScene.unity.meta b/sample/Assets/Scenes/TestScene.unity.meta new file mode 100644 index 00000000..1371e2df --- /dev/null +++ b/sample/Assets/Scenes/TestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: df5ec59db513a458192fa246a9daec8c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/sample/Assets/Scripts/TestScript.cs b/sample/Assets/Scripts/TestScript.cs new file mode 100644 index 00000000..41bce24f --- /dev/null +++ b/sample/Assets/Scripts/TestScript.cs @@ -0,0 +1,33 @@ +using System; +using Immutable.Passport; +using Immutable.Passport.Core.Logging; +using UnityEngine; + +public class TestScript : MonoBehaviour +{ + void Start() + { + InitialisePassport(logoutRedirectUri: "https://www.immutable.com"); + } + + private async void InitialisePassport(string redirectUri = null, string logoutRedirectUri = null) + { + try + { + // Set the log level for the SDK + Passport.LogLevel = LogLevel.Info; + + // Initialise Passport + string environment = Immutable.Passport.Model.Environment.SANDBOX; + string clientId = "mp6rxfMDwwZDogcdgNrAaHnG0qMlXuMK"; + Passport passport = await Passport.Init(clientId, environment, redirectUri, logoutRedirectUri); + + // Navigate to the unauthenticated scene after initialising Passport + await passport.Login(); + } + catch (Exception ex) + { + Debug.LogException(ex, this); + } + } +} \ No newline at end of file diff --git a/sample/Assets/Scripts/TestScript.cs.meta b/sample/Assets/Scripts/TestScript.cs.meta new file mode 100644 index 00000000..3102fd8e --- /dev/null +++ b/sample/Assets/Scripts/TestScript.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 96a11e9ccd3b47b08bf77f01f33e6a11 +timeCreated: 1736405153 \ No newline at end of file diff --git a/sample/Tests/test/test_mac_2.py b/sample/Tests/test/test_mac_2.py new file mode 100644 index 00000000..5a9d28bf --- /dev/null +++ b/sample/Tests/test/test_mac_2.py @@ -0,0 +1,137 @@ +import sys +import time +import unittest +from pathlib import Path +import subprocess + +from selenium import webdriver +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.common.by import By as SeleniumBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.common.keys import Keys + +from test import TestConfig, UnityTest +from test_mac_helpers import open_sample_app, bring_sample_app_to_foreground, stop_sample_app + +sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'src')) +from fetch_otp import fetch_code + +class MacTest2(unittest.TestCase): + + seleniumdriver = None + + @classmethod + def login(cls): + print("Waiting for new window...") + WebDriverWait(cls.seleniumdriver, 30).until(EC.number_of_windows_to_be(2)) + + # Switch to the new window + all_windows = cls.seleniumdriver.window_handles + new_window = [window for window in all_windows if window != cls.seleniumdriver.current_window_handle][0] + cls.seleniumdriver.switch_to.window(new_window) + print("Switched to new window") + + # Wait for confirmation screen + continue_btn = WebDriverWait(cls.seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CLASS_NAME, '"Button--primary"'))) + continue_btn.click() + + # Wait for email input and enter email + email_field = WebDriverWait(cls.seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.ID, ':r1:'))) + print("Entering email...") + email_field.send_keys(TestConfig.EMAIL) + email_field.send_keys(Keys.RETURN) + + # Wait for OTP + print("Waiting for OTP...") + time.sleep(10) + print("Fetching OTP from MailSlurp...") + code = fetch_code() + + if not code: + cls.seleniumdriver.quit() + raise AssertionError("Failed to fetch OTP from MailSlurp") + + print(f"Successfully fetched OTP: {code}") + + # Find OTP input and enter the code + otp_field = WebDriverWait(cls.seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CSS_SELECTOR, 'input[data-testid="passwordless_passcode__TextInput--0__input"]'))) + print("Entering OTP...") + otp_field.send_keys(code) + + # Wait for success page and confirm + success = WebDriverWait(cls.seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CSS_SELECTOR, 'h1[data-testid="device_success_title"]'))) + print("Connected to Passport!") + + cls.seleniumdriver.quit() + + def test_case(self): + print("Connect to Chrome") + # chrome_options = Options() + # chrome_options.add_argument('--remote-debugging-port=9222') + + print("Initialise Chrome driver") + seleniumdriver = webdriver.Safari() #webdriver.Chrome(options=chrome_options) + seleniumdriver.switch_to.window(seleniumdriver.window_handles[-1]) + print(seleniumdriver.title) + # seleniumdriver.get('https://www.google.com') + + # print("Open a window on Chrome") + # seleniumdriver.current_window_handle + # print("Current window handles:", seleniumdriver.window_handles) + + # time.sleep(5) + + # Login + # print("Logging in...") + # open_sample_app() + + # time.sleep(10) + + # print("Waiting for new window...") + # print("Current URL:", seleniumdriver.current_url) + # time.sleep(10) + + # print("New URL:", seleniumdriver.current_url) + # print("Number of windows:", len(seleniumdriver.window_handles)) + # WebDriverWait(seleniumdriver, 30).until(EC.number_of_windows_to_be(2)) + + # # Switch to the new window + # all_windows = seleniumdriver.window_handles + # new_window = [window for window in all_windows if window != seleniumdriver.current_window_handle][0] + # seleniumdriver.switch_to.window(new_window) + # print("Switched to new window") + + # Wait for confirmation screen + continue_btn = WebDriverWait(seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CLASS_NAME, 'Button--primary'))) + continue_btn.click() + + # Wait for email input and enter email + email_field = WebDriverWait(seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.ID, ':r1:'))) + print("Entering email...") + email_field.send_keys(TestConfig.EMAIL) + email_field.send_keys(Keys.RETURN) + + # Wait for OTP + print("Waiting for OTP...") + time.sleep(10) + print("Fetching OTP from MailSlurp...") + code = fetch_code() + + if not code: + seleniumdriver.quit() + raise AssertionError("Failed to fetch OTP from MailSlurp") + + print(f"Successfully fetched OTP: {code}") + + # Find OTP input and enter the code + otp_field = WebDriverWait(seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CSS_SELECTOR, 'input[data-testid="passwordless_passcode__TextInput--0__input"]'))) + print("Entering OTP...") + otp_field.send_keys(code) + + # Wait for success page and confirm + success = WebDriverWait(seleniumdriver, 60).until(EC.presence_of_element_located((SeleniumBy.CSS_SELECTOR, 'h1[data-testid="device_success_title"]'))) + print("Connected to Passport!") + + seleniumdriver.quit() diff --git a/src/Packages/Marketplace/CHANGELOG.md.meta b/src/Packages/Marketplace/CHANGELOG.md.meta new file mode 100644 index 00000000..7fcd4795 --- /dev/null +++ b/src/Packages/Marketplace/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: af82d5225d9804276b038c20c2134221 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/Packages/Marketplace/LICENSE.md.meta b/src/Packages/Marketplace/LICENSE.md.meta new file mode 100644 index 00000000..4d25e1b9 --- /dev/null +++ b/src/Packages/Marketplace/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 57ae1a41ec4a844418d4d7bf0d229887 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/Packages/Marketplace/README.md.meta b/src/Packages/Marketplace/README.md.meta new file mode 100644 index 00000000..dead28e1 --- /dev/null +++ b/src/Packages/Marketplace/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dde9286aa4f64487fa8a8856852bb797 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: