-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update ReadMe.md and add workflow dispatch #14
Changes from all commits
5291868
50a3b40
916f5c6
75deb2d
3685430
1dff165
5b853f4
d83d8cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,35 +3,36 @@ name: Unity Actions | |
on: | ||
pull_request: {} | ||
push: {} | ||
workflow_dispatch: {} | ||
|
||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
PROJECT_PATH: . | ||
|
||
### Refer to https://game.ci/docs/github/getting-started | ||
jobs: | ||
checklicense: | ||
name: check if UNITY_LICENSE is set in github secrets | ||
name: Check for UNITY_LICENSE in GitHub Secrets | ||
runs-on: ubuntu-latest | ||
outputs: | ||
is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }} | ||
steps: | ||
- name: Check whether unity activation requests should be done | ||
id: checklicense_job | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
run: | | ||
echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}" | ||
echo "::set-output name=is_unity_license_set::${{ env.UNITY_LICENSE != '' }}" | ||
export is_unity_license_set="${{ env.UNITY_LICENSE != '' }}" | ||
echo "is_unity_license_set=$is_unity_license_set" >> $GITHUB_OUTPUT | ||
|
||
activation: | ||
needs: [checklicense] | ||
if: needs.checklicense.outputs.is_unity_license_set == 'false' | ||
name: Request activation file 🔑 | ||
name: Request manual activation file 🔑 | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Request manual activation file | ||
- name: Request manual activation file | ||
id: getManualLicenseFile | ||
# https://github.com/game-ci/unity-request-activation-file/releases/ | ||
uses: game-ci/unity-request-activation-file@v2 | ||
# Upload artifact (Unity_v20XX.X.XXXX.alf) | ||
- name: Expose as artifact | ||
|
@@ -43,7 +44,7 @@ jobs: | |
test: | ||
needs: [checklicense] | ||
if: needs.checklicense.outputs.is_unity_license_set == 'true' | ||
name: Test all modes ✨ | ||
name: Run all tests ✨ | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -52,25 +53,22 @@ jobs: | |
- uses: actions/cache@v3 | ||
with: | ||
path: Library | ||
key: Library-test-project-${{ matrix.targetPlatform }} | ||
restore-keys: | | ||
Library-test-project- | ||
Library- | ||
# https://github.com/game-ci/unity-test-runner/releases/ | ||
key: Library-test | ||
- uses: game-ci/unity-test-runner@v2 | ||
id: testRunner | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
projectPath: ${{ env.PROJECT_PATH }} | ||
testMode: all | ||
customParameters: "-nographics" | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Test results (all modes) | ||
path: ${{ steps.testRunner.outputs.artifactsPath }} | ||
|
||
build: | ||
needs: [checklicense] | ||
if: needs.checklicense.outputs.is_unity_license_set == 'true' | ||
needs: [test] | ||
name: Build for ${{ matrix.targetPlatform }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
|
@@ -87,24 +85,22 @@ jobs: | |
lfs: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ matrix.projectPath }}/Library | ||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} | ||
restore-keys: | | ||
Library-${{ matrix.projectPath }}- | ||
Library- | ||
# https://github.com/game-ci/unity-builder/releases/ | ||
path: Library | ||
key: Library-${{ matrix.targetPlatform }} | ||
- uses: game-ci/unity-builder@v2 | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
projectPath: ${{ env.PROJECT_PATH }} | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Build-${{ matrix.targetPlatform }} | ||
path: build | ||
|
||
buildWithMac: | ||
needs: [checklicense] | ||
if: needs.checklicense.outputs.is_unity_license_set == 'true' | ||
needs: [build] | ||
name: Build for ${{ matrix.targetPlatform }} | ||
runs-on: macos-latest | ||
strategy: | ||
|
@@ -113,30 +109,56 @@ jobs: | |
targetPlatform: | ||
- StandaloneOSX | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ matrix.projectPath }}/Library | ||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} | ||
restore-keys: | | ||
Library-${{ matrix.projectPath }}- | ||
Library- | ||
path: Library | ||
key: Library-${{ matrix.targetPlatform }} | ||
- uses: game-ci/unity-builder@v2 | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
projectPath: ${{ env.PROJECT_PATH }} | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
- name: Upload Build | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Build-${{ matrix.targetPlatform }} | ||
path: build | ||
|
||
buildWithWindows: | ||
needs: [build, buildWithMac] | ||
if: needs.checklicense.outputs.is_unity_license_set == 'true' | ||
needs: build | ||
name: Build for ${{ matrix.targetPlatform }} | ||
runs-on: windows-2019 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
targetPlatform: | ||
- WSAPlayer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is WSA player getting a separate workflow from the rest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because of the runs-on? I'm not sure but I think that's the reason. edit: I scrolled a bit more and now I don't see why either 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember running into the license limitations with my paid license, when I would try running StandaloneWindows, StandaloneWindows64, and WSAPlayer in parallel. |
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: Library | ||
key: Library-${{ matrix.targetPlatform }} | ||
- uses: game-ci/unity-builder@v2 | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Build-${{ matrix.targetPlatform }} | ||
path: build | ||
|
||
buildWithWindows2: | ||
needs: buildWithWindows | ||
name: Build for ${{ matrix.targetPlatform }} | ||
runs-on: windows-2019 | ||
strategy: | ||
|
@@ -145,25 +167,22 @@ jobs: | |
targetPlatform: | ||
- StandaloneWindows | ||
- StandaloneWindows64 | ||
- WSAPlayer | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ matrix.projectPath }}/Library | ||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} | ||
restore-keys: | | ||
Library-${{ matrix.projectPath }}- | ||
Library- | ||
path: Library | ||
key: Library-${{ matrix.targetPlatform }} | ||
- uses: game-ci/unity-builder@v2 | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
projectPath: ${{ env.PROJECT_PATH }} | ||
targetPlatform: ${{ matrix.targetPlatform }} | ||
- name: Upload Build | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Build-${{ matrix.targetPlatform }} | ||
path: build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a job that we recommend? It feels like something you check once on setup rather than incur the cost for every CI run. It also doesn't capture the other complexities like using a serial number or licensing server instead of a license file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I don't think we should recommend that they run this job every time.
On the game.ci docs website, we have activation as a separate workflow.
I think the goal for this repo is just to provide a very concise example, where a user could just clone the repo and quickly get a basic understanding of how to use the unity actions.