Skip to content

Commit 790e990

Browse files
committed
feat: RoxyAPI .NET SDK, Kiota-generated typed client with compile-verified docs and OIDC NuGet release
0 parents  commit 790e990

1,287 files changed

Lines changed: 155378 additions & 0 deletions

File tree

Some content is hidden

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

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{json,yml,yaml,md,csproj,props}]
12+
indent_size = 2
13+
14+
# Kiota output is machine generated. Do not lint, format, or analyze it.
15+
[src/Generated/**.cs]
16+
generated_code = true
17+
dotnet_analyzer_diagnostic.severity = none

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: nuget
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
# Wait 3 days before opening a bump PR so freshly published versions get
9+
# a chance to be flagged for supply-chain issues before they land.
10+
cooldown:
11+
default-days: 3
12+
groups:
13+
dependencies:
14+
patterns:
15+
- "*"
16+
17+
- package-ecosystem: github-actions
18+
directory: /
19+
schedule:
20+
interval: weekly

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- uses: actions/setup-dotnet@v5
18+
with:
19+
dotnet-version: |
20+
8.0.x
21+
9.0.x
22+
23+
- name: Install Kiota
24+
run: |
25+
dotnet tool install --global Microsoft.OpenApi.Kiota --version 1.32.2
26+
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
27+
28+
- name: Codegen drift check
29+
run: |
30+
dotnet run --project tools/RoxyDevTools -- generate
31+
git diff --exit-code -- specs/openapi.json src/Generated \
32+
|| { echo 'codegen drift: run "dotnet run --project tools/RoxyDevTools -- generate" and commit the result'; exit 1; }
33+
34+
- name: Docs drift check
35+
run: |
36+
dotnet run --project tools/RoxyDevTools -- sync-docs
37+
git diff --exit-code -- README.md AGENTS.md docs/llms-full.txt tests/RoxyApi.Tests/Generated \
38+
|| { echo 'docs drift: run "dotnet run --project tools/RoxyDevTools -- sync-docs" and commit the result'; exit 1; }
39+
40+
- name: Format check
41+
run: dotnet format --verify-no-changes --exclude src/Generated/
42+
43+
- name: Build
44+
run: dotnet build -c Release
45+
46+
- name: Test
47+
run: dotnet test -c Release --no-build
48+
env:
49+
ROXY_API_KEY: ${{ secrets.ROXY_API_KEY }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Dependabot auto-merge
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
auto-merge:
11+
if: github.actor == 'dependabot[bot]'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Fetch Dependabot metadata
15+
id: meta
16+
uses: dependabot/fetch-metadata@v2
17+
- name: Auto-approve patch and minor bumps
18+
if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor'
19+
run: gh pr review --approve "$PR_URL"
20+
env:
21+
PR_URL: ${{ github.event.pull_request.html_url }}
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Enable auto-merge for patch and minor bumps
24+
if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor'
25+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
26+
env:
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Release
2+
3+
on:
4+
repository_dispatch:
5+
types: [openapi-updated]
6+
schedule:
7+
- cron: '0 6 * * *'
8+
workflow_dispatch:
9+
inputs:
10+
version_bump:
11+
description: 'patch | minor | major'
12+
required: false
13+
default: 'patch'
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
environment: release
19+
permissions:
20+
contents: write
21+
id-token: write
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: actions/setup-dotnet@v5
28+
with:
29+
dotnet-version: |
30+
8.0.x
31+
9.0.x
32+
33+
- name: Install Kiota
34+
run: |
35+
dotnet tool install --global Microsoft.OpenApi.Kiota --version 1.32.2
36+
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
37+
38+
- name: Regenerate from live spec
39+
run: dotnet run --project tools/RoxyDevTools -- generate
40+
41+
- name: Check if spec changed
42+
id: diff
43+
run: |
44+
if git diff --quiet specs/openapi.json src/Generated; then
45+
echo "changed=false" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "changed=true" >> "$GITHUB_OUTPUT"
48+
fi
49+
50+
- name: Build
51+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
52+
run: dotnet build -c Release
53+
54+
- name: Test
55+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
56+
run: dotnet test -c Release --no-build
57+
env:
58+
ROXY_API_KEY: ${{ secrets.ROXY_API_KEY }}
59+
60+
- name: Bump version in src/RoxyApi.csproj
61+
id: bump
62+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
63+
run: |
64+
python3 - <<'PY'
65+
import os, re
66+
bump = "${{ github.event.inputs.version_bump || 'patch' }}"
67+
path = "src/RoxyApi.csproj"
68+
text = open(path).read()
69+
cur = re.search(r"<Version>(.+?)</Version>", text).group(1)
70+
major, minor, patch = (int(x) for x in cur.split("."))
71+
if bump == "major": major, minor, patch = major + 1, 0, 0
72+
elif bump == "minor": minor, patch = minor + 1, 0
73+
else: patch += 1
74+
new = f"{major}.{minor}.{patch}"
75+
open(path, "w").write(text.replace(f"<Version>{cur}</Version>", f"<Version>{new}</Version>", 1))
76+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
77+
f.write(f"version={new}\n")
78+
print(f"Bumped {cur} -> {new} ({bump})")
79+
PY
80+
81+
- name: Pack
82+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
83+
run: dotnet pack src/RoxyApi.csproj -c Release -o artifacts
84+
85+
- name: NuGet login (OIDC, short-lived API key)
86+
id: login
87+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
88+
uses: NuGet/login@v1
89+
with:
90+
user: ${{ secrets.NUGET_USER }}
91+
92+
- name: Push to NuGet
93+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
94+
run: dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
95+
96+
- name: Commit, tag, push
97+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
98+
run: |
99+
git config user.name "github-actions[bot]"
100+
git config user.email "github-actions[bot]@users.noreply.github.com"
101+
VERSION=${{ steps.bump.outputs.version }}
102+
git add specs/openapi.json src/ README.md AGENTS.md docs/llms-full.txt tests/RoxyApi.Tests/Generated
103+
git commit -m "release: v$VERSION"
104+
git tag "v$VERSION"
105+
git push --follow-tags
106+
107+
- name: Create GitHub release
108+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
109+
uses: softprops/action-gh-release@v3
110+
with:
111+
tag_name: v${{ steps.bump.outputs.version }}
112+
generate_release_notes: true
113+
make_latest: 'true'
114+
files: artifacts/*.nupkg

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Build output
2+
bin/
3+
obj/
4+
artifacts/
5+
[Dd]ebug/
6+
[Rr]elease/
7+
8+
# IDE
9+
.vs/
10+
.idea/
11+
*.user
12+
*.suo
13+
14+
# Local secrets
15+
.env
16+
.env.local
17+
*.env.*
18+
19+
# Maintainer-only, never published or pushed
20+
CLAUDE.md
21+
docs/todo.md

0 commit comments

Comments
 (0)