Skip to content

Commit

Permalink
Merge pull request #11 from dcronqvist/dev
Browse files Browse the repository at this point in the history
Add docs and github-pages
  • Loading branch information
dcronqvist authored Aug 17, 2024
2 parents bd45d37 + 96ad2af commit b2ddd87
Show file tree
Hide file tree
Showing 145 changed files with 405 additions and 133 deletions.
9 changes: 8 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
insert_final_newline = true

[.github/**/*.yml]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
41 changes: 41 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
push:
branches:
- master

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
actions: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup DocFX
run: dotnet tool update -g docfx
- name: Build docs
run: make docs-build
- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site
- name: Deploy docs
id: deployment
uses: actions/deploy-pages@v4
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
pull_request:
branches:
- master
- dev

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore src/DotTiled.sln
- name: Build
run: dotnet build --no-restore src/DotTiled.sln
- name: Test
run: dotnet test --no-build --verbosity normal src/DotTiled.sln

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# Generated docs
docs/_site/
docs/api/
docs/index.md

# User-specific files
*.rsuser
*.suo
Expand Down
3 changes: 0 additions & 3 deletions DotTiled/Model/Layers/Objects/PointObject.cs

This file was deleted.

13 changes: 0 additions & 13 deletions DotTiled/Serialization/Tmj/Tmj.Wangset.cs

This file was deleted.

15 changes: 0 additions & 15 deletions FUNDING.yml

This file was deleted.

9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
test:
dotnet test
dotnet test src/DotTiled.sln

docs-serve: docs-build
docfx docs/docfx.json --serve

docs-build:
cp README.md docs/index.md
docfx docs/docfx.json

BENCHMARK_SOURCES = DotTiled.Benchmark/Program.cs DotTiled.Benchmark/DotTiled.Benchmark.csproj
BENCHMARK_OUTPUTDIR = DotTiled.Benchmark/BenchmarkDotNet.Artifacts
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ DotTiled is designed to be a lightweight and efficient library that provides a s

- [Alternative libraries and comparison + benchmarks](#alternative-libraries-and-comparison)
- [Feature coverage comparison](#feature-coverage-comparison)
- [Quickstart](#quickstart)
- [Installing DotTiled](#installing-dottiled)
- [Installing DotTiled](#installing-dottiled)

# Alternative libraries and comparison

Expand Down Expand Up @@ -74,9 +73,7 @@ Below is a comparison of the feature coverage of DotTiled and other similar libr
> [!NOTE]
> ✅ Full support. ⚠️ Partial support, see respective library for details about supported features. ❌ No support.
# Quickstart

### Installing DotTiled
# Installing DotTiled

DotTiled is available as a NuGet package. You can install it by using the NuGet Package Manager UI in Visual Studio, or equivalent, or using the following command for the .NET CLI:

Expand Down
46 changes: 46 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"metadata": [
{
"src": [
{
"src": "../src",
"files": [
"DotTiled/DotTiled.csproj"
]
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"output": "_site",
"template": [
"default",
"modern",
"template"
],
"globalMetadata": {
"_appName": "DotTiled",
"_appTitle": "DotTiled",
"_enableSearch": true,
"pdf": true
}
}
}
1 change: 1 addition & 0 deletions docs/docs/loading-a-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Loading a map
1 change: 1 addition & 0 deletions docs/docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Quick Start
6 changes: 6 additions & 0 deletions docs/docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: Introduction
- href: ../index.md
- href: quickstart.md

- name: Essentials
- href: loading-a-map.md
4 changes: 4 additions & 0 deletions docs/template/public/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
--bs-link-color-rgb: 66, 184, 131 !important;
--bs-link-hover-color-rgb: 64, 180, 128 !important;
}
4 changes: 4 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Docs
href: docs/
- name: API
href: api/
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ public MapLoading()

[BenchmarkCategory("MapFromInMemoryTmxString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Map LoadWithDotTiledFromInMemoryTmxString()
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmxString()
{
using var stringReader = new StringReader(_tmxContents);
using var xmlReader = XmlReader.Create(stringReader);
using var mapReader = new DotTiled.TmxMapReader(xmlReader, _ => throw new Exception(), _ => throw new Exception(), []);
using var mapReader = new DotTiled.Serialization.Tmx.TmxMapReader(xmlReader, _ => throw new Exception(), _ => throw new Exception(), []);
return mapReader.ReadMap();
}

[BenchmarkCategory("MapFromInMemoryTmjString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Map LoadWithDotTiledFromInMemoryTmjString()
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmjString()
{
using var mapReader = new DotTiled.TmjMapReader(_tmjContents, _ => throw new Exception(), _ => throw new Exception(), []);
using var mapReader = new DotTiled.Serialization.Tmj.TmjMapReader(_tmjContents, _ => throw new Exception(), _ => throw new Exception(), []);
return mapReader.ReadMap();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using DotTiled.Model.Layers;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using DotTiled.Model.Layers;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections;
using System.Numerics;
using DotTiled.Model;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
using DotTiled.Model.Layers.Objects;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
{
internal static void AssertObject(Object expected, Object actual)
internal static void AssertObject(Model.Layers.Objects.Object expected, Model.Layers.Objects.Object actual)
{
// Attributes
AssertEqual(expected.ID, actual.ID, nameof(Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(Object.Type));
AssertEqual(expected.X, actual.X, nameof(Object.X));
AssertEqual(expected.Y, actual.Y, nameof(Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(Object.Template));
AssertEqual(expected.ID, actual.ID, nameof(Model.Layers.Objects.Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(Model.Layers.Objects.Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(Model.Layers.Objects.Object.Type));
AssertEqual(expected.X, actual.X, nameof(Model.Layers.Objects.Object.X));
AssertEqual(expected.Y, actual.Y, nameof(Model.Layers.Objects.Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(Model.Layers.Objects.Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(Model.Layers.Objects.Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Layers.Objects.Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(Model.Layers.Objects.Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(Model.Layers.Objects.Object.Template));

AssertProperties(expected.Properties, actual.Properties);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using DotTiled.Model.Properties;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

public static partial class DotTiledAssert
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Xml;
using DotTiled.Model.Properties;
using DotTiled.Model.Properties.CustomTypes;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using DotTiled.Model;
using DotTiled.Model.Layers;

namespace DotTiled.Tests;

public partial class TestData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
using DotTiled.Model.Properties.CustomTypes;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;

namespace DotTiled.Tests;

Expand Down
Loading

0 comments on commit b2ddd87

Please sign in to comment.