Repository navigation
157 lines (149 loc) · 6.21 KB
/
Copy pathreact.yml
File metadata and controls
157 lines (149 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: sdk/react
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-test-react:
runs-on: ubuntu-latest
strategy:
matrix:
# Node versions to run on.
version: [22, 24]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./actions/setup-yarn
with:
node-version: ${{ matrix.version }}
registry-url: 'https://registry.npmjs.org'
- id: shared
name: Shared CI Steps
uses: ./actions/ci
with:
workspace_name: '@launchdarkly/react-sdk'
workspace_path: packages/sdk/react
# Contract Tests
- name: Install and build contract test dependencies
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
# Skip Electron binary download to avoid flaky race condition during concurrent installs.
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
run: |
yarn workspaces focus @launchdarkly/react-sdk-contract-tests
yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/react-sdk-contract-tests' run build
- name: Install Playwright browsers
run: yarn workspace @launchdarkly/react-sdk-contract-tests install-playwright-browsers
- name: Run test adapter
run: |
yarn workspace @launchdarkly/react-sdk-contract-tests run start:adapter > /tmp/adapter.log 2>&1 &
echo $! > /tmp/adapter.pid
- name: Run test entity
run: |
yarn workspace @launchdarkly/react-sdk-contract-tests run start:entity > /tmp/entity.log 2>&1 &
echo $! > /tmp/entity.pid
- name: Run test browser
run: |
yarn workspace @launchdarkly/react-sdk-contract-tests run start:browser > /tmp/browser.log 2>&1 &
echo $! > /tmp/browser.pid
- name: Wait for services to be ready
run: |
echo "Waiting for entity on port 8000..."
for i in {1..30}; do
if curl -s http://localhost:8000 > /dev/null; then
echo "Entity ready"
break
fi
if [ $i -eq 30 ]; then
echo "Timeout waiting for entity"
cat /tmp/adapter.log /tmp/entity.log /tmp/browser.log
exit 1
fi
sleep 1
done
sleep 5
- name: Run contract tests (FDv1)
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 8000
token: ${{ secrets.GITHUB_TOKEN }}
stop_service: 'false'
extra_params: '--skip-from=${{ github.workspace }}/packages/sdk/react/contract-tests/suppressions.txt'
- name: Run contract tests (FDv2)
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 8000
token: ${{ secrets.GITHUB_TOKEN }}
version: v3
extra_params: '--skip-from=${{ github.workspace }}/packages/sdk/react/contract-tests/testharness-suppressions-fdv2.txt'
- name: Cleanup contract test services
if: always()
run: |
[ -f /tmp/browser.pid ] && kill $(cat /tmp/browser.pid) || true
[ -f /tmp/entity.pid ] && kill $(cat /tmp/entity.pid) || true
[ -f /tmp/adapter.pid ] && kill $(cat /tmp/adapter.pid) || true
run-example:
# Fork PRs cannot use OIDC to get the e2e SDK keys. Skip this job for them.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./actions/setup-yarn
with:
node-version: 24
- uses: ./actions/run-example
with:
workspace_name: '@launchdarkly/react-sdk-example-hello-react'
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
before_test: 'yarn workspace @launchdarkly/react-sdk-example-hello-react playwright install --with-deps chromium'
run-react-server-example:
# Fork PRs cannot use OIDC to get the e2e SDK keys. Skip this job for them.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./actions/setup-yarn
with:
node-version: 24
- uses: ./actions/run-example
with:
workspace_name: '@launchdarkly/react-sdk-example-react-server'
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
before_test: 'yarn workspace @launchdarkly/react-sdk-example-react-server playwright install --with-deps chromium'
run-bootstrap-example:
# Fork PRs cannot use OIDC to get the e2e SDK keys. Skip this job for them.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./actions/setup-yarn
with:
node-version: 24
- uses: ./actions/run-example
with:
workspace_name: '@launchdarkly/react-sdk-example-bootstrap'
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
before_test: 'yarn workspace @launchdarkly/react-sdk-example-bootstrap playwright install --with-deps chromium'
run-testing-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./actions/setup-yarn
with:
node-version: 24
- name: Install dependencies
run: yarn workspaces focus @launchdarkly/react-sdk-example-testing
- name: Build SDK dependencies
run: yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/react-sdk-example-testing' run build
- name: Run tests
run: yarn workspace @launchdarkly/react-sdk-example-testing test