Skip to content

Commit dc379ed

Browse files
committed
ci: Setup workflows
1 parent 722edb7 commit dc379ed

10 files changed

Lines changed: 255 additions & 1 deletion

File tree

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: nikcio
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Bug report"
2+
description: "File a bug report to help improve this package."
3+
labels: "bug"
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to report this issue as thoroughly as possible.
9+
- type: input
10+
id: "PackageVersion"
11+
attributes:
12+
label: "Which Nikcio.OpenApiCodeGen version are you using? For example: 3.2.0"
13+
description: "Use the `openapi-codegen --version` command in your project to find the version."
14+
validations:
15+
required: true
16+
- type: textarea
17+
id: "summary"
18+
attributes:
19+
label: "Bug summary"
20+
description: "Write a summary of the bug."
21+
description: "Remember that you can format code and logs nicely with the `<>` button"
22+
placeholder: >
23+
Try to pinpoint it as much as possible.
24+
25+
Try to state the actual problem, and not just what you think the solution might be.
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: "Steps to reproduce"
31+
id: "reproduction"
32+
description: "How can we reproduce the problem on a OpenAPI specification?"
33+
placeholder: >
34+
Please include Minimal OpenAPI specification, any links, screenshots, stack-traces, etc.
35+
validations:
36+
required: true
37+
- type: textarea
38+
attributes:
39+
label: "Expected result / actual result"
40+
id: "result"
41+
description: "What did you expect that would happen and what is the actual result of the above steps?"
42+
placeholder: >
43+
Describe the intended/desired outcome after you did the steps mentioned.
44+
45+
Describe the behaviour of the bug

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Feature request"
2+
description: "Suggest an idea for this package."
3+
labels: "enhancement"
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to suggest this feature request!
9+
- type: textarea
10+
id: "summary"
11+
attributes:
12+
label: "Feature summary"
13+
description: "Write a brief summary of the feature"
14+
validations:
15+
required: true
16+
- type: textarea
17+
id: "details"
18+
attributes:
19+
label: "Additional details"
20+
description: "Provide any additional details or comments about the feature you are suggesting"
21+
validations:
22+
required: false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Question"
2+
description: "Ask a question about the package."
3+
labels: "question"
4+
body:
5+
- type: textarea
6+
id: "summary"
7+
attributes:
8+
label: "Question"
9+
validations:
10+
required: true

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
# NuGet - uses central package management (Directory.Packages.props at root)
9+
- package-ecosystem: "nuget"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
14+
# npm/pnpm - docs site
15+
- package-ecosystem: "npm"
16+
directory: "/docs/"
17+
schedule:
18+
interval: "weekly"
19+
20+
- package-ecosystem: "github-actions"
21+
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
22+
directory: "/"
23+
schedule:
24+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'src/**'
8+
- 'examples/**'
9+
- 'Directory.Build.props'
10+
- '.editorconfig'
11+
- 'OpenApiCodeGenerator.slnx'
12+
- 'nuget.config'
13+
- '.github/workflows/build.yml'
14+
pull_request:
15+
branches: [ "main" ]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
env:
25+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v6
30+
31+
- name: Setup .NET
32+
uses: actions/setup-dotnet@v5
33+
with:
34+
dotnet-version: '10.0.x'
35+
cache: true
36+
cache-dependency-path: 'Directory.Packages.props'
37+
38+
- name: Restore dependencies
39+
run: dotnet restore
40+
41+
- name: Build
42+
run: dotnet build --no-restore --configuration Release
43+
44+
- name: Test
45+
run: dotnet test --no-build --configuration Release --verbosity normal

.github/workflows/docs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'docs/**'
8+
- '.github/workflows/docs.yml'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v6
26+
27+
- name: Install, build, and upload your site
28+
uses: withastro/action@v5
29+
with:
30+
path: docs
31+
node-version: 24
32+
package-manager: pnpm@latest
33+
build-cmd: pnpm run build
34+
35+
deploy:
36+
environment:
37+
name: github-pages
38+
url: ${{ steps.deployment.outputs.page_url }}
39+
runs-on: ubuntu-latest
40+
needs: build
41+
steps:
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release to NuGet
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v6
16+
17+
- name: Set VERSION variable from tag
18+
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v5
22+
with:
23+
dotnet-version: '10.0.x'
24+
cache: true
25+
cache-dependency-path: 'Directory.Packages.props'
26+
27+
- name: Restore dependencies
28+
run: dotnet restore
29+
30+
- name: Build
31+
run: dotnet build -c Release --no-restore /p:Version=${VERSION}
32+
33+
- name: Test
34+
run: dotnet test --no-build -c Release --verbosity normal /p:Version=${VERSION}
35+
36+
- name: Pack nugets
37+
run: dotnet pack -c Release --no-build --output ./releases /p:Version=${VERSION}
38+
working-directory: ./
39+
40+
- name: Push (Nikcio.OpenApiCodeGen) to NuGet
41+
run: dotnet nuget push "Nikcio.OpenApiCodeGen.${VERSION}.nupkg" --api-key ${{secrets.NUGET_API_TOKEN}} --source https://api.nuget.org/v3/index.json
42+
working-directory: ./releases

tests/OpenApiCodeGenerator.IntegrationTests/ApiDirectoryTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public ValueTask DisposeAsync()
4141
[MemberData(nameof(GetAllApis))]
4242
public async Task GenerateFromSpecAsync(string apiId, string specUrl)
4343
{
44+
ArgumentNullException.ThrowIfNull(apiId);
45+
4446
// Download spec
4547
using HttpResponseMessage response = await Http.GetAsync(specUrl, TestContext.Current.CancellationToken).ConfigureAwait(true);
4648
response.EnsureSuccessStatusCode();
@@ -85,12 +87,16 @@ private static List<ApiEntry> LoadApisSync()
8587
_initLock.Wait();
8688
try
8789
{
90+
#pragma warning disable CA1508 // Avoid dead conditional code
8891
if (_apis != null)
8992
{
9093
return _apis;
9194
}
95+
#pragma warning restore CA1508 // Avoid dead conditional code
9296

97+
#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits
9398
_apis = FetchApiListAsync().GetAwaiter().GetResult();
99+
#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits
94100
return _apis;
95101
}
96102
finally
@@ -109,7 +115,9 @@ private static async Task EnsureApisLoadedAsync()
109115
await _initLock.WaitAsync().ConfigureAwait(true);
110116
try
111117
{
118+
#pragma warning disable CA1508 // Avoid dead conditional code
112119
_apis ??= await FetchApiListAsync().ConfigureAwait(true);
120+
#pragma warning restore CA1508 // Avoid dead conditional code
113121
}
114122
finally
115123
{
@@ -175,5 +183,5 @@ private static string SanitizeFileName(string name)
175183
return new string(sanitized);
176184
}
177185

178-
private record ApiEntry(string Id, string SpecUrl);
186+
private sealed record ApiEntry(string Id, string SpecUrl);
179187
}

0 commit comments

Comments
 (0)