From 3f4c6e62bb0038e3257fe7768bd074343a6ea156 Mon Sep 17 00:00:00 2001 From: Luzifix Date: Fri, 19 Jul 2024 23:23:08 +0200 Subject: [PATCH] Add auto-doc workflow --- .github/workflows/auto-doc.yml | 26 +++++++++++++++++++ .gitignore | 1 + Docs/ADT.md | 3 +++ Warcraft.NET.Docs/Program.cs | 9 +++++++ .../Steps/GenerateAutoDocDataStep.cs | 3 +-- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/auto-doc.yml diff --git a/.github/workflows/auto-doc.yml b/.github/workflows/auto-doc.yml new file mode 100644 index 0000000..9a8d5d5 --- /dev/null +++ b/.github/workflows/auto-doc.yml @@ -0,0 +1,26 @@ +name: Automatic documentation +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + auto-doc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet publish --no-restore -o build + - name: Automatic documentation + run: dotnet build/Warcraft.NET.Docs.dll ${{ github.workspace }}/Docs + - name: Commit & Push changes + uses: actions-js/push@master + with: + github_token: ${{ secrets.ACTION_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 29c559f..ec36b6d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +build/ # Visual Studio 2015/2017 cache/options directory .vs/ diff --git a/Docs/ADT.md b/Docs/ADT.md index 8ffb894..851dab0 100644 --- a/Docs/ADT.md +++ b/Docs/ADT.md @@ -3,6 +3,9 @@ R = Read Only
N/A = Not in this file for this expansion
**NYI** = Not Yet Implemented / TODO +test + + ### ADT |Chunk|LK|WoD|Legion|BfA|SL|DF|TWW| |-----|-----|-----|-----|-----|-----|-----|-----| diff --git a/Warcraft.NET.Docs/Program.cs b/Warcraft.NET.Docs/Program.cs index 120a14a..ce9d6ff 100644 --- a/Warcraft.NET.Docs/Program.cs +++ b/Warcraft.NET.Docs/Program.cs @@ -10,6 +10,8 @@ internal class Program /// static void Main(string[] args) { + Console.WriteLine($"BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}"); + if (args.Length == 0) throw new System.Exception("Please provide an output folder"); @@ -17,8 +19,15 @@ static void Main(string[] args) if (!Directory.Exists(outputFolder)) throw new Exception("Output folder does not exist"); + Console.WriteLine($"Output folder: {outputFolder}"); + + Console.WriteLine("Generating documentation..."); var autoDocData = GenerateAutoDocDataStep.Process(); + + Console.WriteLine("Converting to markdown..."); ConvertToMarkdownStep.Process(autoDocData, outputFolder); + + Console.WriteLine("Done!"); } } } \ No newline at end of file diff --git a/Warcraft.NET.Docs/Steps/GenerateAutoDocDataStep.cs b/Warcraft.NET.Docs/Steps/GenerateAutoDocDataStep.cs index 507e539..9393865 100644 --- a/Warcraft.NET.Docs/Steps/GenerateAutoDocDataStep.cs +++ b/Warcraft.NET.Docs/Steps/GenerateAutoDocDataStep.cs @@ -10,8 +10,7 @@ internal static Dictionary>>> docData = new(); - var classWithDocs = - Assembly.LoadFrom("Warcraft.NET.dll") + var classWithDocs = Assembly.LoadFrom(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Warcraft.NET.dll")) .GetTypes() .Where(type => !type.IsAbstract) .Where(type => type.GetCustomAttribute(typeof(AutoDocFile), false) != null);