mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
156 lines
6.0 KiB
YAML
156 lines
6.0 KiB
YAML
# Required secrets
|
|
# UNITY_LICENSE: The contents of Unity license file
|
|
# UNITY_EMAIL: Unity user email to login
|
|
# UNITY_PASSWORD: Unity user password to login
|
|
name: 🧪 Test URP
|
|
run-name: 🧪 Test URP (${{ github.event.pull_request.title || github.ref_name }})
|
|
|
|
env:
|
|
# MINIMUM_VERSION: The minimum version of Unity.
|
|
MINIMUM_VERSION: 6000.0
|
|
MAXIMUM_VERSION:
|
|
# EXCLUDE_FILTER: The excluded versions of Unity.
|
|
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
|
IGNORE_ALPHA: false
|
|
IGNORE_BETA: false
|
|
PROJECT_PATH: UIEffectURP
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
unityVersions:
|
|
description: 'Specify the Unity versions to test. (eg. [ "2019.4.41f2", "2020.3.15f2" ])'
|
|
required: false
|
|
default: '[ "6000.0.0f1", "6000.1.0f1" ]'
|
|
usePeriodVersions:
|
|
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
|
required: false
|
|
default: "true"
|
|
overrideFindOptions:
|
|
description: 'Specify options for unity-changeset. (eg. --ignore-alpha --max 2020.3 )'
|
|
required: false
|
|
default: '--min 6000.0 --max 9999.9 --ignore-alpha --ignore-beta'
|
|
push:
|
|
branches:
|
|
- develop
|
|
- "develop-*"
|
|
tags:
|
|
- "!*"
|
|
paths-ignore:
|
|
- "**.md"
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
paths-ignore:
|
|
- "**.md"
|
|
|
|
jobs:
|
|
setup:
|
|
name: ⚙️ Setup
|
|
runs-on: ubuntu-latest
|
|
permissions: {} # No permissions needed for setup job
|
|
outputs:
|
|
unityVersions: ${{ steps.setup.outputs.unityVersions }}
|
|
steps:
|
|
- name: 🔑 Secrets check
|
|
run: |
|
|
echo "Checking secrets for ${{ github.actor }} ..."
|
|
if [ -z "$UNITY_EMAIL" ] || [ -z "$UNITY_PASSWORD" ] || [ -z "$UNITY_LICENSE" ]; then
|
|
echo "Error: UNITY_EMAIL, UNITY_PASSWORD, and UNITY_LICENSE secrets must be set." | tee -a $GITHUB_STEP_SUMMARY >&2
|
|
echo "Error: See https://game.ci/docs/github/test-runner#basic-setup" | tee -a $GITHUB_STEP_SUMMARY >&2
|
|
echo "Error: Set the secrets at ${{ github.server_url }}/${{ github.repository }}/settings/secrets/actions" | tee -a $GITHUB_STEP_SUMMARY >&2
|
|
exit 1
|
|
fi
|
|
env:
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
- name: ⚙️ Find target Unity versions
|
|
id: setup
|
|
run: |
|
|
echo "==== Target Unity Versions ===="
|
|
|
|
# Check if specific Unity versions are provided via inputs (for workflow_dispatch)
|
|
if [ -n "${{ inputs.unityVersions }}" ]; then
|
|
echo "* Using specified Unity versions" | tee $GITHUB_OUTPUT
|
|
echo 'unityVersions=${{ inputs.unityVersions }}' | tee $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
|
|
# Formulate find options based on inputs and environment variables
|
|
FIND_OPTIONS=""
|
|
[ "${{ env.IGNORE_ALPHA }}" = "true" ] && FIND_OPTIONS+=" --ignore-alpha"
|
|
[ "${{ env.IGNORE_BETA }}" = "true" ] && FIND_OPTIONS+=" --ignore-beta"
|
|
[ -n "${{ env.MINIMUM_VERSION }}" ] && FIND_OPTIONS+=" --min ${MINIMUM_VERSION}"
|
|
[ -n "${{ env.MAXIMUM_VERSION }}" ] && FIND_OPTIONS+=" --max ${MAXIMUM_VERSION}"
|
|
[ -n "${{ inputs.overrideFindOptions }}" ] && FIND_OPTIONS="${inputs.overrideFindOptions}"
|
|
echo "find options: $FIND_OPTIONS"
|
|
|
|
# Find the latest Unity versions if no specific versions are provided
|
|
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch $FIND_OPTIONS`
|
|
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
|
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions $FIND_OPTIONS --grep '0f'`
|
|
else
|
|
ADDITIONAL_VERSIONS=[]
|
|
fi
|
|
|
|
VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \
|
|
| jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'`
|
|
echo "unityVersions=${VERSIONS}" | tee $GITHUB_OUTPUT
|
|
|
|
test:
|
|
name: 🧪 Run tests
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
checks: write
|
|
contents: read
|
|
needs: setup
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 8
|
|
matrix:
|
|
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
|
steps:
|
|
- name: 🚚 Checkout ($${{ github.ref }})
|
|
uses: actions/checkout@v7
|
|
|
|
- name: 📥 Cache library
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: ${{ env.PROJECT_PATH }}/Library
|
|
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
|
restore-keys: |
|
|
${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-
|
|
${{ env.PROJECT_PATH }}-Library-
|
|
|
|
- name: 🛠️ Build Unity Project (Test)
|
|
uses: mob-sakai/unity-builder@fix/support-unity6.6
|
|
timeout-minutes: 45
|
|
with:
|
|
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
|
targetPlatform: StandaloneLinux64
|
|
allowDirtyBuild: true
|
|
customParameters: -nographics
|
|
projectPath: ${{ env.PROJECT_PATH }}
|
|
env:
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
|
|
# - name: 🧪 Run tests
|
|
# uses: mob-sakai/unity-test-runner@fix/support-unity6.6
|
|
# timeout-minutes: 45
|
|
# with:
|
|
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
|
# # unityVersion: ${{ matrix.unityVersion }}
|
|
# customParameters: -nographics
|
|
# checkName: ${{ matrix.unityVersion }} Test Results
|
|
# githubToken: ${{ github.token }}
|
|
# projectPath: ${{ env.PROJECT_PATH }}
|
|
# env:
|
|
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|