Create an empty Unity3D project for running tests. It is useful for testing UPM package.
This action does not require a Unity license. Because this copies the Unity 2018.1.0f1 1 project template.
Path of the Unity project to be created, relative from repository root (/github/workspace).
Default value is UnityProject~
.
Path of the created Unity project, relative from repository root (/github/workspace).
Same as project-path
.
Path of the created Unity project, relative from repository root (/github/workspace).
Same as project-path
.
This example assumes that package.json is in the repository root, creation a new Unity project and runs the tests.
on:
push:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Crete Unity project for tests
uses: nowsprinting/create-unity-project-action@v2
with:
project-path: UnityProject~
- name: Install dependencies
run: |
npm install -g openupm-cli
openupm add -f com.unity.test-framework@1.3.2
openupm add -f com.unity.testtools.codecoverage@1.2.2
openupm add -ft your.package.name@file:../../
working-directory: ${{ env.CREATED_PROJECT_PATH }}
- name: Move samples to include in run tests (optional)
run: |
cp -r Samples~/SampleFolder1 ${{ env.CREATED_PROJECT_PATH }}/Assets/
- name: Run tests
uses: game-ci/unity-test-runner@v2
with:
projectPath: ${{ env.CREATED_PROJECT_PATH }}
unityVersion: 2021.3.17f1
Note
openupm command is used to update Packages/manifest.json.@file:../../
is relative path from Packages directory to repository root (as a package root). And-t
option is add package intotestables
.
Before
<root>
├── Editor/
├── Runtime/
├── Tests/
├── LICENSE.md
├── README.md
└── package.json
After
<root>
├── Editor/
├── Runtime/
├── Tests/
├── UnityProject~/
│ ├── Assets/
│ ├── Library/
│ ├── Logs/
│ ├── Packages/
│ ├── ProjectSettings/
│ └── UnityProject~.sln
├── LICENSE.md
├── README.md
└── package.json
Note
Unity ignores the contents of any folder name that ends with the ~ character and does not track them with .meta files.
See more information: Unity - Manual: Package layout
MIT License
Open an issue or create a pull request.
npm install
npm test
npm run all
git add dist/
git commit -m"Update dist"
Be grateful if you could label the PR as enhancement
, bug
, chore
and documentation
. See PR Labeler settings for automatically labeling from the branch name.
Run Actions | Create release pull request | Run workflow
and merge created PR.
(Or bump version in package.json on default branch)
Then, Will do the release process automatically by Release workflow.
Enable Publish this Action to the GitHub Marketplace
on edit release page, are publish to GitHub Marketplace.
(Need manual operation)
Do NOT manually operation the following operations:
- Create release tag
- Publish draft releases
Footnotes
-
This version started UPM support ↩