Skip to content

Commit 8422625

Browse files
committed
Fix pipeline
1 parent 1b55f8e commit 8422625

File tree

6 files changed

+132
-155
lines changed

6 files changed

+132
-155
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v4
3030
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
31-
uses: actions/cache@v3
31+
uses: actions/cache@v4
3232
with:
3333
path: |
3434
.nuke/temp

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- uses: actions/checkout@v4
3333
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
34-
uses: actions/cache@v3
34+
uses: actions/cache@v4
3535
with:
3636
path: |
3737
.nuke/temp

.nuke/build.schema.json

Lines changed: 76 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,52 @@
11
{
22
"$schema": "http://json-schema.org/draft-04/schema#",
3-
"$ref": "#/definitions/build",
4-
"title": "Build Schema",
53
"definitions": {
6-
"build": {
7-
"type": "object",
4+
"Host": {
5+
"type": "string",
6+
"enum": [
7+
"AppVeyor",
8+
"AzurePipelines",
9+
"Bamboo",
10+
"Bitbucket",
11+
"Bitrise",
12+
"GitHubActions",
13+
"GitLab",
14+
"Jenkins",
15+
"Rider",
16+
"SpaceAutomation",
17+
"TeamCity",
18+
"Terminal",
19+
"TravisCI",
20+
"VisualStudio",
21+
"VSCode"
22+
]
23+
},
24+
"ExecutableTarget": {
25+
"type": "string",
26+
"enum": [
27+
"ChangelogVersionMatchesGitTagVersion",
28+
"CheckForUnityMetaFiles",
29+
"Clean",
30+
"Compile",
31+
"Publish",
32+
"PublishGitHubRelease",
33+
"Restore",
34+
"Test",
35+
"UnityPackageVersionMatchesGitTagVersion"
36+
]
37+
},
38+
"Verbosity": {
39+
"type": "string",
40+
"description": "",
41+
"enum": [
42+
"Verbose",
43+
"Normal",
44+
"Minimal",
45+
"Quiet"
46+
]
47+
},
48+
"NukeBuild": {
849
"properties": {
9-
"ChangelogVersionMatchesGitTagVersionChangelogFile": {
10-
"type": "string"
11-
},
12-
"CheckForUnityMetaFilesExcludeDirectories": {
13-
"type": "array",
14-
"items": {
15-
"type": "string"
16-
}
17-
},
18-
"CheckForUnityMetaFilesIncludeDirectories": {
19-
"type": "array",
20-
"items": {
21-
"type": "string"
22-
}
23-
},
24-
"Configuration": {
25-
"type": "string",
26-
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
27-
"enum": [
28-
"Debug",
29-
"Release"
30-
]
31-
},
3250
"Continue": {
3351
"type": "boolean",
3452
"description": "Indicates to continue a previously failed build attempt"
@@ -38,25 +56,8 @@
3856
"description": "Shows the help text for this build assembly"
3957
},
4058
"Host": {
41-
"type": "string",
4259
"description": "Host for execution. Default is 'automatic'",
43-
"enum": [
44-
"AppVeyor",
45-
"AzurePipelines",
46-
"Bamboo",
47-
"Bitbucket",
48-
"Bitrise",
49-
"GitHubActions",
50-
"GitLab",
51-
"Jenkins",
52-
"Rider",
53-
"SpaceAutomation",
54-
"TeamCity",
55-
"Terminal",
56-
"TravisCI",
57-
"VisualStudio",
58-
"VSCode"
59-
]
60+
"$ref": "#/definitions/Host"
6061
},
6162
"NoLogo": {
6263
"type": "boolean",
@@ -77,9 +78,6 @@
7778
"type": "string"
7879
}
7980
},
80-
"PublishGitHubReleaseChangelogFile": {
81-
"type": "string"
82-
},
8381
"Root": {
8482
"type": "string",
8583
"description": "Root directory during build execution"
@@ -88,56 +86,51 @@
8886
"type": "array",
8987
"description": "List of targets to be skipped. Empty list skips all dependencies",
9088
"items": {
91-
"type": "string",
92-
"enum": [
93-
"ChangelogVersionMatchesGitTagVersion",
94-
"CheckForUnityMetaFiles",
95-
"Clean",
96-
"Compile",
97-
"Publish",
98-
"PublishGitHubRelease",
99-
"Restore",
100-
"Test",
101-
"UnityPackageVersionMatchesGitTagVersion"
102-
]
89+
"$ref": "#/definitions/ExecutableTarget"
10390
}
10491
},
10592
"Target": {
10693
"type": "array",
10794
"description": "List of targets to be invoked. Default is '{default_target}'",
10895
"items": {
109-
"type": "string",
110-
"enum": [
111-
"ChangelogVersionMatchesGitTagVersion",
112-
"CheckForUnityMetaFiles",
113-
"Clean",
114-
"Compile",
115-
"Publish",
116-
"PublishGitHubRelease",
117-
"Restore",
118-
"Test",
119-
"UnityPackageVersionMatchesGitTagVersion"
120-
]
96+
"$ref": "#/definitions/ExecutableTarget"
12197
}
12298
},
99+
"Verbosity": {
100+
"description": "Logging verbosity during build execution. Default is 'Normal'",
101+
"$ref": "#/definitions/Verbosity"
102+
}
103+
}
104+
}
105+
},
106+
"allOf": [
107+
{
108+
"properties": {
109+
"ChangelogVersionMatchesGitTagVersionChangelogFile": {
110+
"type": "string"
111+
},
112+
"Configuration": {
113+
"type": "string",
114+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
115+
"enum": [
116+
"Debug",
117+
"Release"
118+
]
119+
},
120+
"PublishGitHubReleaseChangelogFile": {
121+
"type": "string"
122+
},
123123
"UnitTestProject": {
124124
"type": "string",
125125
"description": "Path to a solution file that is automatically loaded"
126126
},
127127
"UnityPackageVersionMatchesGitTagVersionUnityPackageFile": {
128128
"type": "string"
129-
},
130-
"Verbosity": {
131-
"type": "string",
132-
"description": "Logging verbosity during build execution. Default is 'Normal'",
133-
"enum": [
134-
"Minimal",
135-
"Normal",
136-
"Quiet",
137-
"Verbose"
138-
]
139129
}
140130
}
131+
},
132+
{
133+
"$ref": "#/definitions/NukeBuild"
141134
}
142-
}
135+
]
143136
}

.nuke/parameters.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"$schema": "./build.schema.json",
33
"UnitTestProject": "./tests/tests.csproj",
4-
"CheckForUnityMetaFilesIncludeDirectories": [
5-
"./src/Assets/SimpleCodeGenerator"
6-
],
74
"ChangelogVersionMatchesGitTagVersionChangelogFile": "./CHANGELOG.md",
85
"PublishGitHubReleaseChangelogFile": "./CHANGELOG.md",
96
"UnityPackageVersionMatchesGitTagVersionUnityPackageFile": "./src/Assets/SimpleCodeGenerator/package.json"

build/Build.cs

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
EnableGitHubToken = true,
3434
OnPushTags = new[] { "v[0-9]+.[0-9]+.[0-9]+" }
3535
)]
36-
class Build : NukeBuild, ICheckForUnityMetaFiles, IUnityPackageVersionMatchesGitTagVersion, IChangelogVersionMatchesGitTagVersion, IPublishGitHubRelease
36+
class Build : NukeBuild, IUnityPackageVersionMatchesGitTagVersion, IChangelogVersionMatchesGitTagVersion, IPublishGitHubRelease
3737
{
3838
public static int Main() => Execute<Build>(x => x.Test);
3939

@@ -61,7 +61,7 @@ class Build : NukeBuild, ICheckForUnityMetaFiles, IUnityPackageVersionMatchesGit
6161

6262
Target Compile => _ => _
6363
.DependsOn(Restore)
64-
.DependsOn<ICheckForUnityMetaFiles>()
64+
.DependsOn(CheckForUnityMetaFiles)
6565
.Executes(() =>
6666
{
6767
DotNetTasks.DotNetBuild(settings => settings
@@ -89,4 +89,56 @@ class Build : NukeBuild, ICheckForUnityMetaFiles, IUnityPackageVersionMatchesGit
8989
Target Publish => _ => _
9090
.DependsOn(Test)
9191
.Triggers<IPublishGitHubRelease>();
92+
93+
Target CheckForUnityMetaFiles => _ => _
94+
.Executes(() =>
95+
{
96+
// Verify that all files and directories have a Unity meta file (if the meta file is missing the file will be ignored when imported into Unity)
97+
AssertThatUnityMetaFilesExist([RootDirectory / "src" / "Assets" / "SimpleCodeGenerator"], []);
98+
});
99+
100+
/// <summary>
101+
/// Checks recursively if all files and folders have a Unity meta file.
102+
/// </summary>
103+
static void AssertThatUnityMetaFilesExist(AbsolutePath[] includeDirectories, AbsolutePath[] excludeDirectories)
104+
{
105+
excludeDirectories ??= [];
106+
107+
if (includeDirectories.IsNullOrEmpty())
108+
Assert.Fail("No directories have been provided to check for .meta files!");
109+
110+
Log.Information("Checking if all necessary Unity .meta files exist...");
111+
112+
int totalDirectoriesChecked = 0;
113+
int totalFilesChecked = 0;
114+
115+
foreach (AbsolutePath includeDirectory in includeDirectories)
116+
{
117+
var directories = includeDirectory.GlobDirectories("**").Where(d => d != includeDirectory);
118+
119+
foreach (AbsolutePath d in directories)
120+
{
121+
if (excludeDirectories.Contains(d))
122+
continue;
123+
124+
Assert.True((d.Parent / (d.Name + ".meta")).FileExists(), $"The directory '{d}' does not have a Unity meta file!");
125+
126+
totalDirectoriesChecked++;
127+
}
128+
129+
var files = includeDirectory.GlobFiles("**/*").Where(f => !f.ToString().EndsWith(".meta"));
130+
131+
foreach (AbsolutePath f in files)
132+
{
133+
if (excludeDirectories.Contains(f.Parent))
134+
continue;
135+
136+
Assert.True((f.Parent / (f.Name + ".meta")).FileExists(), $"The file '{f}' does not have a Unity meta file!");
137+
138+
totalFilesChecked++;
139+
}
140+
}
141+
142+
Log.Information("Checked a total of {Directories} directories and {Files} files", totalDirectoriesChecked, totalFilesChecked);
143+
}
92144
}

build/ICheckForUnityMetaFiles.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)