Skip to content

Commit

Permalink
ci: more experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Sep 10, 2023
1 parent 8fc5eb7 commit 9804e1b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/ProjectRoot/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ apt-get -y install dotnet7
ls -l /root/.dotnet/tools
ls -l .

for csproj in *.csproj; do
echo "=== $csproj ==="
cat $csproj
done

/root/.dotnet/tools/docfx Packages/nadena.dev.ndmf/docfx~/docfx.json
tar -C Packages/nadena.dev.ndmf/docfx~/_site -czf build/StandaloneWindows/docs.tgz .
8 changes: 0 additions & 8 deletions .github/workflows/gameci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ jobs:
key: Library-${{ matrix.projectPath }}
restore-keys: Library-

- run: |
# Copy .NET DLLs into Assets so they're visible to docfx...
docker run -v .:/mnt unityci/editor:ubuntu-2019.4.31f1-windows-mono-2 sh -c \
'cp /opt/unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7-api/*.dll /mnt/Assets -v'
- uses: game-ci/unity-builder@v3
id: docgen
with:
Expand All @@ -82,9 +77,6 @@ jobs:
# meh, just a personal license...
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}

- run: |
rm Assets/*.dll -v
- uses: game-ci/unity-test-runner@v3
id: gameci
env:
Expand Down
46 changes: 46 additions & 0 deletions UnitTests~/DocsBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Xml;
using Microsoft.Unity.VisualStudio.Editor;
using UnityEditor;

Expand All @@ -19,6 +20,7 @@ public static void BuildDocs()

try
{
MungeProjectFiles();
RunProcess("./build-docs.sh");
}
catch (Exception e)
Expand All @@ -30,6 +32,50 @@ public static void BuildDocs()
System.Console.Out.WriteLine("# Build results\n#\nSize:");
}

private static void MungeProjectFiles()
{
foreach (var file in Directory.EnumerateFiles("."))
{
if (file.EndsWith(".csproj"))
{
MungeProjectFile(file);
}
}
}

private static void MungeProjectFile(string file)
{
XmlDocument doc = new XmlDocument();
doc.Load(file);

var root = doc.DocumentElement;
var assemblyGroup = doc.CreateElement("ItemGroup");

foreach (var possibleDll in
Directory.EnumerateFiles("/opt/unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7-api"))
{
if (possibleDll.EndsWith(".dll"))
{
var assembly = possibleDll.Substring(
possibleDll.LastIndexOf('/'));
assembly = possibleDll.Substring(possibleDll.Length - 4);

var referenceNode = doc.CreateElement("Reference");
referenceNode.SetAttribute("Include", assembly);

var hintNode = doc.CreateElement("HintPath");
hintNode.InnerText = possibleDll;

referenceNode.AppendChild(hintNode);
assemblyGroup.AppendChild(referenceNode);
}

root.AppendChild(assemblyGroup);

doc.Save(file);
}
}

private static void RunProcess(string command)
{
System.Console.Error.WriteLine("=== Running command: " + command + " ===");
Expand Down

0 comments on commit 9804e1b

Please sign in to comment.