From eb7e73050418f796732c439b5cae1a6790630587 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:47:49 +0000 Subject: [PATCH 1/3] Initial plan From 77a86db88f06095a7b4dc107f9dd96ccadada7a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:50:19 +0000 Subject: [PATCH 2/3] Add GitHub Actions CI workflow for Unity project Co-authored-by: zhaozilong1988 <2689044+zhaozilong1988@users.noreply.github.com> --- .github/workflows/ci.yml | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fbeb57e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Cache Library + uses: actions/cache@v4 + with: + path: Library + key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library- + + - name: Run EditMode tests + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + with: + testMode: editmode + githubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Run PlayMode tests + uses: game-ci/unity-test-runner@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + with: + testMode: playmode + githubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: Test results + path: artifacts + + build: + name: Build for ${{ matrix.targetPlatform }} + runs-on: ubuntu-latest + needs: test + strategy: + fail-fast: false + matrix: + targetPlatform: + - StandaloneWindows64 + - StandaloneLinux64 + - StandaloneOSX + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Cache Library + uses: actions/cache@v4 + with: + path: Library + key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library-${{ matrix.targetPlatform }}- + Library- + + - name: Build project + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + with: + targetPlatform: ${{ matrix.targetPlatform }} + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: Build-${{ matrix.targetPlatform }} + path: build/${{ matrix.targetPlatform }} From a1ef2fd2feaa48f68d6ccdc686ab5ecdc529ed6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 05:51:56 +0000 Subject: [PATCH 3/3] Add explicit permissions to workflow for security Co-authored-by: zhaozilong1988 <2689044+zhaozilong1988@users.noreply.github.com> --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbeb57e..e57ba9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,9 @@ jobs: test: name: Run Tests runs-on: ubuntu-latest + permissions: + contents: read + checks: write steps: - name: Checkout repository uses: actions/checkout@v4 @@ -54,6 +57,8 @@ jobs: name: Build for ${{ matrix.targetPlatform }} runs-on: ubuntu-latest needs: test + permissions: + contents: read strategy: fail-fast: false matrix: