Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updating CICD and pkg/sdk/client files to integrate dotnet-client-sdk into dotnet-core repo #5

Merged
merged 5 commits into from
Jun 12, 2024
Merged
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
24 changes: 11 additions & 13 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,25 @@ runs:
- name: Setup dotnet build tools
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0
dotnet-version: |
6.0
7.0

- name: Restore Dependencies
shell: bash
run: dotnet restore ${{ inputs.project_file }}

- name: Build for NetStandard2.0
- name: Restore Workloads
shell: bash
run: dotnet build -p:Configuration=debug -p:TargetFramework=netstandard2.0 ${{ inputs.project_file }}
run: dotnet workload restore ${{ inputs.project_file }}

- name: Build for Net6
- name: Restore Dependencies
shell: bash
run: dotnet build -p:Configuration=debug -p:TargetFramework=net6.0 ${{ inputs.project_file }}
run: dotnet restore ${{ inputs.project_file }}

- name: Build for Net462
- name: Build
shell: bash
run: dotnet build -p:Configuration=debug -p:TargetFramework=net462 ${{ inputs.project_file }}
run: dotnet build -p:Configuration=debug ${{ inputs.project_file }}

- name: Run Unit Tests for Net6
- name: Run Unit Tests
if: ${{ inputs.test_project_file != '' }}
shell: bash
run: |
dotnet restore ${{ inputs.test_project_file }}
dotnet test --framework=net6.0 ${{ inputs.test_project_file }}
dotnet test --framework=net6.0 ${{ inputs.test_project_file }}
1 change: 1 addition & 0 deletions .github/actions/contract-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ runs:
uses: launchdarkly/gh-actions/actions/[email protected]
with:
test_service_port: 8000
extra_params: '--status-timeout=120'
token: ${{ inputs.token }}
48 changes: 48 additions & 0 deletions .github/workflows/sdk-client-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: LaunchDarkly.ClientSdk CI
on:
push:
branches: [main, 'feat/**']
paths-ignore:
- '**.md' # Do not need to run CI for markdown changes.
pull_request:
branches: [main, 'feat/**']
paths-ignore:
- '**.md'

jobs:
build-and-test:
strategy:
matrix:
# TODO: Figure out mechanism to skip iOS framework on ubuntu and windows and re-add ubuntu and windows
os: [macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: Get secrets
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}

- name: Download snk
shell: bash
run: aws s3 cp s3://launchdarkly-releaser/dotnet/LaunchDarkly.ClientSdk.snk LaunchDarkly.ClientSdk.snk

- uses: ./.github/actions/ci
with:
project_file: pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj
test_project_file: pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj

- uses: ./.github/actions/contract-tests
with:
service_project_file: pkgs/sdk/client/contract-tests/TestService.csproj
service_dll_file: pkgs/sdk/client/contract-tests/bin/debug/net7.0/ContractTestService.dll
token: ${{ secrets.GITHUB_TOKEN }}

- uses: ./.github/actions/build-docs
with:
workspace_path: pkgs/sdk/client
9 changes: 9 additions & 0 deletions .github/workflows/sdk-server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: Get secrets
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}

- uses: ./.github/actions/ci
with:
project_file: pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/telemetry-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4

- uses: launchdarkly/gh-actions/actions/[email protected]
name: Get secrets
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}

- uses: ./.github/actions/ci
with:
project_file: pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj
Expand Down
8 changes: 8 additions & 0 deletions .sdk_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
"introduced": "8.3"
}
}
},
"dotnet-client-sdk": {
"name": ".NET Client SDK",
"type": "client-side",
"path": "pkgs/sdk/client",
"languages": [
"C#"
]
}
}
}
602 changes: 0 additions & 602 deletions CHANGELOG.md

This file was deleted.

69 changes: 3 additions & 66 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,15 @@
# Contributing to the LaunchDarkly Server-Side SDK for .NET
# Contributing to the LaunchDarkly .NET Core repository

LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.

## Submitting bug reports and feature requests

The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/dotnet-server-sdk/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/dotnet-core/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.

## Submitting pull requests

We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.

## Build instructions

### Prerequisites

To set up your SDK build time environment, you must [download .NET development tools and follow the instructions](https://dotnet.microsoft.com/download). .NET 5.0 is preferred, since the .NET 5.0 tools are able to build for all supported target platforms.

This SDK shares part of its implementation and public API with the [Xamarin SDK](https://github.com/launchdarkly/xamarin-client-sdk). The shared code is in two other packages:

* `LaunchDarkly.CommonSdk` (in [`launchdarkly/dotnet-sdk-common`](https://github.com/launchdarkly/dotnet-sdk-common): Types such as `User` that are part of the SDK's public API, but are not specific to server-side or client-side use.
* `LaunchDarkly.InternalSdk` (in [`launchdarkly/dotnet-sdk-internal`](https://github.com/launchdarkly/dotnet-sdk-internal): Support code that is not part of the SDK's public API, such as the implementation of analytics event processing. These types are public in order to be usable from outside of their assembly, but they are not included in the SDK's public API or documentation.

Other support code is in the packages [`LaunchDarkly.EventSource`](https://github.com/launchdarkly/dotnet-eventsource) and [`LaunchDarkly.Logging`](https://github.com/launchdarkly/dotnet-logging).

### Building

To install all required packages:

```bash
dotnet restore
```

Then, to build the SDK for all target frameworks:

```bash
dotnet build src/LaunchDarkly.ServerSdk
```

Or, in Linux:

```bash
make
```

Or, to build for only one target framework (in this example, .NET Standard 2.0):

```bash
dotnet build src/LaunchDarkly.ServerSdk -f netstandard2.0
```

### Testing

To run all unit tests:

```bash
dotnet test test/LaunchDarkly.ServerSdk.Tests/LaunchDarkly.ServerSdk.Tests.csproj
```

Or, in Linux:

```bash
make test
```

Note that the unit tests can only be run in Debug configuration. There is an `InternalsVisibleTo` directive that allows the test code to access internal members of the library, and assembly strong-naming in the Release configuration interferes with this.

To run the SDK contract test suite in Linux (see [`contract-tests/README.md`](./contract-tests/README.md)):

```bash
make contract-tests
```

## Documentation in code

All public types, methods, and properties should have documentation comments in the standard C# XML comment format. These will be automatically included in the [HTML documentation](https://launchdarkly.github.io/dotnet-server-sdk) that is generated on release; this process also uses additional Markdown content from the `docs-src/` subdirectory.

See [`docs-src/README.md`](./docs-src/README.md) for more details.
Build instructions for a package can be found in the package's source directory.
69 changes: 20 additions & 49 deletions README.md
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This README.md is the dotnet-server-sdk README. It was copied to pkgs/sdk/server/README.md and then this README.md was gutted/edited to fit the needs of the entire repo.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# LaunchDarkly Server-Side SDK for .NET
# LaunchDarkly monorepo for .NET SDKs and C# libs.

The LaunchDarkly Server-Side SDK for .NET is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.

For using LaunchDarkly in *client-side* .NET applications, including mobile applications and desktop applications, refer to our [.NET Client SDK](https://github.com/launchdarkly/dotnet-client-sdk).
This repository contains LaunchDarkly SDK packages for usage in .NET.
This includes the SDKs, shared libraries, and other tools.

## Packages

| SDK Packages | NuGet | API Docs | Issues | Tests |
|-------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------|------------------------------------------------------------|
| [LaunchDarkly.ServerSdk](pkgs/sdk/server) | [![NuGet][server-nuget-badge]][server-nuget-link] | [![Documentation][api-docs-badge]][server-api-docs-link] | [Server SDK][server-issues] | [![Actions Status][server-ci-badge]][server-ci-link] |
| [LaunchDarkly.ClientSdk](pkgs/sdk/client) | [![NuGet][client-nuget-badge]][client-nuget-link] | [![Documentation][api-docs-badge]][client-api-docs-link] | [Client SDK][client-issues] | [![Actions Status][client-ci-badge]][client-ci-link] |

| Telemetry Packages | NuGet | API Docs | Issues | Tests |
|----------------------------------------------------|---------------------------------------------------------|-------------------------------------------------------------|-------------------------------|------------------------------------------------------------|
Expand All @@ -28,53 +28,17 @@ For using LaunchDarkly in *client-side* .NET applications, including mobile appl

[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)

## Supported .NET versions

This version of the SDK is built for the following targets:

* .NET 6.0: runs on .NET 6.0 and above (including higher major versions).
* .NET Framework 4.6.2: runs on .NET Framework 4.6.2 and above.
* .NET Standard 2.0: runs in any project that is targeted to .NET Standard 2.x rather than to a specific runtime platform.

The .NET build tools should automatically load the most appropriate build of the SDK for whatever platform your application or library is targeted to.

The only differences in the SDK between platforms are these:

* Setting a TCP connection timeout is only supported in .NET Core and .NET 6.0+. For more details, see `HttpConfigurationBuilder.ConnectTimeout`.
* The SDK requires the `System.Text.Json` API to be available; it is built into the standard runtime library in .NET Core and .NET 6.0+, but not on other platforms, so on other platforms the SDK brings in `System.Text.Json` as a NuGet package dependency.

## Getting started

Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/server-side/dotnet#getting-started) for instructions on getting started with using the SDK.

## Signing

The published version of this assembly is digitally signed with Authenticode and [strong-named](https://docs.microsoft.com/en-us/dotnet/framework/app-domains/strong-named-assemblies). Building the code locally in the default Debug configuration does not use strong-naming and does not require a key file. The public key file is in this repository at `LaunchDarkly.pk` as well as here:

```
Public Key:
0024000004800000940000000602000000240000525341310004000001000100f121bbf427e4d7
edc64131a9efeefd20978dc58c285aa6f548a4282fc6d871fbebeacc13160e88566f427497b625
56bf7ff01017b0f7c9de36869cc681b236bc0df0c85927ac8a439ecb7a6a07ae4111034e03042c
4b1569ebc6d3ed945878cca97e1592f864ba7cc81a56b8668a6d7bbe6e44c1279db088b0fdcc35
52f746b4

Public Key Token: f86add69004e6885
```

## Learn more

Read our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/server-side/dotnet).

The authoritative description of all types, properties, and methods is in the [generated API documentation](https://launchdarkly.github.io/dotnet-server-sdk/pkgs/sdk/server/).

## Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

## Contributing

We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK.
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this repository.

## About LaunchDarkly

Expand All @@ -93,16 +57,23 @@ We encourage pull requests and other contributions from the community. Check out

[server-nuget-badge]: https://img.shields.io/nuget/v/LaunchDarkly.ServerSdk.svg?style=flat-square
[server-nuget-link]: https://www.nuget.org/packages/LaunchDarkly.ServerSdk/
[server-ci-badge]: https://github.com/launchdarkly/dotnet-server-sdk/actions/workflows/sdk-server-ci.yml/badge.svg
[server-ci-link]: https://github.com/launchdarkly/dotnet-server-sdk/actions/workflows/sdk-server-ci.yml
[server-issues]: https://github.com/launchdarkly/dotnet-server-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+sdk%2Fserver%22+
[server-api-docs-link]: https://launchdarkly.github.io/dotnet-server-sdk/pkgs/sdk/server/
[server-ci-badge]: https://github.com/launchdarkly/dotnet-core/actions/workflows/sdk-server-ci.yml/badge.svg
[server-ci-link]: https://github.com/launchdarkly/dotnet-core/actions/workflows/sdk-server-ci.yml
[server-issues]: https://github.com/launchdarkly/dotnet-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+sdk%2Fserver%22+
[server-api-docs-link]: https://launchdarkly.github.io/dotnet-core/pkgs/sdk/server/

[client-nuget-badge]: https://img.shields.io/nuget/v/LaunchDarkly.ClientSdk.svg?style=flat-square
[client-nuget-link]: https://www.nuget.org/packages/LaunchDarkly.ClientSdk/
[client-ci-badge]: https://github.com/launchdarkly/dotnet-core/actions/workflows/sdk-client-ci.yml/badge.svg
[client-ci-link]: https://github.com/launchdarkly/dotnet-core/actions/workflows/sdk-client-ci.yml
[client-issues]: https://github.com/launchdarkly/dotnet-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+sdk%2Fclient%22+
[client-api-docs-link]: https://launchdarkly.github.io/dotnet-core/pkgs/sdk/client/

[telemetry-nuget-badge]: https://img.shields.io/nuget/v/LaunchDarkly.ServerSdk.Telemetry.svg?style=flat-square
[telemetry-nuget-link]: https://www.nuget.org/packages/LaunchDarkly.ServerSdk.Telemetry/
[telemetry-ci-badge]: https://github.com/launchdarkly/dotnet-server-sdk/actions/workflows/telemetry-ci.yml/badge.svg
[telemetry-ci-link]: https://github.com/launchdarkly/dotnet-server-sdk/actions/workflows/telemetry-ci.yml
[telemetry-issues]: https://github.com/launchdarkly/dotnet-server-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+telemetry%22+
[telemetry-api-docs-link]: https://launchdarkly.github.io/dotnet-server-sdk/pkgs/telemetry/
[telemetry-ci-badge]: https://github.com/launchdarkly/dotnet-core/actions/workflows/telemetry-ci.yml/badge.svg
[telemetry-ci-link]: https://github.com/launchdarkly/dotnet-core/actions/workflows/telemetry-ci.yml
[telemetry-issues]: https://github.com/launchdarkly/dotnet-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+telemetry%22+
[telemetry-api-docs-link]: https://launchdarkly.github.io/dotnet-core/pkgs/telemetry/

[api-docs-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
12 changes: 0 additions & 12 deletions pkgs/sdk/client/.sdk_metadata.json

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/sdk/client/CODEOWNERS

This file was deleted.

Loading
Loading