diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0d8c338..3a16342 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -19,6 +19,18 @@ "commands": [ "spdx-tool" ] + }, + "demaconsulting.pandoctool": { + "version": "3.8.3", + "commands": [ + "pandoc" + ] + }, + "demaconsulting.weasyprinttool": { + "version": "67.0.0", + "commands": [ + "weasyprint" + ] } } } \ No newline at end of file diff --git a/.github/workflows/build_docs.yaml b/.github/workflows/build_docs.yaml new file mode 100644 index 0000000..5e846d7 --- /dev/null +++ b/.github/workflows/build_docs.yaml @@ -0,0 +1,53 @@ +--- +name: Build Documentation + +on: + workflow_call: + +jobs: + build-docs: + permissions: + contents: read # To read repository contents + + runs-on: windows-latest + + steps: + + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: 'lts/*' + + - name: Setup dotnet + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 10.x + + - name: Install npm dependencies + run: npm install + + - name: Install dotnet tools + run: dotnet tool restore + + - name: Generate HTML with Pandoc + run: > + dotnet pandoc + docs/guide/title.txt + --defaults docs/guide/definition.yaml + --output docs/guide/guide.html + + - name: Generate PDF with Weasyprint + run: > + dotnet weasyprint + docs/guide/guide.html + docs/guide/guide.pdf + + - name: Upload Documentation + uses: actions/upload-artifact@v6 + with: + name: documentation + path: docs/guide/guide.pdf diff --git a/.github/workflows/build_on_push.yaml b/.github/workflows/build_on_push.yaml index a81c0eb..e8a09a3 100644 --- a/.github/workflows/build_on_push.yaml +++ b/.github/workflows/build_on_push.yaml @@ -57,3 +57,10 @@ jobs: version: 0.0.0-run.${{ github.run_number }} secrets: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + build-docs: + name: Build Documentation + needs: quality-checks + permissions: + contents: read # To read repository contents + uses: ./.github/workflows/build_docs.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 487da61..7e0dbfa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,6 +31,12 @@ jobs: secrets: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + build-docs: + name: Build Documentation + permissions: + contents: read # To read repository contents + uses: ./.github/workflows/build_docs.yaml + release: permissions: contents: write # To create releases diff --git a/.gitignore b/.gitignore index 15e4073..98bd26c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ coverage/ # Temporary files *.tmp .DS_Store + +# Node.js dependencies +node_modules/ diff --git a/docs/guide/definition.yaml b/docs/guide/definition.yaml new file mode 100644 index 0000000..eba5943 --- /dev/null +++ b/docs/guide/definition.yaml @@ -0,0 +1,13 @@ +--- +resource-path: + - docs/guide + - docs/template + +input-files: + - docs/guide/guide.md + +template: guide_template.html + +table-of-contents: true + +number-sections: true diff --git a/docs/guide/title.txt b/docs/guide/title.txt new file mode 100644 index 0000000..2833de2 --- /dev/null +++ b/docs/guide/title.txt @@ -0,0 +1,14 @@ +--- +title: TestResults Library +subtitle: Developer Guide +lang: en-US +keywords: + - TestResults + - C# + - .NET + - TRX + - JUnit + - Test Results + - Testing + - Documentation +--- diff --git a/docs/template/guide_template.css b/docs/template/guide_template.css new file mode 100644 index 0000000..02da374 --- /dev/null +++ b/docs/template/guide_template.css @@ -0,0 +1,178 @@ +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: #333; + max-width: 800px; + margin: 0 auto; + padding: 20px; +} + +h1, h2, h3, h4, h5, h6 { + margin-top: 24px; + margin-bottom: 16px; + font-weight: 600; + line-height: 1.25; +} + +h1 { + font-size: 2em; + border-bottom: 1px solid #eaecef; + padding-bottom: 0.3em; +} + +h2 { + font-size: 1.5em; + border-bottom: 1px solid #eaecef; + padding-bottom: 0.3em; +} + +h3 { + font-size: 1.25em; +} + +h4 { + font-size: 1em; +} + +h5 { + font-size: 0.875em; +} + +h6 { + font-size: 0.85em; + color: #6a737d; +} + +code { + background-color: #f6f8fa; + border-radius: 3px; + font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 85%; + padding: 0.2em 0.4em; +} + +pre { + background-color: #f6f8fa; + border-radius: 3px; + font-size: 85%; + line-height: 1.45; + overflow: auto; + padding: 16px; +} + +pre code { + background-color: transparent; + border: 0; + display: inline; + line-height: inherit; + margin: 0; + max-width: auto; + overflow: visible; + padding: 0; + word-wrap: normal; +} + +blockquote { + border-left: 0.25em solid #dfe2e5; + color: #6a737d; + padding: 0 1em; + margin: 0 0 16px 0; +} + +table { + border-collapse: collapse; + margin: 16px 0; + width: 100%; +} + +table th, table td { + border: 1px solid #dfe2e5; + padding: 6px 13px; +} + +table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; +} + +table tr:nth-child(2n) { + background-color: #f6f8fa; +} + +ul, ol { + padding-left: 2em; + margin-bottom: 16px; +} + +li + li { + margin-top: 0.25em; +} + +a { + color: #0366d6; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +.title-page { + text-align: center; + margin-top: 100px; + margin-bottom: 100px; +} + +.title-page h1 { + font-size: 3em; + border-bottom: none; +} + +.title-page h2 { + font-size: 2em; + color: #6a737d; + border-bottom: none; +} + +#TOC { + border: 1px solid #dfe2e5; + border-radius: 3px; + padding: 16px; + margin: 24px 0; + background-color: #f6f8fa; +} + +#TOC ul { + list-style-type: none; + padding-left: 0; +} + +#TOC ul ul { + padding-left: 20px; +} + +#TOC > ul > li { + margin-top: 8px; +} + +#TOC a { + color: #0366d6; +} + +@media print { + body { + max-width: none; + } + + .title-page { + page-break-after: always; + } + + h1, h2, h3 { + page-break-after: avoid; + } + + pre, blockquote { + page-break-inside: avoid; + } +} diff --git a/docs/template/guide_template.html b/docs/template/guide_template.html new file mode 100644 index 0000000..883dd50 --- /dev/null +++ b/docs/template/guide_template.html @@ -0,0 +1,28 @@ + + +
+ + +