Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .buildkite/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
key: "ruby",
sdk_label: "sdk-ruby",
app_label: "app-ruby"
},
{
icon: ":csharp:",
label: "C#",
key: "csharp",
sdk_label: "sdk-csharp",
app_label: "app-csharp"
}
]

Expand Down
13 changes: 11 additions & 2 deletions .buildkite/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"GITHUB_TOKEN",
"NPM_TOKEN",
"PYPI_TOKEN",
"GEM_HOST_API_KEY"
"GEM_HOST_API_KEY",
"NUGET_API_KEY"
]
}},
{ "rubygems-oidc#v0.2.0": { role: "rg_oidc_akr_emf87k6zphtb7x7adyrk" } },
Expand All @@ -22,7 +23,8 @@
parameters: {
NPM_TOKEN: "/prod/buildkite-sdk/npm-token",
PYPI_TOKEN: "/prod/buildkite-sdk/pypi-token",
GITHUB_TOKEN: "/prod/buildkite-sdk/github-token"
GITHUB_TOKEN: "/prod/buildkite-sdk/github-token",
NUGET_API_KEY: "/prod/buildkite-sdk/nuget-api-key"
}
}}
]
Expand Down Expand Up @@ -79,6 +81,13 @@
key: "ruby",
sdk_label: "sdk-ruby",
app_label: "app-ruby"
},
{
icon: ":csharp:",
label: "C#",
key: "csharp",
sdk_label: "sdk-csharp",
app_label: "app-csharp"
}
]

Expand Down
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ __pycache__
/coverage
/reports

# C# build artifacts
bin/
obj/
*.user
*.suo
*.sln.cache
*.userprefs
*.pidb
*.userprefs
*.sln.ide
*.nupkg
*.snupkg
apps/csharp/bin/
apps/csharp/obj/
sdk/csharp/bin/
sdk/csharp/obj/

# C# DocFX documentation artifacts
sdk/csharp/api/
sdk/csharp/_site/

node_modules
dist
out
Expand All @@ -21,5 +42,20 @@ tmp

Gemfile.lock

# Generated schema and environment files (regenerated by gen-types.js)
sdk/typescript/src/schema.ts
sdk/python/src/buildkite_sdk/schema.py
sdk/go/sdk/schema/schema.go
sdk/ruby/lib/schema.rb
sdk/csharp/src/Buildkite.Sdk/Schema.cs
sdk/typescript/src/environment.ts
sdk/python/src/buildkite_sdk/environment.py
sdk/go/sdk/buildkite/environment.go
sdk/ruby/lib/environment.rb
sdk/csharp/src/Buildkite.Sdk/Environment.cs

# Auto-generated solution file
*.sln

.DS_Store
Thumbs.db
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN curl https://mise.run | sh
RUN mise install node@latest && mise use --global node@latest
RUN mise install python@latest && mise use --global python@latest
RUN mise install go@latest && mise use --global go@latest
RUN mise install dotnet@latest && mise use --global dotnet@latest

# Install Python tools.
RUN pip install --no-cache-dir uv black
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A multi-language SDK for [Buildkite](https://buildkite.com)! 🪁

Consumes the [Buildkite pipeline schema](https://github.com/buildkite/pipeline-schema) and generates and publishes packages for TypeScript or JavaScript, Python, Go, and Ruby.
Consumes the [Buildkite pipeline schema](https://github.com/buildkite/pipeline-schema) and generates and publishes packages for TypeScript or JavaScript, Python, Go, Ruby, and C#.

## Installing and using the SDKs

Expand All @@ -16,9 +16,10 @@ Learn more about how to set up the Buildkite SDK for each langauge, and use it t

To work on the SDK, you'll need current versions of the following tools:

- [Node.js](https://nodejs.org/en/download), [Python](https://www.python.org/downloads/), [Go](https://go.dev/doc/install), [Ruby](https://www.ruby-lang.org/en/documentation/installation/)
- [Node.js](https://nodejs.org/en/download), [Python](https://www.python.org/downloads/), [Go](https://go.dev/doc/install), [Ruby](https://www.ruby-lang.org/en/documentation/installation/), [.NET](https://dotnet.microsoft.com/download)
- For Python: [uv](https://docs.astral.sh/uv/), [Black](https://black.readthedocs.io/en/stable/)
- For Ruby: [Bundler](https://bundler.io/)
- For C#: [.NET SDK](https://dotnet.microsoft.com/download)

See `mise.toml` for details. (We also recommend [Mise](https://mise.jdx.dev/) for tool-version management.) If you're on a Mac, and you use [Homebrew](https://brew.sh/), you can run `brew bundle` and `mise install` to get all you need:

Expand Down Expand Up @@ -121,14 +122,16 @@ All SDKs version on the same cadence. To publish a new version (of all SDKs), fo
- https://pypi.org/project/buildkite-sdk/
- https://pkg.go.dev/github.com/buildkite/buildkite-sdk/sdk/go (this usually takes a minute or two)
- https://rubygems.org/gems/buildkite-sdk
- https://www.nuget.org/packages/Buildkite.Sdk

### Required environment variables

The following environment variables are required for releasing and publishing:

- `GITHUB_TOKEN` for creating GitHub releases (with `@octokit/rest`)
- `NPM_TOKEN` for publishing to npm (with `npm publish`)
- `PYPI_TOKEN` fror publishing to PyPI (with `uv publish`)
- `PYPI_TOKEN` for publishing to PyPI (with `uv publish`)
- `GEM_HOST_API_KEY` for publishing to RubyGems (with `gem push`)
- `NUGET_API_KEY` for publishing to NuGet (with `dotnet nuget push`)

See the `publish:all` and `release:all` tasks in `./project.json` for details.
10 changes: 10 additions & 0 deletions apps/csharp/App.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../sdk/csharp/Buildkite.Sdk.csproj" />
</ItemGroup>
</Project>
20 changes: 20 additions & 0 deletions apps/csharp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.IO;
using System.Net;
using Buildkite.Sdk;

var pipeline = new Pipeline();

pipeline.AddStep(new CommandStep
{
Label = "some-label",
Command = "echo 'Hello, world!'"
});

Directory.CreateDirectory("../../out/apps/csharp");

var json = pipeline.ToJson();
File.WriteAllText("../../out/apps/csharp/pipeline.json", json);

var yaml = pipeline.ToYaml();
File.WriteAllText("../../out/apps/csharp/pipeline.yaml", yaml);
59 changes: 59 additions & 0 deletions apps/csharp/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "app-csharp",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/csharp",
"projectType": "application",
"tags": [],
"targets": {
"install": {
"executor": "nx:run-commands",
"options": {
"commands": ["dotnet restore"],
"cwd": "apps/csharp"
}
},
"clean": {
"executor": "nx:run-commands",
"options": {
"commands": ["dotnet clean", "rimraf bin", "rimraf obj"],
"cwd": "apps/csharp"
},
"cache": false
},
"format": {
"executor": "nx:run-commands",
"options": {
"commands": ["dotnet format"],
"cwd": "apps/csharp"
},
"cache": false
},
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/apps/csharp"],
"options": {
"commands": [
"rimraf ../../dist/apps/csharp",
"mkdir -p ../../dist/apps/csharp",
"dotnet build --configuration Release --output ../../dist/apps/csharp"
],
"cwd": "apps/csharp",
"parallel": false
},
"cache": false
},
"run": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"commands": ["dotnet run"],
"cwd": "apps/csharp"
}
},
"test": {
"options": {
"passWithNoTests": true
}
}
}
}
7 changes: 3 additions & 4 deletions infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ const errorDocument = config.require("errorDocument");
// Create an S3 bucket to hold the docs.
const bucket = new aws.s3.BucketV2("bucket", {
tags: {
Name: 'bk-sdk-docs-bucket',
CostBucket: 'marketing-site',
VantaNoAlert: 'Bucket intentionally public',
Name: "bk-sdk-docs-bucket",
CostBucket: "marketing-site",
VantaNoAlert: "Bucket intentionally public",
},
});


const bucketWebsite = new aws.s3.BucketWebsiteConfigurationV2(
"bucket-website",
{
Expand Down
1 change: 1 addition & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node = "latest"
python = "latest"
go = "latest"
ruby = "latest"
dotnet = "9.0"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "nx test:all",
"build": "nx build:all",
"docs": "nx docs:all",
"docs:serve": "nx run-many --parallel --target 'docs:serve' --projects 'sdk-typescript,sdk-python,sdk-ruby' --output-style 'stream'",
"docs:serve": "nx run-many --parallel --target 'docs:serve' --projects 'sdk-typescript,sdk-python,sdk-ruby,sdk-csharp' --output-style 'stream'",
"docs:publish": "nx docs:publish",
"apps": "nx run:all",
"publish": "nx publish:all",
Expand Down
24 changes: 18 additions & 6 deletions project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"app-python:install",
"app-go:install",
"app-ruby:install",
"app-csharp:install",
"sdk-typescript:install",
"sdk-python:install",
"sdk-go:install",
"sdk-ruby:install",
"sdk-csharp:install",
"infra:install"
]
},
Expand All @@ -29,10 +31,12 @@
"app-python:clean",
"app-go:clean",
"app-ruby:clean",
"app-csharp:clean",
"sdk-typescript:clean",
"sdk-python:clean",
"sdk-go:clean",
"sdk-ruby:clean"
"sdk-ruby:clean",
"sdk-csharp:clean"
]
},
"format:all": {
Expand All @@ -45,6 +49,7 @@
"sdk-python:format",
"sdk-go:format",
"sdk-ruby:format",
"sdk-csharp:format",
"infra:format"
]
},
Expand Down Expand Up @@ -78,7 +83,8 @@
"sdk-typescript:build",
"sdk-python:build",
"sdk-go:build",
"sdk-ruby:build"
"sdk-ruby:build",
"sdk-csharp:build"
]
},
"test:all": {
Expand All @@ -87,16 +93,20 @@
"sdk-python:test",
"sdk-go:test",
"sdk-ruby:test",
"sdk-csharp:test",
"app-typescript:test",
"app-python:test",
"app-go:test"
"app-go:test",
"app-ruby:test",
"app-csharp:test"
]
},
"docs:all": {
"dependsOn": [
"sdk-typescript:docs:build",
"sdk-python:docs:build",
"sdk-ruby:docs:build"
"sdk-ruby:docs:build",
"sdk-csharp:docs:build"
]
},
"docs:publish:preview": {
Expand All @@ -118,15 +128,17 @@
"app-typescript:run",
"app-python:run",
"app-go:run",
"app-ruby:run"
"app-ruby:run",
"app-csharp:run"
]
},
"publish:all": {
"dependsOn": [
"sdk-typescript:publish",
"sdk-python:publish",
"sdk-go:publish",
"sdk-ruby:publish"
"sdk-ruby:publish",
"sdk-csharp:publish"
]
},
"rebuild:all": {
Expand Down
12 changes: 12 additions & 0 deletions sdk/csharp/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"docfx": {
"version": "2.75.3",
"commands": [
"docfx"
]
}
}
}
Loading