diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 908a8e7..0b2bcfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Koji Hasegawa. +# Copyright (c) 2023-2024 Koji Hasegawa. # This software is released under the MIT License. name: Test @@ -18,6 +18,9 @@ on: - '.github/**' - '!.github/workflows/test.yml' +env: + PACKAGE_NAME: com.nowsprinting.test-helper + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -42,12 +45,6 @@ jobs: octocov: true steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: false - lfs: false - - name: Crete project for tests uses: nowsprinting/create-unity-project-action@v3 with: @@ -60,9 +57,14 @@ jobs: restore-keys: | Library- - - name: Set package name - run: | - echo "package_name=$(grep -o -E '"name": "(.+)"' ./package.json | cut -d ' ' -f2)" >> "$GITHUB_ENV" + - name: Checkout repository as embedded package + uses: actions/checkout@v4 + with: + submodules: false + lfs: false + path: ${{ env.CREATED_PROJECT_PATH }}/Packages/${{ env.PACKAGE_NAME }} + # In Linux editor, there is a problem that assets in local packages cannot be found with `AssetDatabase.FindAssets`. + # As a workaround, I have made it into an embedded package. - name: Install dependencies run: | @@ -99,7 +101,9 @@ jobs: id: test - name: Set coverage path for octocov - run: sed -i -r 's/UnityProject~\/Logs/${{ steps.test.outputs.coveragePath }}/' .octocov.yml + run: | + mv ${{ env.CREATED_PROJECT_PATH }}/Packages/${{ env.PACKAGE_NAME }}/.octocov.yml . + sed -i -r 's/UnityProject~\/Logs/${{ steps.test.outputs.coveragePath }}/' .octocov.yml if: ${{ matrix.octocov }} - name: Run octocov