Skip to content

Commit c5a5730

Browse files
committed
First pass at the API site
1 parent dab06d7 commit c5a5730

File tree

2,971 files changed

+2984484
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,971 files changed

+2984484
-0
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"docfx": {
6+
"version": "2.78.3",
7+
"commands": [
8+
"docfx"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
insert_final_newline = true
8+
end_of_line = lf
9+
10+
[*.cs]
11+
indent_style = tab
12+
indent_size = 4

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto eol=lf
2+
metadata/**/* eol=crlf

.github/workflows/push-main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: api.xunit.net (CI)
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Clone source
22+
uses: actions/checkout@v4
23+
24+
- name: Install .NET SDK
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: |
28+
9.0.x
29+
30+
- name: Get .NET information
31+
run: dotnet --info
32+
33+
- name: Setup GitHub Pages
34+
uses: actions/configure-pages@v5
35+
36+
- name: "Build target: Build"
37+
run: dotnet run --project tools/builder --no-launch-profile -- Build --timing
38+
39+
- name: "Upload artifact: github-pages"
40+
uses: actions/upload-pages-artifact@v3
41+
42+
deploy:
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
runs-on: ubuntu-latest
47+
needs: build
48+
steps:
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_site/
2+
**/bin/
3+
**/obj/

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
api.xunit.net

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# About This Project
2+
3+
This project contains the public site for [https://api.xunit.net/](https://api.xunit.net/).
4+
5+
To open an issue for this project, please visit the [core xUnit.net project issue tracker](https://github.com/xunit/xunit/issues).
6+
7+
## Building and Contribution
8+
9+
This site is built with DocFX. We use a C#-based build system.
10+
11+
### Build prerequisites
12+
13+
In order to successfully view the content locally, you will need the following pre-requisites:
14+
15+
* [.NET SDK 9.0](https://dotnet.microsoft.com/download/dotnet/9.0)
16+
* [Docker](https://docs.docker.com/engine/install/) to host nginx for serving built content locally
17+
18+
We have verified this works using both Windows and Linux.
19+
20+
### Building and serving
21+
22+
To build the static content for the site, run `./build`. This will run DocFX to convert the Markdown and YAML files into static content, under a top-level `_site` folder.
23+
24+
To serve the `_site` folder locally, you can run `./build serve` which will launch nginx in a Docker container, and serve the content [locally on port 4000](http://localhost:4000/).
25+
26+
_Important note: You must rebuild the site manually when making changes either to the site or the metadata. The nginx container merely serves whatever lives in `/_site`._
27+
28+
### Editing the site pages
29+
30+
The site content lives in [`/site`](https://github.com/xunit/api.xunit.net/tree/main/site).
31+
32+
Text editors/IDEs which understand site hierarchy and linking while editing Markdown are strongly encouraged to open the `/site` folder and not the root folder when editing content, so that the editor understands where the content root lives. _For example, if you're using VSCode, you should run `code site` and not `code .` from the root of the repo._
33+
34+
### Adding metadata for a new xUnit.net version
35+
36+
The [`/metadata`](https://github.com/xunit/api.xunit.net/tree/main/metadata) folder contains the versions of metadata created by `dotnet docfx metadata` during xUnit.net's CI process.
37+
38+
* Download the `docfx` artifact from the appropriate GitHub Actions build, and unzip it into a new folder under `/metadata` that aligns with the version of the assemblies (i.e., the metadata for the `2.0.1` packages for xUnit.net v3 lives under `/metadata/v3/2.0.1`).
39+
40+
* Update [`/site/toc.yml`](https://github.com/xunit/api.xunit.net/tree/main/site/toc.yml) to add an entry for the new version.
41+
42+
* Create an `index.md` under the `site` tree at the appropriate location for the version. Look at the existing tree and inside one of the existing `index.md` files for an example.
43+
44+
Now you should be able to build the site and view the new API version.
45+
46+
# About xUnit.net
47+
48+
[<img align="right" src="https://xunit.net/images/dotnet-fdn-logo.png" width="100" />](https://www.dotnetfoundation.org/)
49+
50+
xUnit.net is a free, open source, community-focused unit testing tool for the .NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages. xUnit.net works with ReSharper, CodeRush, TestDriven.NET and Xamarin. It is part of the [.NET Foundation](https://www.dotnetfoundation.org/), and operates under their [code of conduct](https://dotnetfoundation.org/about/policies/code-of-conduct). It is licensed under [Apache 2](https://opensource.org/licenses/Apache-2.0) (an OSI approved license).
51+
52+
For project documentation, please visit the [xUnit.net project home](https://xunit.net/).

build

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
function write_error {
5+
echo "error(1): $1" 2>&1
6+
exit 1
7+
}
8+
9+
function guard_bin {
10+
builtin type -P "$1" &>/dev/null || write_error "Could not find '$1'; $2"
11+
}
12+
13+
guard_bin git "please install the Git CLI from (https://git-scm.com/)"
14+
guard_bin dotnet "please install the .NET SDK from (https://dot.net/)"
15+
guard_bin docker "please install Docker from (https://docs.docker.com/engine/install/)"
16+
17+
[ $(dotnet --version | cut -d. -f1) -ge 9 ] || write_error ".NET SDK version $(dotnet --version) is too low; please install version 9.0 (https://dot.net/)"
18+
19+
git submodule status | while read line; do
20+
if [ "$(echo $line | cut -b1)" == "-" ]; then
21+
pieces=( $line )
22+
git submodule update --init ${pieces[1]}
23+
echo ""
24+
fi
25+
done
26+
27+
PUSHED=0
28+
29+
cleanup () {
30+
if [[ $PUSHED == 1 ]]; then
31+
popd >/dev/null
32+
PUSHED=0
33+
fi
34+
}
35+
36+
trap cleanup EXIT ERR INT TERM
37+
38+
pushd $( cd "$(dirname "$0")" ; pwd -P ) >/dev/null
39+
PUSHED=1
40+
41+
dotnet run --project tools/builder --no-launch-profile -- "$@"

build.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env pwsh
2+
#Requires -Version 5.1
3+
4+
Set-StrictMode -Version Latest
5+
$ErrorActionPreference = "Stop"
6+
7+
function GuardBin {
8+
param (
9+
[string]$binary,
10+
[string]$message
11+
)
12+
13+
if ($null -eq (Get-Command $binary -ErrorAction Ignore)) {
14+
throw "Could not find '$binary'; $message"
15+
}
16+
}
17+
18+
GuardBin git "please install the Git CLI from https://git-scm.com/"
19+
GuardBin dotnet "please install the .NET SDK from https://dot.net/"
20+
GuardBin npm "please install Node and npm from (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)"
21+
GuardBin docker "please install Docker from (https://docs.docker.com/engine/install/)"
22+
23+
$version = [Version]$([regex]::matches((&dotnet --version), '^(\d+\.)?(\d+\.)?(\*|\d+)').value)
24+
if ($version.Major -lt 9) {
25+
throw ".NET SDK version ($version) is too low; please install version 9.0 from https://dot.net/"
26+
}
27+
28+
& git submodule status | ForEach-Object {
29+
if ($_[0] -eq '-') {
30+
$pieces = $_.Split(' ')
31+
& git submodule update --init "$($pieces[1])"
32+
Write-Host ""
33+
}
34+
}
35+
36+
Push-Location (Split-Path $MyInvocation.MyCommand.Definition)
37+
38+
try {
39+
& dotnet run --project tools/builder --no-launch-profile -- $args
40+
}
41+
finally {
42+
Pop-Location
43+
}

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "9.0.100",
4+
"rollForward": "latestMinor"
5+
}
6+
}

0 commit comments

Comments
 (0)