Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
ci: Adds LaunchDarkly.ServerSdk.Telemetry package and associated GA r…
Browse files Browse the repository at this point in the history
…eorganization (#195)

Adds LaunchDarkly.ServerSdk.Telemetry package and associated
reorganization of Github Actions and Release Please configuration to
support releasing multiple packages from this repository.
  • Loading branch information
tanderson-ld authored Apr 22, 2024
1 parent 5932385 commit 98fc994
Show file tree
Hide file tree
Showing 254 changed files with 726 additions and 367 deletions.
24 changes: 17 additions & 7 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: Build Documentation
description: 'Build Documentation.'
inputs:
workspace_path:
description: 'Path to the workspace.'
required: true

runs:
using: composite
steps:
- name: Setup dotnet build tools
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0
- name: Install docfx
shell: bash
run: dotnet tool update -g docfx
- name: Run docfx metadata
shell: bash
run: docfx metadata
- name: Run docfx build

# Note: in the docfx.json file, the 'Configuration' property is set to Debug so that we don't require
# signing to happen just to build docs.
- name: Build docs
shell: bash
# Note: in the docfx.json file, the 'Configuration' property is set to Debug so that we don't require
# signing to happen just to build docs.
run: docfx build
run: |
pushd ${{ inputs.workspace_path }}
docfx metadata
docfx build
popd
6 changes: 5 additions & 1 deletion .github/actions/build-release/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build Action
description: 'Dotnet Server SDK Build action.'
inputs:
project_file:
description: 'Path to the project file.'
required: true

runs:
using: composite
Expand All @@ -15,4 +19,4 @@ runs:

- name: Build
shell: bash
run: dotnet build /p:Configuration=Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
run: dotnet build /p:Configuration=Release ${{ inputs.project_file }}
48 changes: 12 additions & 36 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
name: CI
description: Runs CI for the .NET Server SDK
inputs:
run_tests:
description: 'If true, run unit tests, otherwise skip them.'
project_file:
description: 'Path to the project file.'
required: true
test_project_file:
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
required: false
default: 'true'
run_contract_tests:
description: 'If true, run contract tests, otherwise skip them.'
required: false
default: 'true'
aws_role_arn:
description: 'The ARN of the role to assume for downloading secrets, used for building docs.'
required: false
default: ''
token:
description: 'Github token, used for contract tests'
required: false
default: ''

runs:
using: composite
Expand All @@ -28,41 +22,23 @@ runs:

- name: Restore Dependencies
shell: bash
run: dotnet restore src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
run: dotnet restore ${{ inputs.project_file }}

- name: Build for NetStandard2.0
shell: bash
run: dotnet build -p:Configuration=debug -p:TargetFramework=netstandard2.0 src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
run: dotnet build -p:Configuration=debug -p:TargetFramework=netstandard2.0 ${{ inputs.project_file }}

- name: Build for Net6
shell: bash
run: dotnet build -p:Configuration=debug -p:TargetFramework=net6.0 src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
run: dotnet build -p:Configuration=debug -p:TargetFramework=net6.0 ${{ inputs.project_file }}

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

- name: Run Unit Tests for Net6
if: ${{ inputs.run_tests == 'true' }}
if: ${{ inputs.test_project_file != '' }}
shell: bash
run: |
dotnet restore test/LaunchDarkly.ServerSdk.Tests
dotnet test --framework=net6.0 test/LaunchDarkly.ServerSdk.Tests/LaunchDarkly.ServerSdk.Tests.csproj
- name: Build Contract Tests
if: ${{ inputs.run_contract_tests == 'true' }}
shell: bash
run: dotnet build /p:Configuration=debug contract-tests/TestService.csproj

- name: Launch Contract Tests
if: ${{ inputs.run_contract_tests == 'true' }}
id: launch-contract-tests
shell: bash
run: dotnet contract-tests/bin/debug/net6.0/ContractTestService.dll > test-service.log 2>&1 & disown

- name: Run Contract Tests
if: ${{ inputs.run_contract_tests == 'true' }}
uses: launchdarkly/gh-actions/actions/[email protected]
with:
test_service_port: 8000
token: ${{ inputs.token }}
dotnet restore ${{ inputs.test_project_file }}
dotnet test --framework=net6.0 ${{ inputs.test_project_file }}
36 changes: 36 additions & 0 deletions .github/actions/contract-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Contract Tests
description: Runs CI for the .NET Server SDK
inputs:
service_project_file:
description: 'Path to the contract test service project file.'
required: true
service_dll_file:
description: 'Path where compiled dll will be found.'
required: true
token:
description: 'Github token, used for contract tests'
required: false
default: ''

runs:
using: composite
steps:
- name: Setup dotnet build tools
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0

- name: Build Contract Tests
shell: bash
run: dotnet build /p:Configuration=debug ${{ inputs.service_project_file }}

- name: Launch Contract Tests
id: launch-contract-tests
shell: bash
run: dotnet ${{ inputs.service_dll_file }} > test-service.log 2>&1 & disown

- name: Run Contract Tests
uses: launchdarkly/gh-actions/actions/[email protected]
with:
test_service_port: 8000
token: ${{ inputs.token }}
70 changes: 70 additions & 0 deletions .github/actions/full-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build, Test, and Publish
description: 'Execute the full release process for a workspace.'
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
project_file:
description: 'Path to the project file.'
required: true
test_project_file:
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
required: false
build_output_path:
description: 'Build output path.'
required: true
dll_name:
description: 'Build output dll name.'
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

runs:
using: composite
steps:
- name: CI check
uses: ./.github/actions/ci
with:
project_file: ${{ inputs.project_file }}
test_project_file: ${{ inputs.test_project_file }}
run_contract_tests: false

- uses: launchdarkly/gh-actions/actions/[email protected]
name: Get secrets
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/digicert/host = DIGICERT_HOST,
/production/common/releasing/digicert/api_key = DIGICERT_API_KEY,
/production/common/releasing/digicert/client_cert_file_b64 = DIGICERT_CLIENT_CERT_FILE_B64,
/production/common/releasing/digicert/client_cert_password = DIGICERT_CLIENT_CERT_PASSWORD,
/production/common/releasing/digicert/code_signing_cert_sha1_hash = DIGICERT_CODE_SIGNING_CERT_SHA1_HASH'
s3_path_pairs: 'launchdarkly-releaser/dotnet/LaunchDarkly.snk = LaunchDarkly.snk'

- name: Release build
uses: ./.github/actions/build-release
with:
project_file: pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj

- name: Sign DLLs
uses: launchdarkly/gh-actions/actions/[email protected]
with:
build_output_path: ${{ inputs.build_output_path }}
dll_name: ${{ inputs.dll_name }}

- name: Publish Nupkg
uses: ./.github/actions/publish-package
with:
dry_run: ${{ inputs.dry_run }}

- name: Build Documentation
uses: ./.github/actions/build-docs
with:
workspace_path: ${{ inputs.workspace_path }}

- name: Publish Documentation
uses: ./.github/actions/publish-docs
with:
workspace_path: ${{ inputs.workspace_path }}
token: ${{secrets.GITHUB_TOKEN}}
5 changes: 4 additions & 1 deletion .github/actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Documentation
description: 'Publish the documentation to Github pages'
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
token:
description: 'Token to use for publishing.'
required: true
Expand All @@ -11,5 +14,5 @@ runs:
- uses: launchdarkly/gh-actions/actions/[email protected]
name: 'Publish to Github pages'
with:
docs_path: docs
docs_path: ${{ inputs.workspace_path }}/docs
github_token: ${{ inputs.token }}
5 changes: 4 additions & 1 deletion .github/actions/publish-package/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Package
description: 'Packs DLLs into unsigned Nuget package and publishes to Nuget.'
inputs:
project_file:
description: 'Path to the project file.'
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true
Expand All @@ -12,7 +15,7 @@ runs:
shell: bash
run: |
dotnet restore
dotnet pack --no-build --output nupkgs --configuration Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
dotnet pack --no-build --output nupkgs --configuration Release ${{ inputs.project_file }}
- name: Publish Package
if: ${{ inputs.dry_run == 'false' }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Manual Publish Package
on:
workflow_dispatch:
inputs:
pkg_name:
description: 'The package to publish'
required: true
type: choice
options:
- LaunchDarkly.ServerSdk
- LaunchDarkly.ServerSdk.Telemetry
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: ./.github/workflows/full-release.yml
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk' }}
with:
workspace_path: 'pkgs/sdk/server'
project_file: 'pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj'
test_project_file: 'pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj'
build_output_path: 'pkgs/sdk/server/src/bin/Release/'
dll_name: 'LaunchDarkly.ServerSdk.dll'
dry_run: false

- uses: ./.github/workflows/full-release.yml
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' }}
with:
workspace_path: 'pkgs/telemetry'
project_file: 'pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj'
test_project_file: 'pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj'
build_output_path: 'pkgs/telemetry/src/bin/Release/'
dll_name: 'LaunchDarkly.ServerSdk.Telemetry.dll'
dry_run: false
42 changes: 40 additions & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
on:
workflow_dispatch:
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
type: string
project_file:
description: 'Path to the project file.'
required: true
type: string
test_project_file:
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
required: false
type: string
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true
workflow_call:
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
type: string
project_file:
description: 'Path to the project file.'
required: true
type: string
test_project_file:
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
required: false
type: string
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

name: Publish Docs
jobs:
Expand All @@ -14,15 +48,19 @@ jobs:
name: Build and Test
uses: ./.github/actions/ci
with:
run_tests: true
run_contract_tests: false
project_file: pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj
test_project_file: pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj
token: ${{ secrets.GITHUB_TOKEN }}

- id: build-docs
name: Build Documentation
uses: ./.github/actions/build-docs
with:
workspace_path: ${{ inputs.workspace_path }}

- id: publish
name: Publish Documentation
uses: ./.github/actions/publish-docs
with:
workspace_path: ${{ inputs.workspace_path }}
token: ${{secrets.GITHUB_TOKEN}}
Loading

0 comments on commit 98fc994

Please sign in to comment.