Skip to content

Commit 245d519

Browse files
authored
ci: electron example should not build with top level yarn build (#1195)
<!-- CURSOR_SUMMARY --> > [!NOTE] > **Low Risk** > Low risk CI refactor plus removal of an example-only `build` script; main impact is on the GitHub Actions e2e job behavior and environment variable/secrets setup. > > **Overview** > Refactors `.github/workflows/electron.yaml`’s `run-example` job to call the shared `./actions/run-example` composite action instead of inlining dependency install/build, Xvfb/Playwright setup, and test execution. > > Enhances `actions/run-example/action.yml` to support an `env_vars` input (written to `$GITHUB_ENV`) and to fetch the mobile SDK key in addition to the existing client-side and flag keys; the Electron workflow now supplies `DISPLAY`/`ELECTRON_DISABLE_SANDBOX` and moves Xvfb/Playwright/startup into `before_test`. > > Removes the `build` script from `packages/sdk/electron/example/package.json`, so the example no longer exposes a top-level `yarn build` entry point. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7790739. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/launchdarkly/js-core/pull/1195" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
1 parent b00889f commit 245d519

3 files changed

Lines changed: 25 additions & 28 deletions

File tree

.github/workflows/electron.yaml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,15 @@ jobs:
8181
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
8282
with:
8383
node-version: 24
84-
- name: Install dependencies
85-
run: yarn workspaces focus @internal/electron-example
86-
- name: Build SDK dependencies
87-
run: yarn workspaces foreach -pR --topological-dev --from '@internal/electron-example' run build
88-
- name: Build example app
89-
env:
90-
ELECTRON_DISABLE_SANDBOX: '1'
91-
run: yarn workspace @internal/electron-example build
92-
- name: Setup Xvfb
93-
run: |
94-
sudo apt-get install -y xvfb
95-
Xvfb :99 -screen 0 1024x768x24 > /tmp/xvfb.log 2>&1 &
96-
- name: Install Playwright dependencies
97-
run: yarn workspace @internal/electron-example playwright install --with-deps chromium
98-
- uses: launchdarkly/gh-actions/actions/release-secrets@bbbbbda684f500766264e7fe327668094ba83d1c # release-secrets-v1.2.0
99-
name: 'Get the mobile SDK key'
84+
- uses: ./actions/run-example
10085
with:
86+
workspace_name: '@internal/electron-example'
10187
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
102-
ssm_parameter_pairs: '/sdk/common/hello-apps/mobile-key = LAUNCHDARKLY_MOBILE_KEY'
103-
- uses: launchdarkly/gh-actions/actions/release-secrets@bbbbbda684f500766264e7fe327668094ba83d1c # release-secrets-v1.2.0
104-
name: 'Get the test feature flag key'
105-
with:
106-
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
107-
ssm_parameter_pairs: '/sdk/common/hello-apps/boolean-flag-key = LAUNCHDARKLY_FLAG_KEY'
108-
- name: Run e2e tests
109-
env:
110-
ELECTRON_DISABLE_SANDBOX: '1'
111-
DISPLAY: ':99'
112-
run: yarn workspace @internal/electron-example test
88+
env_vars: |
89+
DISPLAY=:99
90+
ELECTRON_DISABLE_SANDBOX=1
91+
before_test: |
92+
sudo apt-get install -y xvfb
93+
Xvfb :99 -screen 0 1024x768x24 > /tmp/xvfb.log 2>&1 &
94+
yarn workspace @internal/electron-example playwright install --with-deps chromium
95+
yarn workspace @internal/electron-example start -- --build

actions/run-example/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,34 @@ inputs:
1111
before_test:
1212
description: 'Shell commands to run before the e2e test step (e.g. install Playwright browsers)'
1313
default: ''
14+
env_vars:
15+
description: 'Newline-separated KEY=VALUE pairs to set as environment variables for all subsequent steps'
16+
default: ''
1417
runs:
1518
using: composite
1619
steps:
1720
- name: Install dependencies
1821
shell: bash
1922
run: yarn workspaces focus ${{ inputs.workspace_name }}
2023

24+
- name: Set environment variables
25+
shell: bash
26+
if: ${{ inputs.env_vars != '' }}
27+
run: |
28+
echo "${{ inputs.env_vars }}" >> $GITHUB_ENV
29+
2130
- uses: launchdarkly/gh-actions/actions/release-secrets@1a3dc56945c8e87bc952119b055f9481b4d642b0
2231
name: 'Get the client-side SDK key'
2332
with:
2433
aws_assume_role: ${{ inputs.aws_assume_role }}
2534
ssm_parameter_pairs: '/sdk/common/hello-apps/client-key = LAUNCHDARKLY_CLIENT_SIDE_ID'
2635

36+
- uses: launchdarkly/gh-actions/actions/release-secrets@1a3dc56945c8e87bc952119b055f9481b4d642b0
37+
name: 'Get the mobile SDK key'
38+
with:
39+
aws_assume_role: ${{ inputs.aws_assume_role }}
40+
ssm_parameter_pairs: '/sdk/common/hello-apps/mobile-key = LAUNCHDARKLY_MOBILE_KEY'
41+
2742
- uses: launchdarkly/gh-actions/actions/release-secrets@1a3dc56945c8e87bc952119b055f9481b4d642b0
2843
name: 'Get the test feature flag key'
2944
with:

packages/sdk/electron/example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"private": true,
88
"scripts": {
99
"start": "electron-forge start",
10-
"build": "electron-forge start -- --build",
1110
"test": "playwright test",
1211
"clean": "electron-forge clean",
1312
"package": "electron-forge package",

0 commit comments

Comments
 (0)