Skip to content

Commit 6c35890

Browse files
authored
Merge branch 'main' into ta/O11Y-339/basic-android-obs-client-squash
2 parents 1f6e616 + c271dc8 commit 6c35890

File tree

108 files changed

+6530
-745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+6530
-745
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: 'Publish Python SDK'
2+
description: 'Build and publish Python SDK packages to PyPI'
3+
4+
inputs:
5+
workspace-path:
6+
description: 'Path to the Python SDK workspace'
7+
required: true
8+
default: 'sdk/@launchdarkly/observability-python'
9+
python-version:
10+
description: 'Python version to use'
11+
required: false
12+
default: '3.10'
13+
aws-role-arn:
14+
description: 'AWS role ARN for accessing secrets'
15+
required: true
16+
pypi-token-parameter:
17+
description: 'SSM parameter path for PyPI token'
18+
required: false
19+
default: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
20+
21+
outputs:
22+
package-hashes:
23+
description: 'Base64 encoded SHA256 hashes of published packages'
24+
value: ${{ steps.package-hashes.outputs.package-hashes }}
25+
26+
runs:
27+
using: 'composite'
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: ${{ inputs.python-version }}
36+
37+
- name: Install poetry
38+
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
39+
40+
- name: Get PyPI token
41+
uses: launchdarkly/gh-actions/actions/[email protected]
42+
with:
43+
aws_assume_role: ${{ inputs.aws-role-arn }}
44+
ssm_parameter_pairs: ${{ inputs.pypi-token-parameter }}
45+
46+
- name: Build Python plugin
47+
shell: bash
48+
working-directory: ${{ inputs.workspace-path }}
49+
run: |
50+
make build
51+
52+
- name: Hash build files for provenance
53+
id: package-hashes
54+
shell: bash
55+
working-directory: ${{ inputs.workspace-path }}/dist
56+
run: |
57+
echo "package-hashes=$(sha256sum * | base64 -w0)" >> "$GITHUB_OUTPUT"
58+
59+
- name: Publish package distributions to PyPI
60+
working-directory: ${{ inputs.workspace-path }}
61+
shell: bash
62+
run: |
63+
poetry config pypi-token.pypi ${{ env.PYPI_AUTH_TOKEN }}
64+
rm -rf dist
65+
poetry publish --build --no-interaction
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint PR title
2+
3+
permissions:
4+
contents: read
5+
pull-requests: read
6+
7+
on:
8+
pull_request_target:
9+
types:
10+
- opened
11+
- edited
12+
- synchronize
13+
14+
jobs:
15+
lint-pr-title:
16+
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main
Lines changed: 83 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
name: Manual Publish Docs
22
on:
33
workflow_dispatch:
4+
inputs:
5+
workspace_path:
6+
description: 'Path to the workspace being released.'
7+
required: true
8+
type: choice
9+
options:
10+
- sdk/highlight-run
11+
- 'sdk/@launchdarkly/observability-node'
12+
- 'sdk/@launchdarkly/observability-python'
13+
- 'sdk/@launchdarkly/observability-react-native'
14+
workflow_call:
15+
inputs:
16+
workspace_path:
17+
description: 'Path to the workspace being released.'
18+
required: true
19+
type: string
420

521
permissions:
6-
id-token: write
722
contents: write
823
concurrency: ${{ github.workflow }}-${{ github.ref }}
924
jobs:
@@ -14,23 +29,86 @@ jobs:
1429
uses: actions/checkout@v4
1530
- run: git submodule update --init --recursive
1631

32+
- name: Check if JS package
33+
id: check-js-package
34+
run: |
35+
if ./scripts/is-js-package.sh ${{ inputs.workspace_path }}; then
36+
echo "is_js_package=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "is_js_package=false" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Check if python package
42+
id: check-python-package
43+
run: |
44+
if ./scripts/is-python-package.sh ${{ inputs.workspace_path }}; then
45+
echo "is_python_package=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "is_python_package=false" >> $GITHUB_OUTPUT
48+
fi
49+
1750
- name: Setup Node.js environment
51+
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
1852
uses: actions/setup-node@v4
1953
with:
2054
node-version: lts/*
2155
cache: 'yarn'
2256

2357
- name: Install js dependencies
58+
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
2459
run: yarn install --mode=skip-build
2560
env:
2661
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
2762

28-
- name: Build docs
29-
run: yarn docs --filter highlight.run
63+
- name: 'Set WORKSPACE_NAME variable'
64+
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
65+
shell: bash
66+
run: |
67+
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
68+
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
69+
70+
- name: Build JS package docs
71+
if: ${{ steps.check-js-package.outputs.is_js_package == 'true' }}
72+
run: yarn docs --filter ${{ env.WORKSPACE_NAME }}
3073

31-
- uses: launchdarkly/gh-actions/actions/[email protected]
32-
name: 'Publish to Github pages'
74+
- uses: actions/setup-python@v5
75+
if: ${{ steps.check-python-package.outputs.is_python_package == 'true' }}
76+
with:
77+
python-version: '3.10'
78+
79+
- name: Install poetry
80+
if: ${{ steps.check-python-package.outputs.is_python_package == 'true' }}
81+
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
82+
83+
- name: Make Install
84+
# Assume non-js projects will use a Makefile to install dependencies.
85+
# Or an empty install target.
86+
if: ${{ steps.check-js-package.outputs.is_js_package == 'false' }}
87+
run: |
88+
cd ${{ inputs.workspace_path }}
89+
make install
90+
91+
- name: Build Makefile Docs
92+
# Assume non-js projects will use a Makefile to build docs.
93+
if: ${{ steps.check-js-package.outputs.is_js_package == 'false' }}
94+
run: |
95+
cd ${{ inputs.workspace_path }}
96+
make docs
97+
98+
- name: Publish Highlight.run as Observability Plugin
99+
if: inputs.workspace_path == 'sdk/highlight-run'
100+
uses: launchdarkly/gh-actions/actions/[email protected]
33101
with:
34102
docs_path: sdk/highlight-run/docs
35103
output_path: packages/@launchdarkly/observability
36104
github_token: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Publish Docs
107+
# This is generalized to work with any package, but we don't use it for highlight-run,
108+
# because we publish its docs to a different path.
109+
if: inputs.workspace_path != 'sdk/highlight-run'
110+
uses: launchdarkly/gh-actions/actions/[email protected]
111+
with:
112+
docs_path: ${{ inputs.workspace_path }}/docs
113+
output_path: ${{ inputs.workspace_path }}
114+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/manual-publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ on:
1818
description: 'Should release @launchdarkly/... packages.'
1919
type: boolean
2020
required: true
21+
release_launchdarkly_python:
22+
description: 'Should release @launchdarkly/observability-python package.'
23+
type: boolean
24+
required: true
25+
python_tag_name:
26+
description: 'The tag name for the python package. Should be set when publishing a python package.'
27+
type: string
28+
required: false
2129

2230
permissions:
2331
id-token: write
@@ -29,6 +37,7 @@ permissions:
2937
concurrency: ${{ github.workflow }}-${{ github.ref }}
3038
jobs:
3139
publish-package:
40+
if: ${{ inputs.release_highlight == true || inputs.release_launchdarkly == true }}
3241
runs-on: ubuntu-22.04-8core-32gb
3342
steps:
3443
- name: Checkout
@@ -83,3 +92,35 @@ jobs:
8392
env:
8493
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
8594
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry-run }}
95+
96+
publish-python-sdk:
97+
runs-on: ubuntu-latest
98+
if: ${{ inputs.release_launchdarkly_python == true }}
99+
permissions:
100+
id-token: write # Used for publishing secrets and documentation.
101+
outputs:
102+
package-hashes: ${{ steps.publish.outputs.package-hashes }}
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
- run: git submodule update --init --recursive
107+
108+
- name: Publish Python SDK
109+
id: publish
110+
uses: ./.github/actions/publish-python-sdk
111+
with:
112+
workspace-path: sdk/@launchdarkly/observability-python
113+
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
114+
115+
publish-python-provenance:
116+
needs: ['publish-python-sdk']
117+
if: ${{ inputs.release_launchdarkly_python == true }}
118+
permissions:
119+
actions: read
120+
id-token: write
121+
contents: write
122+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
123+
with:
124+
base64-subjects: '${{ needs.publish-python-sdk.outputs.package-hashes }}'
125+
upload-assets: true
126+
upload-tag-name: ${{ inputs.python_tag_name }}

.github/workflows/publish-docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Docs
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
publish-highlight-run-docs:
12+
concurrency: ${{ github.workflow }}-${{ github.ref }}-publish-highlight-run-docs
13+
name: Publish Highlight.run Docs
14+
if: github.ref == 'refs/heads/main'
15+
uses: ./.github/workflows/manual-publish-docs.yml
16+
with:
17+
workspace_path: sdk/highlight-run
18+
19+
publish-observability-node-docs:
20+
concurrency: ${{ github.workflow }}-${{ github.ref }}-publish-observability-node-docs
21+
# Run the docs publish after the highlight.run docs are published.
22+
needs: publish-highlight-run-docs
23+
# Runs the job even if the highlight.run docs publish fails.
24+
if: ${{ always() && !cancelled() && github.ref == 'refs/heads/main'}}
25+
name: Publish @launchdarkly/observability-node Docs
26+
uses: ./.github/workflows/manual-publish-docs.yml
27+
with:
28+
workspace_path: sdk/@launchdarkly/observability-node
29+
30+
publish-observability-react-native-docs:
31+
concurrency: ${{ github.workflow }}-${{ github.ref }}-publish-observability-react-native-docs
32+
# Run the docs publish after the observability-node docs are published.
33+
needs: publish-observability-node-docs
34+
# Runs the job even if the observability-node docs publish fails.
35+
if: ${{ always() && !cancelled() && github.ref == 'refs/heads/main'}}
36+
name: Publish @launchdarkly/observability-react-native Docs
37+
uses: ./.github/workflows/manual-publish-docs.yml
38+
with:
39+
workspace_path: sdk/@launchdarkly/observability-react-native

.github/workflows/python-plugin.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ jobs:
2727
- uses: actions/checkout@v4
2828
with:
2929
token: ${{ secrets.GITHUB_TOKEN }}
30-
- name: Install poetry
31-
run: pipx install poetry
32-
- uses: actions/setup-python@v4
30+
31+
- uses: actions/setup-python@v5
3332
with:
34-
python-version: '3.12'
35-
cache: 'poetry'
33+
python-version: '3.10'
34+
35+
- name: Install poetry
36+
uses: abatilo/actions-poetry@7b6d33e44b4f08d7021a1dee3c044e9c253d6439
37+
3638
- run: make install
3739
- name: Lint
3840
run: make lint
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Run Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release-package:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write # Contents and pull-requests are for release-please to make releases.
12+
pull-requests: write
13+
issues: write
14+
outputs:
15+
python-plugin-released: ${{ steps.release.outputs['sdk/@launchdarkly/observability-python--release_created'] }}
16+
python-plugin-tag-name: ${{ steps.release.outputs['sdk/@launchdarkly/observability-python--tag_name'] }}
17+
steps:
18+
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445
19+
id: release
20+
21+
- uses: actions/checkout@v4
22+
if: ${{ steps.release.outputs.releases_created == 'true' }}
23+
with:
24+
fetch-depth: 0 # If you only need the current version keep this.
25+
26+
release-python-plugin:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
id-token: write # Used for publishing secrets and documentation.
30+
needs: ['release-package']
31+
if: ${{ needs.release-package.outputs.python-plugin-released == 'true' }}
32+
outputs:
33+
package-hashes: ${{ steps.publish.outputs.package-hashes }}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Publish Python SDK
39+
id: publish
40+
uses: ./.github/actions/publish-python-sdk
41+
with:
42+
workspace-path: sdk/@launchdarkly/observability-python
43+
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
44+
45+
release-python-docs:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
needs: ['release-python-plugin']
50+
steps:
51+
- name: Build and Publish Docs
52+
uses: ./.github/workflows/manual-publish-docs.yml
53+
with:
54+
workspace_path: sdk/@launchdarkly/observability-python
55+
56+
release-python-provenance:
57+
needs: ['release-package', 'release-python-plugin']
58+
if: ${{ needs.release-package.outputs.python-plugin-released == 'true' }}
59+
permissions:
60+
actions: read
61+
id-token: write
62+
contents: write
63+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
64+
with:
65+
base64-subjects: '${{ needs.release-python-plugin.outputs.package-hashes }}'
66+
upload-assets: true
67+
upload-tag-name: ${{ needs.release-package.outputs.python-plugin-tag-name }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ sdk/highlight-wordpress/highlight-io/highlight.js
6969

7070
# Typedoc docs
7171
sdk/highlight-run/docs
72+
sdk/@launchdarkly/observability-react-native/docs

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sdk/@launchdarkly/observability-python": "0.1.0"
3+
}

0 commit comments

Comments
 (0)