From 1d04244b9370b457cb845814a6efbaedf5131a73 Mon Sep 17 00:00:00 2001 From: mob-sakai <12690315+mob-sakai@users.noreply.github.com> Date: Fri, 12 Jun 2026 16:34:29 +0900 Subject: [PATCH] chore: fix workflow for pwn request --- .github/workflows/release.yml | 28 +++++- .github/workflows/test.yml | 165 ++++++++++++++++++++-------------- 2 files changed, 122 insertions(+), 71 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6f1e18..9027da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,24 +1,44 @@ -name: release +name: ๐Ÿ”– Release +run-name: ๐Ÿ”– Release (${{ github.ref_name }}) on: + workflow_dispatch: push: branches: - preview - main - - "*.x" + - v*.x tags-ignore: - "**" jobs: release: + name: ๐Ÿ”– Release (${{ github.ref_name }}) runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + outputs: + channel: ${{ steps.release.outputs.new_release_channel }} + released: ${{ steps.release.outputs.new_release_published }} + tag: ${{ steps.release.outputs.new_release_git_tag }} steps: - - uses: actions/checkout@v3 + - name: ๐Ÿšš Checkout (${{ github.ref_name }}) + uses: actions/checkout@v6 - - uses: cycjimmy/semantic-release-action@v3 + - name: ๐Ÿ”– Run semantic release + uses: cycjimmy/semantic-release-action@v6 + id: release with: + working_directory: Packages/src extra_plugins: | @semantic-release/changelog @semantic-release/git env: GITHUB_TOKEN: ${{ github.token }} + + - run: | + echo "๐Ÿ”– New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY + echo "๐Ÿ”– New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY + echo "๐Ÿ”– New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6a18ca..9fa132e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,94 +1,125 @@ -# Secrets -# UNITY_LICENSE: -name: test +# 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 +run-name: ๐Ÿงช Test (${{ github.event.pull_request.title || github.ref_name }}) + +env: + # MINIMUM_VERSION: The minimum version of Unity. + MINIMUM_VERSION: 2020.3 + # EXCLUDE_FILTER: The excluded versions of Unity. + EXCLUDE_FILTER: "(2017|2018|2023.3)" + PROJECT_PATH: . 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: types: - opened + - reopened - synchronize + paths-ignore: + - "**.md" jobs: - unity-test: + 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: | + 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 ====" + LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch --ignore-alpha --min ${MINIMUM_VERSION}` + if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then + ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions --ignore-alpha --min ${MINIMUM_VERSION} --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: [ - "2018.3.14f1", - "2018.4.30f1", - "2019.1.14f1", - "2019.2.21f1", - "2019.3.15f1", - "2019.4.16f1", - "2020.1.17f1", - "2020.2.1f1", - ] - + unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }} steps: - # Checkout sandbox project - - uses: actions/checkout@v2 - with: - ref: sandbox - submodules: true - fetch-depth: 0 + - name: ๐Ÿšš Checkout ($${{ github.ref }}) + uses: actions/checkout@v6 - # Update package submodule - - name: "Update package submodule" - working-directory: Packages/dev - run: git checkout ${{ github.sha }} - - - uses: actions/cache@v2 + - name: ๐Ÿ“ฅ Cache library + uses: actions/cache@v5 with: - path: Library - key: Library-${{ matrix.unityVersion }}-${{ github.sha }} + path: ${{ env.PROJECT_PATH }}/Library + key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }} restore-keys: | - Library-${{ matrix.unityVersion }}- - Library- + ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}- + ${{ env.PROJECT_PATH }}-Library- - # Install codecoverage package - - name: "Install codecoverage package" - if: startsWith(matrix.unityVersion, '2019.4.') - run: | - npx openupm-cli add -f com.unity.testtools.codecoverage@0.4.0-preview - - # Run tests - - name: "Run tests" - uses: game-ci/unity-test-runner@main + - name: ๐Ÿ› ๏ธ Build Unity Project (Test) + uses: game-ci/unity-builder@v5 + timeout-minutes: 45 with: - unityVersion: ${{ matrix.unityVersion }} - customParameters: -nographics -enableCodeCoverage -coverageOptions assemblyFilters:+Coffee.UIParticle.*Tests + 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 }} - - uses: actions/upload-artifact@v2 - if: always() + - name: ๐Ÿงช Run tests + uses: game-ci/unity-test-runner@v4 + timeout-minutes: 45 with: - name: TestResults-${{ matrix.unityVersion }} - path: | - artifacts/*.xml - CodeCoverage/**/TestCoverageResults_*.xml - - publish: - needs: unity-test - runs-on: ubuntu-latest - if: always() - steps: - - - uses: actions/download-artifact@v2 - with: - path: artifacts - - - uses: testspace-com/setup-testspace@v1 - with: - domain: ${{github.repository_owner}} - - - name: Push test results - if: always() - run: | - testspace `find . -name '*.xml' | tr '\n' ' '` \ No newline at end of file + 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 }}