Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Build workflow #7

Merged
merged 7 commits into from
Apr 26, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: BuildTest
on:
pull_request:
workflow_dispatch:
inputs:
clean:
type: boolean
default: false
description: "clean"

env:
CLEAN: ${{ github.event.inputs.clean || false }}

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

jobs:
android:
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Get Unity version
run: |
echo "UNITY_VERSION=$(grep "m_EditorVersion:" < ProjectSettings/ProjectVersion.txt | cut -d" " -f2)" >> "${GITHUB_ENV}"
- name: Android Build
env:
ANDROID_NDK_ROOT: "/Applications/Unity/Hub/Editor/${UNITY_VERSION}/PlaybackEngines/AndroidPlayer/NDK"
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildAndroid

ios:
runs-on: [self-hosted, macOS]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Get Unity version
run: |
echo "UNITY_VERSION=$(grep "m_EditorVersion:" < ProjectSettings/ProjectVersion.txt | cut -d" " -f2)" >> "${GITHUB_ENV}"
- name: iOS Build
env:
ANDROID_NDK_ROOT: "/Applications/Unity/Hub/Editor/${UNITY_VERSION}/PlaybackEngines/AndroidPlayer/NDK"
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildIOS \
39 changes: 0 additions & 39 deletions .github/workflows/build.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/.idea.UnityBuildReportAction/.idea/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/.idea.UnityBuildReportAction/.idea/encodings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/.idea.UnityBuildReportAction/.idea/indexLayout.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/.idea.UnityBuildReportAction/.idea/vcs.xml

This file was deleted.

8 changes: 8 additions & 0 deletions Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions Assets/Editor/BuildEntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UnityEditor;

namespace Editor
{
// ReSharper disable once UnusedMember.Global
public sealed class BuildEntryPoint
{
// ReSharper disable once UnusedMember.Global
public static void BuildAndroid()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/SampleScene.unity" },
locationPathName = "Outputs/Android/app.apk",
target = BuildTarget.Android,
options = BuildOptions.Development,
};

BuildPipeline.BuildPlayer(buildPlayerOptions);
}

// ReSharper disable once UnusedMember.Global
public static void BuildIOS()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/SampleScene.unity" },
locationPathName = "Outputs/IOS/",
target = BuildTarget.iOS,
options = BuildOptions.Development,
};

BuildPipeline.BuildPlayer(buildPlayerOptions);
}
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/BuildEntryPoint.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using UnityEditor.Build.Reporting;
using UnityEngine;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal sealed class BuildReportRepository : IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

using UnityEditor;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
[InitializeOnLoad]
internal sealed class EditorQuitEntryPoint
{
internal static bool ExecutesUnityBuild;
private static readonly string s_gitHubStepSummaryPath;

// The 'report' argument passed to IPostprocessBuildWithReport.OnPostprocessBuild() contains incorrect information, so read Library/LastBuild.buildreport instead.
// The 'report' argument passed to IPolsstprocessBuildWithReport.OnPostprocessBuild() contains incorrect information, so read Library/LastBuild.buildreport instead.
// see: https://issuetracker.unity3d.com/issues/buildreport-report-in-ipostprocessbuildwithreport-provides-incorrect-information
static EditorQuitEntryPoint()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using UnityEngine;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal sealed class EnvironmentVariableRepository
{
Expand All @@ -15,20 +15,17 @@ internal sealed class EnvironmentVariableRepository

internal static string GetGitHubStepSummaryPath()
{
Debug.Log($"{GitHubStepSummary}: {Environment.GetEnvironmentVariable(GitHubStepSummary)}");
return Environment.GetEnvironmentVariable(GitHubStepSummary);
}

internal static bool IsGitHubActions()
{
Debug.Log($"{GitHubActions}: {Environment.GetEnvironmentVariable(GitHubActions)}");
return Environment.GetEnvironmentVariable(GitHubActions) == True;
}

internal static bool IsDisabled()
{
var envVar = Environment.GetEnvironmentVariable(GhaUnityBuildReporterOptOut);
Debug.Log($"{GhaUnityBuildReporterOptOut}: {envVar}");
return envVar?.ToLower() is True or "1";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.IO;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal sealed class GitHubJobSummaryRepository : IJobSummaryRepository
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2020-2024 VeyronSakai.
// This software is released under the MIT License.

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal interface IJobSummaryRepository
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEditor.Build;
using UnityEditor.Build.Reporting;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal sealed class Preprocessor : IPreprocessBuildWithReport
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using UnityEditor.Build.Reporting;
using UnityEngine;

namespace UnityBuildReportAction.Editor
namespace GhaUnityBuildReporter.Editor
{
internal sealed class ReportUnityBuildUseCase
{
Expand Down
2 changes: 1 addition & 1 deletion Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.6",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.9.2",
"com.unity.visualscripting": "1.9.4",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
}
},
"com.unity.visualscripting": {
"version": "1.9.2",
"version": "1.9.4",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2022.3.25f1
m_EditorVersionWithRevision: 2022.3.25f1 (530ae0ba3889)
m_EditorVersion: 2022.3.26f1
m_EditorVersionWithRevision: 2022.3.26f1 (ec6cd8118806)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# UnityBuildReportAction
# GhaUnityBuildReporter
Loading