Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/release-please/release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"include-component-in-tag": false,
"include-v-in-tag": true,
"release-as": "1.5.5",
"pull-request-title-pattern": "chore${scope}: release${component} ${version} [release-please]",
"packages": {
".": {
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/build-sample-webgl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build Sample WebGL

on:
workflow_dispatch:
inputs:
sample:
description: Sample base name to build
required: true
type: choice
options:
- 2d-platformer

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-sample:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Cache Unity Library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ runner.os }}-2022.3.62f3-${{ hashFiles('Packages/com.playroomkit.sdk/package.json', 'Packages/manifest.json', 'Packages/packages-lock.json') }}
restore-keys: |
Library-${{ runner.os }}-2022.3.62f3-

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Resolve sample scene
run: |
case "${{ inputs.sample }}" in
2d-platformer)
echo "SAMPLE_SCENE=Packages/com.playroomkit.sdk/Samples~/2d-platformer/2d-platformer.unity" >> $GITHUB_ENV
echo "SAMPLE_SCENE_GUID=cf82eec4c654cf44b89cec2a91afebd5" >> $GITHUB_ENV
;;
*)
echo "Unknown sample: ${{ inputs.sample }}"
exit 1
;;
esac
echo "BUILD_OUTPUT=build/webgl/${{ inputs.sample }}" >> $GITHUB_ENV

- name: Set build scenes
run: |
cat > ProjectSettings/EditorBuildSettings.asset <<EOF
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: ${SAMPLE_SCENE}
guid: ${SAMPLE_SCENE_GUID}
m_configObjects: {}
EOF

- name: Build WebGL sample
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
unityVersion: 2022.3.62f3
targetPlatform: WebGL
allowDirtyBuild: true
buildsPath: ${{ env.BUILD_OUTPUT }}

- name: Upload WebGL build
uses: actions/upload-artifact@v4
with:
name: webgl-${{ inputs.sample }}
path: build/webgl/${{ inputs.sample }}

41 changes: 15 additions & 26 deletions .github/workflows/packaging.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
name: Create Unity Package on release tag
name: Attach UPM package to release

on:
push:
tags:
- v*
release:
types: [published]

jobs:
echo:
pack-upm:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- run: |
echo "Assets/PlayroomKit.meta" > metaList
echo "Assets/Plugins.meta" >> metaList
echo "Assets/WebGLTemplates.meta" >> metaList
find Assets/PlayroomKit/ -name \*.meta >> metaList
find Assets/WebGLTemplates/ -name \*.meta >> metaList
echo metaList

- run: mkdir output

- name: Set release version ENV
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- uses: pCYSl5EDgo/create-unitypackage@master
- uses: actions/setup-node@v4
with:
package-path: "output/playroomkit.unitypackage"
include-files: metaList
node-version: 20

- name: Pack UPM package
run: |
mkdir -p output
cd Packages/com.playroomkit.sdk
npm pack --pack-destination ../../output

- name: Release
- name: Upload UPM package to release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: output/playroomkit.unitypackage
files: output/*.tgz
6 changes: 1 addition & 5 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
config-file: .github/release-please/release-please-config.json
manifest-file: .github/release-please/release-please-manifest.json
35 changes: 0 additions & 35 deletions .github/workflows/testpackage.yaml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/testupm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build UPM Package Artifact

on:
push:
branches:
- main
paths:
- "Packages/com.playroomkit.sdk/**"
- "Tools/playroomkit-js/**"
pull_request:
paths:
- "Packages/com.playroomkit.sdk/**"
- "Tools/playroomkit-js/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pack-upm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Pack UPM package
run: |
mkdir -p output
cd Packages/com.playroomkit.sdk
npm pack --pack-destination ../../output

- uses: actions/upload-artifact@v4
with:
name: com.playroomkit.sdk.tgz
path: output/*.tgz
109 changes: 109 additions & 0 deletions .github/workflows/unity-tests-gate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Unity Tests Gate

on:
pull_request_target:
branches: [main]
types: [opened, reopened, synchronize, ready_for_review]
paths:
- "Packages/com.playroomkit.sdk/**/*.cs"
- "Packages/com.playroomkit.sdk/**/*.asmdef"
- "Packages/com.playroomkit.sdk/**/*.asmref"
- "Packages/com.playroomkit.sdk/**/*.unity"
- "Packages/com.playroomkit.sdk/package.json"

permissions:
contents: read
pull-requests: write
issues: write
checks: write

concurrency:
group: unity-tests-gate-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
mark-pending:
runs-on: ubuntu-latest
steps:
- name: Mark Unity tests as pending
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const owner = context.repo.owner;
const repo = context.repo.repo;
const sha = pr.head.sha;

const labelPending = "unity-test: pending";
const labelPassed = "unity-test: passed";
const labelFailed = "unity-test: failed";
const commentTag = "<!-- unity-tests-gate -->";
const gateCheckName = "Unity Tests Gate";
const body = [
commentTag,
"### Unity EditMode Tests",
"Not run automatically for PRs.",
"Trigger manually (members/collaborators):",
"`/run-unity-tests`",
].join("\n");

await github.rest.checks.create({
owner,
repo,
name: gateCheckName,
head_sha: sha,
status: "queued",
output: {
title: "Unity Tests Gate - Pending",
summary: "Manual Unity tests required.",
},
});

for (const label of [labelPassed, labelFailed]) {
try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number: pr.number,
name: label,
});
} catch (error) {
if (error.status !== 404) {
throw error;
}
}
}

await github.rest.issues.addLabels({
owner,
repo,
issue_number: pr.number,
labels: [labelPending],
});

const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: pr.number,
per_page: 100,
});

const existing = comments.find((comment) =>
comment.body && comment.body.includes(commentTag)
);

if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr.number,
body,
});
}
Loading