Skip to content

Commit

Permalink
GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiankidd committed May 4, 2023
1 parent 402a091 commit da778bc
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 5,156 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@ jobs:

build:
name: Building for ${{ matrix.name }} 🛠️
runs-on: windows-2019
needs: acquire_ulf
runs-on: ubuntu-latest
needs: [
acquire_ulf,
prepare_release
]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -197,7 +200,9 @@ jobs:
with:
unityVersion: ${{ env.UNITY_MAJOR_VERSION }}.${{ env.UNITY_MINOR_VERSION }}.${{ env.UNITY_PATCH_VERSION }}
targetPlatform: ${{ matrix.targetPlatform }}
projectPath: src
buildsPath: Build
buildMethod: UnityBuilderAction.Builder.BuildProject
allowDirtyBuild: true

- name: 🗜️ Compress Release
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ crashlytics-build.properties
# !/src/[Aa]ssets/PikePush
# !/src/[Aa]ssets/PikePush/**
# !/src/[Aa]ssets/Editor
# !/src/[Aa]ssets/Editor/**
# !/src/[Aa]ssets/Editor/**
/stdout.log
35 changes: 29 additions & 6 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,42 @@
##### _A Dumb Lil Runner Game_

## About
This is basically just a ten minute runner game written in Unity, but with some niche flavouring
This is basically just a ten minute runner game written in Unity, but with some niche flavouring 🌶️

## Features
- customize flag!
- customize colors!
- run!

## Access
PikePush is deployed to GitHub Pages
### Links
<p align="center">
<a href="https://andrewiankidd.github.io/PikePush/">
<img src="https://img.shields.io/badge/%E2%9A%94%EF%B8%8F%20PikePush-cadetblue.svg" height="50" />
<img src="https://img.shields.io/badge/%E2%9A%94%EF%B8%8F%20PikePush-lightblue.svg" height="50" />
</a>

![Screenshot](./assets/screencap.gif "Screenshot")
<br>
<strong>Play:</strong><br>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/WebGL-release.zip">
<img src="https://img.shields.io/badge/%f0%9f%8c%90%20Browser-cadetblue.svg" />
</a>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/Linux-release.zip">
<img src="https://img.shields.io/badge/Linux-cadetblue.svg?logo=linux" />
</a>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/StandaloneWindows64-release.zip">
<img src="https://img.shields.io/badge/Windows-cadetblue.svg?logo=windows" />
</a>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/StandaloneOSX-release.zip">
<img src="https://img.shields.io/badge/MacOS-cadetblue.svg?logo=macos" />
</a>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/Android-release.zip">
<img src="https://img.shields.io/badge/Android-cadetblue.svg?logo=android" />
</a>
<a href="https://github.com/andrewiankidd/PikePush/releases/latest/download/iOS-release.zip">
<img src="https://img.shields.io/badge/iOS-cadetblue.svg?logo=ios" />
</a>
<br>
<strong>Source Code:</strong><br>
<a href="https://github.com/andrewiankidd/PikePush">
<img src="https://img.shields.io/badge/GitHub-cadetblue.svg?logo=gitHub" />
</a>
<img src="./assets/screencap.gif">
</p>
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.Build.Reporting;

namespace UnityBuilderAction
{
public static class Builder
public class Builder
{
private static readonly string Eol = Environment.NewLine;

Expand All @@ -16,6 +15,7 @@ public static class Builder

public static void BuildProject()
{
ConsoleBlock("BuildProject!", new Dictionary<string, string>(){});
// Gather values from args
Dictionary<string, string> options = GetValidatedOptions();

Expand Down Expand Up @@ -85,6 +85,7 @@ public static void BuildProject()

private static Dictionary<string, string> GetValidatedOptions()
{
ConsoleBlock("GetValidatedOptions!", new Dictionary<string, string>(){});
ParseCommandLineArguments(out Dictionary<string, string> validatedOptions);

if (!validatedOptions.TryGetValue("projectPath", out string _))
Expand Down Expand Up @@ -123,22 +124,17 @@ private static Dictionary<string, string> GetValidatedOptions()
validatedOptions.Add("customBuildName", defaultCustomBuildName);
}

ConsoleBlock("GetValidatedOptions->return!", new Dictionary<string, string>(){});
return validatedOptions;
}

private static void ParseCommandLineArguments(out Dictionary<string, string> providedArguments)
{
ConsoleBlock("Parsing settings!", new Dictionary<string, string>(){});

providedArguments = new Dictionary<string, string>();
string[] args = Environment.GetCommandLineArgs();

Console.WriteLine(
$"{Eol}" +
$"###########################{Eol}" +
$"# Parsing settings #{Eol}" +
$"###########################{Eol}" +
$"{Eol}"
);

// Extract flags with optional values
for (int current = 0, next = 1; current < args.Length; current++, next++)
{
Expand All @@ -161,7 +157,17 @@ private static void ParseCommandLineArguments(out Dictionary<string, string> pro

private static void Build(BuildTarget buildTarget, int buildSubtarget, string filePath)
{
ConsoleBlock("Building!", new Dictionary<string, string>(){
{"BuildTarget", buildTarget.ToString()},
{"BuildSubtarget", buildSubtarget.ToString()},
{"FilePath", filePath}
});

string[] scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();
ConsoleBlock("Scenes!", new Dictionary<string, string>(){
{"Scenes", string.Join(",", scenes)}
});

var buildPlayerOptions = new BuildPlayerOptions
{
scenes = scenes,
Expand All @@ -173,6 +179,9 @@ private static void Build(BuildTarget buildTarget, int buildSubtarget, string fi
subtarget = buildSubtarget
#endif
};
ConsoleBlock("buildPlayerOptions!", new Dictionary<string, string>(){
{"buildPlayerOptions", buildPlayerOptions.ToString()}
});

BuildSummary buildSummary = BuildPipeline.BuildPlayer(buildPlayerOptions).summary;
ReportSummary(buildSummary);
Expand All @@ -181,18 +190,12 @@ private static void Build(BuildTarget buildTarget, int buildSubtarget, string fi

private static void ReportSummary(BuildSummary summary)
{
Console.WriteLine(
$"{Eol}" +
$"###########################{Eol}" +
$"# Build results #{Eol}" +
$"###########################{Eol}" +
$"{Eol}" +
$"Duration: {summary.totalTime.ToString()}{Eol}" +
$"Warnings: {summary.totalWarnings.ToString()}{Eol}" +
$"Errors: {summary.totalErrors.ToString()}{Eol}" +
$"Size: {summary.totalSize.ToString()} bytes{Eol}" +
$"{Eol}"
);
ConsoleBlock("Build results", new Dictionary<string, string>(){
{"Duration", summary.totalTime.ToString()},
{"Warnings", summary.totalWarnings.ToString()},
{"Errors", summary.totalErrors.ToString()},
{"Size", $"{summary.totalSize.ToString()} bytes"}
});
}

private static void ExitWithResult(BuildResult result)
Expand All @@ -218,5 +221,18 @@ private static void ExitWithResult(BuildResult result)
break;
}
}

private static void ConsoleBlock(string title, Dictionary<string, string> outputs)
{
Console.WriteLine(
$"{Eol}" +
$"###########################{Eol}" +
$"# {title} #{Eol}" +
$"###########################{Eol}" +
$"{Eol}" +
string.Join(Eol, outputs.Select(kvp => string.Format($"{kvp.Key}: {kvp.Value}"))) +
$"{Eol}"
);
}
}
}

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

Loading

0 comments on commit da778bc

Please sign in to comment.