diff --git a/.github/workflows/test-urp.yml b/.github/workflows/test-urp.yml new file mode 100644 index 0000000..6a7318f --- /dev/null +++ b/.github/workflows/test-urp.yml @@ -0,0 +1,126 @@ +# 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 + # EXCLUDE_FILTER: The excluded versions of Unity. + EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)" + PROJECT_PATH: UIEffectURP + +on: + workflow_dispatch: + inputs: + usePeriodVersions: + description: "Use the period versions (.0f1, .10f1, 20f1, ...)." + required: false + default: "true" + push: + branches: + - develop + - "develop-*" + tags: + - "!*" + paths-ignore: + - "**.md" + pull_request_target: + types: + - opened + - reopened + - synchronize + paths-ignore: + - "**.md" + +jobs: + setup: + name: โš™๏ธ Setup + runs-on: ubuntu-latest + outputs: + unityVersions: ${{ steps.setup.outputs.unityVersions }} + steps: + - name: โš™๏ธ Find target Unity versions + id: setup + run: | + echo "==== Target Unity Versions ====" + LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all` + if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then + ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json` + 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: 6 + matrix: + unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }} + steps: + - name: ๐Ÿšš Checkout ($${{ github.ref }}) + if: github.event_name == 'push' + uses: actions/checkout@v4 + + - name: ๐Ÿšš Checkout pull request (pull_request_target) + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: ๐Ÿšš Marge pull request (pull_request_target) + if: github.event_name == 'pull_request_target' + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git merge origin/${{ github.event.pull_request.base.ref }} --no-edit + + - name: ๐Ÿ“ฅ Cache library + uses: actions/cache@v4 + with: + path: Library + key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }} + restore-keys: | + Library-${{ matrix.unityVersion }}- + Library- + + - name: ๐Ÿ› ๏ธ Build Unity Project (Test) + uses: game-ci/unity-builder@v4 + 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: game-ci/unity-test-runner@v4 +# 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 }} +# env: +# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} +# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} +# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7bb1d87..478b01f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ env: MINIMUM_VERSION: 2020.3 # EXCLUDE_FILTER: The excluded versions of Unity. EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)" + PROJECT_PATH: . on: workflow_dispatch: @@ -104,6 +105,7 @@ jobs: targetPlatform: StandaloneLinux64 allowDirtyBuild: true customParameters: -nographics + projectPath: ${{ env.PROJECT_PATH }} env: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} @@ -118,6 +120,7 @@ jobs: 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 }}