ci(contract-test-utils): consolidating test websocket implementation #781
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: sdk/electron | |
| 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' | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| build-test-electron: | |
| # Skip this job on scheduled runs to avoid redundant runs. | |
| if: github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # Node versions to run on. | |
| version: [24] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: ${{ matrix.version }} | |
| registry-url: 'https://registry.npmjs.org' | |
| - id: shared | |
| name: Shared CI Steps | |
| uses: ./actions/ci | |
| with: | |
| workspace_name: '@launchdarkly/electron-client-sdk' | |
| workspace_path: packages/sdk/electron | |
| # Contract Tests | |
| - name: Install contract test dependencies | |
| env: | |
| ELECTRON_DISABLE_SANDBOX: '1' | |
| run: | | |
| yarn workspaces focus @internal/electron-contract-tests-entity | |
| yarn workspace @launchdarkly/js-contract-test-utils build:client | |
| yarn workspace @internal/electron-contract-tests-entity build | |
| sudo apt-get install -y xvfb | |
| Xvfb :99 -screen 0 1024x768x24 > /tmp/xvfb.log 2>&1 & | |
| - name: run contract test entity | |
| env: | |
| ELECTRON_DISABLE_SANDBOX: '1' | |
| DISPLAY: ':99' | |
| run: | | |
| yarn workspace @internal/electron-contract-tests-entity open-electron &> /tmp/http-server.log & | |
| echo "Waiting for contract test entity on port 8000..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8000 > /dev/null; then | |
| echo "Contract test entity ready" | |
| break | |
| fi | |
| if [ $i -eq 30 ]; then | |
| echo "Timeout waiting for contract test entity" | |
| cat /tmp/http-server.log | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| - name: Run contract tests | |
| uses: launchdarkly/gh-actions/actions/contract-tests@d271978e893b5b9facb9f000414e9fcd62e1f78b | |
| with: | |
| test_service_port: 8000 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| extra_params: '--skip-from=${{ github.workspace }}/packages/sdk/electron/contract-tests/suppressions.txt --stop-service-at-end' | |
| run-example: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 24 | |
| - uses: ./actions/run-example | |
| with: | |
| workspace_name: '@internal/electron-example' | |
| aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | |
| env_vars: | | |
| DISPLAY=:99 | |
| ELECTRON_DISABLE_SANDBOX=1 | |
| before_test: | | |
| sudo apt-get install -y xvfb | |
| Xvfb :99 -screen 0 1024x768x24 > /tmp/xvfb.log 2>&1 & | |
| yarn workspace @internal/electron-example playwright install --with-deps chromium | |
| yarn workspace @internal/electron-example start -- --build |