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: cleaning up github actions paths, fixing publish docs params #8

Merged
merged 17 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
2 changes: 1 addition & 1 deletion .github/actions/contract-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ runs:
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.2
with:
test_service_port: 8000
extra_params: '--status-timeout=120'
extra_params: '--status-timeout=360'
token: ${{ inputs.token }}
58 changes: 16 additions & 42 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
options:
- LaunchDarkly.ServerSdk
- LaunchDarkly.ServerSdk.Telemetry
- LaunchDarkly.ClientSdk
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
Expand All @@ -23,68 +24,41 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Using macos-latest since mac is the lowest common denominator for platforms that supports all the client SDK target frameworks.

permissions:
id-token: write
contents: write
outputs:
server-sdk-hashes: ${{ steps.server-sdk-release.outputs.hashes }}
telemetry-hashes: ${{ steps.telemetry-release.outputs.hashes }}
full-release-hashes: ${{ steps.full-release.outputs.hashes }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Commonizing

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/full-release
id: server-sdk-release
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk' }}

- uses: ./.github/actions/setup-env
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: ${{ inputs.dry_run }}
aws_role: ${{ vars.AWS_ROLE_ARN }}
token: ${{ secrets.GITHUB_TOKEN }}
pkg_name: ${{ inputs.pkg_name }}

- uses: ./.github/actions/full-release
id: telemetry-release
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' }}
id: full-release
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'
workspace_path: ${{ env.WORKSPACE_PATH }}
project_file: ${{ env.PROJECT_FILE }}
build_output_path: ${{ env.BUILD_OUTPUT_PATH }}
test_project_file: ${{ env.TEST_PROJECT_FILE }}
dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: the setup env action helps compartmentalize all the path strings

dry_run: ${{ inputs.dry_run }}
aws_role: ${{ vars.AWS_ROLE_ARN }}
token: ${{ secrets.GITHUB_TOKEN }}

release-sdk-server-provenance:
needs: ['build']
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
if: |
(inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) &&
inputs.pkg_name == 'LaunchDarkly.ServerSdk'
with:
base64-subjects: "${{ needs.build.outputs.server-sdk-hashes }}"
upload-assets: true
provenance-name: ${{ 'LaunchDarkly.ServerSdk_provenance.intoto.jsonl' }}


release-telemetry-server-provenance:
release-provenance:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commonizing

needs: ['build']
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
if: |
(inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) &&
inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry'
(inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main'))
with:
base64-subjects: "${{ needs.build.outputs.telemetry-hashes }}"
base64-subjects: "${{ needs.build.outputs.full-release-hashes }}"
upload-assets: true
provenance-name: ${{ 'LaunchDarkly.ServerSdk.Telemetry_provenance.intoto.jsonl' }}
provenance-name: ${{inputs.pkg_name}}_provenance.intoto.jsonl
47 changes: 17 additions & 30 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,44 @@
on:
workflow_dispatch:
inputs:
workspace_path:
description: 'Path to the workspace being released.'
pkg_name:
description: 'The package to publish'
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
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
type: choice
options:
- LaunchDarkly.ClientSdk
- LaunchDarkly.ServerSdk
- LaunchDarkly.ServerSdk.Telemetry
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: This gives a dropdown when triggering the action, a better user experience with less chance for errors.


name: Publish Docs
jobs:
build-publish:
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
contents: write # Needed in this case to write github pages.
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-env
with:
pkg_name: ${{ inputs.pkg_name }}

- id: build
name: Build and Test SDK
uses: ./.github/actions/ci
with:
project_file: ${{ inputs.project_file }}
test_project_file: ${{ inputs.test_project_file }}
project_file: ${{ env.PROJECT_FILE }}
test_project_file: ${{ env.TEST_PROJECT_FILE }}

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

- id: publish-docs
name: Publish Documentation
uses: ./.github/actions/publish-docs
with:
workspace_path: ${{ inputs.workspace_path }}
workspace_path: ${{ env.WORKSPACE_PATH }}
token: ${{secrets.GITHUB_TOKEN}}
91 changes: 67 additions & 24 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ on:

jobs:
release-please:
runs-on: ubuntu-latest
runs-on: macos-latest

outputs:
package-sdk-server-released: ${{ steps.release.outputs['pkgs/sdk/server--release_created'] }}
package-sdk-server-tag_name: ${{ steps.release.outputs['pkgs/sdk/server--tag_name'] }}
package-sdk-server-telemetry-released: ${{ steps.release.outputs['pkgs/telemetry--release_created'] }}
package-sdk-server-telemetry-tag_name: ${{ steps.release.outputs['pkgs/telemetry--tag_name'] }}
package-sdk-client-released: ${{ steps.release.outputs['pkgs/sdk/client--release_created'] }}
package-sdk-client-tag_name: ${{ steps.release.outputs['pkgs/sdk/client--tag_name'] }}
tag_name: ${{ steps.release.outputs.tag_name }}

steps:
Expand All @@ -24,7 +26,7 @@ jobs:
target-branch: ${{ github.ref_name }}

release-sdk-server:
runs-on: ubuntu-latest
runs-on: macos-latest
needs: release-please
permissions:
id-token: write
Expand All @@ -35,55 +37,94 @@ jobs:
hashes: ${{ steps.full-release.outputs.hashes }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-env
tanderson-ld marked this conversation as resolved.
Show resolved Hide resolved
with:
pkg_name: LaunchDarkly.ServerSdk

- uses: ./.github/actions/full-release
id: full-release
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'
workspace_path: ${{ env.WORKSPACE_PATH }}
project_file: ${{ env.PROJECT_FILE }}
build_output_path: ${{ env.BUILD_OUTPUT_PATH }}
test_project_file: ${{ env.TEST_PROJECT_FILE }}
dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }}
dry_run: false
aws_role: ${{ vars.AWS_ROLE_ARN }}
token: ${{ secrets.GITHUB_TOKEN }}

release-sdk-server-provenance:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Moved provenance tasks to the bottom for organization. Made the diff weird.

needs: ['release-please', 'release-sdk-server']
release-telemetry:
runs-on: macos-latest
needs: release-please
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
with:
base64-subjects: "${{ needs.release-sdk-server.outputs.hashes }}"
upload-assets: true
upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-tag_name }}
provenance-name: ${{ format('LaunchDarkly.ServerSdk-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-tag_name) }}
pull-requests: write
if: ${{ needs.release-please.outputs.package-sdk-server-telemetry-released == 'true'}}
outputs:
hashes: ${{ steps.full-release.outputs.hashes }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-env
with:
pkg_name: LaunchDarkly.ServerSdk.Telemetry

release-telemetry:
runs-on: ubuntu-latest
- uses: ./.github/actions/full-release
id: full-release
with:
workspace_path: ${{ env.WORKSPACE_PATH }}
project_file: ${{ env.PROJECT_FILE }}
build_output_path: ${{ env.BUILD_OUTPUT_PATH }}
test_project_file: ${{ env.TEST_PROJECT_FILE }}
dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }}
dry_run: false
aws_role: ${{ vars.AWS_ROLE_ARN }}
token: ${{ secrets.GITHUB_TOKEN }}

release-sdk-client:
runs-on: macos-latest
needs: release-please
permissions:
id-token: write
contents: write
pull-requests: write
if: ${{ needs.release-please.outputs.package-sdk-server-telemetry-released == 'true'}}
if: ${{ needs.release-please.outputs.package-sdk-client-released == 'true'}}
outputs:
hashes: ${{ steps.full-release.outputs.hashes }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-env
with:
pkg_name: LaunchDarkly.ClientSdk

- uses: ./.github/actions/full-release
id: full-release
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'
workspace_path: ${{ env.WORKSPACE_PATH }}
project_file: ${{ env.PROJECT_FILE }}
build_output_path: ${{ env.BUILD_OUTPUT_PATH }}
test_project_file: ${{ env.TEST_PROJECT_FILE }}
dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }}
dry_run: false
aws_role: ${{ vars.AWS_ROLE_ARN }}
token: ${{ secrets.GITHUB_TOKEN }}

# TODO: refactor provenance
release-sdk-server-provenance:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Moved provenance tasks to the bottom for organization. Made the diff weird.

needs: ['release-please', 'release-sdk-server']
permissions:
actions: read
id-token: write
contents: write
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
with:
base64-subjects: "${{ needs.release-sdk-server.outputs.hashes }}"
upload-assets: true
upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-tag_name }}
provenance-name: ${{ format('LaunchDarkly.ServerSdk-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-tag_name) }}


release-telemetry-provenance:
needs: ['release-please', 'release-telemetry']
permissions:
Expand All @@ -96,3 +137,5 @@ jobs:
upload-assets: true
upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-telemetry-tag_name }}
provenance-name: ${{ format('LaunchDarkly.ServerSdk.Telemetry-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-telemetry-tag_name) }}

# TODO: add client provenance
17 changes: 11 additions & 6 deletions .github/workflows/sdk-client-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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 }}
Expand All @@ -23,6 +22,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Env from project's Env file
shell: bash
run: set -o allexport && source pkgs/sdk/client/github_actions.env && set +o allexport

- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1
name: Get secrets
with:
Expand All @@ -34,15 +37,17 @@ jobs:

- 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
project_file: ${{ env.PROJECT_FILE}}
test_project_file: ${{ env.TEST_PROJECT_FILE}}

- 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
service_project_file: ${{ env.CONTRACT_TEST_PROJECT_FILE}}
service_dll_file: ${{ env.CONTRACT_TEST_DLL_FILE}}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: ./.github/actions/build-docs
with:
workspace_path: pkgs/sdk/client
workspace_path: ${{ env.WORKSPACE_PATH}}

# TODO: resolve issue with emulator and device tests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: This is an existing TODO in the client-sdk repo that I am migrating here so we don't forget about it.

14 changes: 9 additions & 5 deletions .github/workflows/sdk-server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,26 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Env from project's Env file
shell: bash
run: set -o allexport && source pkgs/sdk/server/github_actions.env && set +o allexport

- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1
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
test_project_file: pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj
project_file: ${{ env.PROJECT_FILE}}
test_project_file: ${{ env.TEST_PROJECT_FILE}}

- uses: ./.github/actions/contract-tests
with:
service_project_file: pkgs/sdk/server/contract-tests/TestService.csproj
service_dll_file: pkgs/sdk/server/contract-tests/bin/debug/net6.0/ContractTestService.dll
service_project_file: ${{ env.CONTRACT_TEST_PROJECT_FILE}}
service_dll_file: ${{ env.CONTRACT_TEST_DLL_FILE}}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: ./.github/actions/build-docs
with:
workspace_path: pkgs/sdk/server
workspace_path: ${{ env.WORKSPACE_PATH}}
Loading
Loading