Skip to content

Commit

Permalink
fix: Action did not work on Windows runners. (#257)
Browse files Browse the repository at this point in the history
* Remove symlink files

* Update entrypoint scripts for windows runner

* Add windows runner tests

* Fix unity editor path

* Set -nographics option for avoid d3d11 initialization error

* Fix Unity project path in windows standalone build script
  • Loading branch information
sokuhatiku committed Mar 21, 2024
1 parent 35b5a08 commit 75d0d76
Show file tree
Hide file tree
Showing 7 changed files with 1,448 additions and 1,483 deletions.
74 changes: 46 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ jobs:
# - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; }

testAllModesLikeInTheReadme:
name: Test in ${{ matrix.testMode }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
name: Test in ${{ matrix.testMode }} of version ${{ matrix.unityVersion }} on ${{ matrix.baseRunner }}
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
projectPath:
- unity-project-with-correct-tests
unityVersion:
Expand All @@ -57,9 +61,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-
Library-${{ matrix.baseRunner }}
- uses: ./
id: tests
with:
Expand All @@ -76,10 +80,13 @@ jobs:

testRunnerInAllModes:
name: Test all modes ✨
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
projectPath:
- unity-project-with-correct-tests
unityVersion:
Expand All @@ -100,10 +107,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}
# Configure test runner
- name: Run tests
Expand Down Expand Up @@ -134,10 +140,13 @@ jobs:

testRunnerInEditMode:
name: Test edit mode πŸ“
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
unityVersion:
- 2022.3.13f1
- 2023.1.19f1
Expand All @@ -161,10 +170,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}
# Configure test runner
- name: Run tests
Expand Down Expand Up @@ -195,10 +203,13 @@ jobs:

testRunnerInPlayMode:
name: Test play mode πŸ“Ί
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
projectPath:
- unity-project-with-correct-tests
unityVersion:
Expand All @@ -219,10 +230,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}
# Configure test runner
- name: Run tests
Expand Down Expand Up @@ -252,10 +262,13 @@ jobs:

testRunnerInStandalone:
name: Test standalone πŸ“Ί
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
projectPath:
- unity-project-with-correct-tests
unityVersion:
Expand All @@ -276,10 +289,10 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}-
Library-${{ matrix.baseRunner }}-
# Configure test runner
- name: Run tests
Expand All @@ -301,10 +314,13 @@ jobs:

testRunnerInStandaloneWithIL2CPP:
name: Test standalone with IL2CPP πŸ“Ί
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
projectPath:
- unity-project-with-correct-tests
unityVersion:
Expand All @@ -325,17 +341,17 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}-
# Set scripting backend to IL2CPP
- name: Rewrite ProjectSettings
run: |
DefineOriginal=" scriptingBackend: {}"
DefineReplace=" scriptingBackend: \\n Standalone: 1"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
shell: bash

# Configure test runner
- name: Run tests
Expand All @@ -357,10 +373,13 @@ jobs:

testEachModeSequentially:
name: Test each mode sequentially πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦ # don't try this at home (it's much slower)
runs-on: ubuntu-latest
runs-on: ${{ matrix.baseRunner }}
strategy:
fail-fast: false
matrix:
baseRunner:
- ubuntu-latest
- windows-latest
unityVersion:
- 2022.3.13f1
- 2023.1.19f1
Expand All @@ -381,10 +400,9 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
Library-${{ matrix.baseRunner }}-
# Configure first test runner
- name: Tests in editmode πŸ“
Expand Down
Loading

0 comments on commit 75d0d76

Please sign in to comment.