Skip to content

Commit

Permalink
ci: switch to Github Actions and Release Please (#191)
Browse files Browse the repository at this point in the history
This PR synchronizes this repo with the private mirror.

---------

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
  • Loading branch information
cwaldren-ld and kinyoklion authored Apr 16, 2024
1 parent 63aca18 commit 3b62c89
Show file tree
Hide file tree
Showing 25 changed files with 452 additions and 179 deletions.
167 changes: 0 additions & 167 deletions .circleci/config.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build Documentation
description: 'Build Documentation.'

runs:
using: composite
steps:
- name: Install docfx
shell: bash
run: dotnet tool update -g docfx
- name: Run docfx metadata
shell: bash
run: docfx metadata
- name: Run docfx build
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
18 changes: 18 additions & 0 deletions .github/actions/build-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build Action
description: 'Dotnet Server SDK Build action.'

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

- name: Display dotnet version
shell: bash
run: dotnet --version

- name: Build
shell: bash
run: dotnet build /p:Configuration=Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
68 changes: 68 additions & 0 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI
description: Runs CI for the .NET Server SDK
inputs:
run_tests:
description: 'If true, 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
steps:
- name: Setup dotnet build tools
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0

- name: Restore Dependencies
shell: bash
run: dotnet restore src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj

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

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

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

- name: Run Unit Tests for Net6
if: ${{ inputs.run_tests == 'true' }}
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/contract-tests@contract-tests-v1.0.0
with:
test_service_port: 8000
token: ${{ inputs.token }}
15 changes: 15 additions & 0 deletions .github/actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish Documentation
description: 'Publish the documentation to Github pages'
inputs:
token:
description: 'Token to use for publishing.'
required: true

runs:
using: composite
steps:
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
name: 'Publish to Github pages'
with:
docs_path: docs
github_token: ${{ inputs.token }}
34 changes: 34 additions & 0 deletions .github/actions/publish-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish Package
description: 'Packs DLLs into unsigned Nuget package and publishes to Nuget.'
inputs:
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true

runs:
using: composite
steps:
- name: Create Nuget Package
shell: bash
run: |
dotnet restore
dotnet pack --no-build --output nupkgs --configuration Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
- name: Publish Package
if: ${{ inputs.dry_run == 'false' }}
shell: bash
run: |
for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do
echo "publishing ${pkg}"
dotnet nuget push "${pkg}" --api-key ${{ env.NUGET_API_KEY }} --source https://www.nuget.org
echo "published ${pkg}"
done
- name: Dry Run Publish
if: ${{ inputs.dry_run == 'true' }}
shell: bash
run: |
echo "This is a dry run and packages are not being published."
for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do
echo "detected package ${pkg}"
done
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 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:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
run_tests: true
run_contract_tests: ${{ matrix.os != 'windows-latest' }}
token: ${{ secrets.GITHUB_TOKEN }}

build-docs:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-docs
12 changes: 12 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Lint PR title

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
lint-pr-title:
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main
Loading

0 comments on commit 3b62c89

Please sign in to comment.