chore(deps): Bump game-ci/unity-test-runner from 4.3.0 to 4.3.1 #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Builds + Test | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
- releasecandidate/* | |
pull_request: | |
branches: | |
- develop | |
- master | |
- releasecandidate/* | |
workflow_dispatch: | |
inputs: | |
createRelease: | |
description: 'Upload to GitHub Releases and itch.io?' | |
required: true | |
default: 'false' | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Get version number from ProjectSettings/ProjectSettings.asset -> PlayerSettings/bundleVersion | |
extractVersionNumber: | |
name: Extract project version number | |
runs-on: ubuntu-latest | |
outputs: | |
version_number: ${{ steps.extractVersionNumber_job.outputs.version_number }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Attempt extraction | |
id: extractVersionNumber_job | |
working-directory: unity-ggjj/ | |
run: | | |
version_number=$(grep 'bundleVersion: ' ./ProjectSettings/ProjectSettings.asset) | |
version_number=${version_number:17} | |
echo "Version number: $version_number" | |
echo "version_number=$version_number" >> $GITHUB_OUTPUT | |
# Unity build | |
checkLicense: | |
name: Check if UNITY_SERIAL is set in github secrets | |
runs-on: ubuntu-latest | |
outputs: | |
is_unity_serial_set: ${{ steps.checkLicense_job.outputs.is_unity_serial_set }} | |
steps: | |
- name: Check whether Unity activation requests should be done | |
id: checkLicense_job | |
run: | | |
echo "Skip activation job: ${{ secrets.UNITY_SERIAL != '' }}" | |
echo "is_unity_serial_set=${{ secrets.UNITY_SERIAL != '' }}" >> $GITHUB_OUTPUT | |
activation: | |
name: Request activation file 🔑 | |
needs: [checkLicense] | |
if: needs.checkLicense.outputs.is_unity_serial_set == 'false' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Request manual activation file | |
id: getManualLicenseFile | |
uses: game-ci/[email protected] | |
with: | |
unityVersion: 2022.3.4f1 | |
- name: Expose as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.getManualLicenseFile.outputs.filePath }} | |
path: ${{ steps.getManualLicenseFile.outputs.filePath }} | |
unityBuild: | |
name: Build for ${{ matrix.targetPlatform.outputName }} | |
needs: [extractVersionNumber, checkLicense] | |
if: needs.checkLicense.outputs.is_unity_serial_set == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: [ | |
{ unityPlatform: "StandaloneOSX", outputName: "macOS" }, | |
{ unityPlatform: "StandaloneWindows", outputName: "Windows-x86" }, | |
{ unityPlatform: "StandaloneWindows64", outputName: "Windows-x64" }, | |
{ unityPlatform: "StandaloneLinux64", outputName: "Linux-x64" }, | |
{ unityPlatform: "WebGL", outputName: "WebGL" } | |
] | |
uses: ./.github/workflows/build_game.yml | |
with: | |
unityPlatform: ${{ matrix.targetPlatform.unityPlatform }} | |
outputName: ${{ matrix.targetPlatform.outputName }} | |
secrets: inherit | |
# Unity tests | |
generateTestMatrix: | |
name: Generate Test Matrix | |
needs: [checkLicense] | |
runs-on: ubuntu-latest | |
if: needs.checkLicense.outputs.is_unity_serial_set == 'true' | |
outputs: | |
testDirectories: ${{ steps.bashScript.outputs.testDirectories }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run script file | |
id: bashScript | |
run: | | |
relativeTestSuites="$(echo unity-ggjj/Assets/Tests/EditModeTests/Suites/*/) $(echo unity-ggjj/Assets/Tests/PlayModeTests/Suites/*/)" | |
regex='^[^\/]+\/[^\/]+\/[^\/]+\/([^\/]+)Tests\/[^\/]+\/([^\/]+)' | |
for subDirectory in $relativeTestSuites | |
do | |
echo $subDirectory | |
if [[ $subDirectory =~ $regex ]] | |
then | |
output="\"${BASH_REMATCH[1]}\", \"${BASH_REMATCH[2]}\"|$output" | |
fi | |
echo $output | |
done | |
output=$(echo $output | sed 's/| *$//g') | |
echo $output | |
relativeTestSuitesAsJSON="[[$(sed 's:|:], [:g' <<< $output)]]" | |
echo $relativeTestSuitesAsJSON | |
relativeTestSuitesAsJSON="{\"directories\":$relativeTestSuitesAsJSON}" | |
echo "testDirectories=$relativeTestSuitesAsJSON" >> $GITHUB_OUTPUT | |
echo $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
shell: bash | |
runUnityTests: | |
name: "Execute sharded tests" | |
needs: [generateTestMatrix, checkLicense] | |
if: needs.checkLicense.outputs.is_unity_serial_set == 'true' | |
permissions: | |
checks: write # allows dependabot PRs to set pull request checks | |
contents: read | |
pull-requests: write | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.generateTestMatrix.outputs.testDirectories)}} | |
uses: ./.github/workflows/execute_tests.yml | |
with: | |
subdirectory: ${{ matrix.directories[0] }}Tests/Suites/${{ matrix.directories[1] }} | |
testMode: ${{ matrix.directories[0] }} | |
secrets: inherit | |
# Releases | |
checkIfTagExists: | |
name: Check if tag exists | |
needs: [extractVersionNumber] | |
if: (github.event.inputs.createRelease == 'true' || (github.ref == 'refs/heads/master' && github.event_name == 'push')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if tag exists | |
uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: ${{ needs.extractVersionNumber.outputs.version_number }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Fail if tag already exists | |
run: | | |
echo "Tag '${{ needs.extractVersionNumber.outputs.version_number }}' already exists: ${{ steps.checkTag.outputs.exists }}" | |
exit $([ "${{ steps.checkTag.outputs.exists }}" = 'true' ] && echo 1 || echo 0) | |
# GitHub Releases | |
createGitHubRelease: | |
name: Create GitHub Release | |
needs: [extractVersionNumber, checkIfTagExists, unityBuild] | |
if: (github.event.inputs.createRelease == 'true' || (github.ref == 'refs/heads/master' && github.event_name == 'push')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download macOS | |
uses: actions/download-artifact@v4 | |
with: | |
name: macOS-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/macOS-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Download Windows-x86 | |
uses: actions/download-artifact@v4 | |
with: | |
name: Windows-x86-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/Windows-x86-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Download Windows-x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: Windows-x64-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/Windows-x64-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Download Linux-x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: Linux-x64-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/Linux-x64-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Download WebGL | |
uses: actions/download-artifact@v4 | |
with: | |
name: WebGL-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/WebGL-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Zip macOS | |
run: zip -r "build/macOS-v${{ needs.extractVersionNumber.outputs.version_number }}.zip" "build/macOS-v${{ needs.extractVersionNumber.outputs.version_number }}" | |
- name: Zip Windows-x86 | |
run: zip -r "build/Windows-x86-v${{ needs.extractVersionNumber.outputs.version_number }}.zip" "build/Windows-x86-v${{ needs.extractVersionNumber.outputs.version_number }}" | |
- name: Zip Windows-x64 | |
run: zip -r "build/Windows-x64-v${{ needs.extractVersionNumber.outputs.version_number }}.zip" "build/Windows-x64-v${{ needs.extractVersionNumber.outputs.version_number }}" | |
- name: Zip Linux-x64 | |
run: zip -r "build/Linux-x64-v${{ needs.extractVersionNumber.outputs.version_number }}.zip" "build/Linux-x64-v${{ needs.extractVersionNumber.outputs.version_number }}" | |
- name: Zip WebGL | |
run: zip -r "build/WebGL-v${{ needs.extractVersionNumber.outputs.version_number }}.zip" "build/WebGL-v${{ needs.extractVersionNumber.outputs.version_number }}" | |
- name: Create GitHub Release | |
uses: ncipollo/[email protected] | |
with: | |
# glob-files need to be escaped | |
artifacts: | | |
build/macOS-v${{ needs.extractVersionNumber.outputs.version_number }}.zip, | |
build/Windows-x86-v${{ needs.extractVersionNumber.outputs.version_number }}.zip, | |
build/Windows-x64-v${{ needs.extractVersionNumber.outputs.version_number }}.zip, | |
build/Linux-x64-v${{ needs.extractVersionNumber.outputs.version_number }}.zip, | |
build/WebGL-v${{ needs.extractVersionNumber.outputs.version_number }}.zip | |
artifactErrorsFailBuild: true | |
tag: ${{ needs.extractVersionNumber.outputs.version_number }} | |
name: "Release #${{ needs.extractVersionNumber.outputs.version_number }}" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# itch.io uploader | |
checkItchIO: | |
name: Check if ITCHIO_APIKEY is set in github secrets | |
runs-on: ubuntu-latest | |
outputs: | |
is_ITCHIO_set: ${{ steps.checkItchIO_job.outputs.is_ITCHIO_set }} | |
steps: | |
- name: Check whether an itch.io build should be pushed | |
id: checkItchIO_job | |
run: | | |
echo "Push itch.io build: ${{ secrets.ITCHIO_APIKEY != '' && secrets.ITCHIO_USERNAME != '' && secrets.ITCHIO_PROJECTNAME != '' }}" | |
echo "is_ITCHIO_set=${{ secrets.ITCHIO_APIKEY != '' && secrets.ITCHIO_USERNAME != '' && secrets.ITCHIO_PROJECTNAME != '' }}" >> $GITHUB_OUTPUT | |
createItchIORelease: | |
name: Create/update itch.io for ${{ matrix.platforms.outputName }} | |
needs: [extractVersionNumber, checkIfTagExists, unityBuild, checkItchIO] | |
if: (github.event.inputs.createRelease == 'true' || (github.ref == 'refs/heads/master' && github.event_name == 'push')) && needs.checkItchIO.outputs.is_ITCHIO_set == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platforms: [ | |
{ outputName: "macOS", itchIOChannel: "mac" }, | |
{ outputName: "Windows-x86", itchIOChannel: "windows-x86" }, | |
{ outputName: "Windows-x64", itchIOChannel: "windows-x64" }, | |
{ outputName: "Linux-x64", itchIOChannel: "linux" }, | |
{ outputName: "WebGL", itchIOChannel: "webGL" } | |
] | |
steps: | |
- name: Download ${{ matrix.platforms.outputName }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.platforms.outputName }}-v${{ needs.extractVersionNumber.outputs.version_number }} | |
path: build/${{ matrix.platforms.outputName }}-v${{ needs.extractVersionNumber.outputs.version_number }} | |
- name: Create itch.io '${{ matrix.platforms.itchIOChannel }}' Release | |
uses: josephbmanley/butler-publish-itchio-action@master | |
env: | |
BUTLER_CREDENTIALS: ${{ secrets.ITCHIO_APIKEY }} | |
CHANNEL: ${{ matrix.platforms.itchIOChannel }} | |
ITCH_GAME: ${{ secrets.ITCHIO_PROJECTNAME }} | |
ITCH_USER: ${{ secrets.ITCHIO_USERNAME }} | |
PACKAGE: build/${{ matrix.platforms.outputName }}-v${{ needs.extractVersionNumber.outputs.version_number }} | |
VERSION: ${{ needs.extractVersionNumber.outputs.version_number }} |