Skip to content

Commit 52d34cd

Browse files
authored
Merge branch 'main' into ruben/library-version-bug-report
2 parents b980fa1 + 4e100f7 commit 52d34cd

File tree

16 files changed

+954
-6744
lines changed

16 files changed

+954
-6744
lines changed

.changeset/quiet-cars-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@spectrum-web-components/slider': patch
3+
---
4+
5+
Editable sliders will now reliably emit `input` events when interaction starts with the track.

.circleci/config.yml

Lines changed: 164 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
version: 2.1
22

33
executors:
4+
default:
5+
docker:
6+
- image: cimg/base:stable
7+
resource_class: medium
48
node:
59
docker:
610
- image: mcr.microsoft.com/playwright:v1.44.0
711
resource_class: xlarge
812
environment:
913
NODE_ENV: development
14+
AZCOPY_AUTO_LOGIN_TYPE: SPN
15+
AZCOPY_SPA_APPLICATION_ID: $AZURE_CLIENT_ID
16+
AZCOPY_SPA_CLIENT_SECRET: $AZURE_CLIENT_SECRET
17+
AZCOPY_TENANT_ID: $AZURE_TENANT_ID
1018
parameters:
1119
# In order to update the VRT baseline images:
1220
# 1. Copy the hash of the latest golden images cache from the left sidebar in the VRT preview link (not to be confused with the arbitrary hash in the URL).
@@ -19,6 +27,27 @@ parameters:
1927
type: string
2028
default: wireit
2129
commands:
30+
install-azcopy:
31+
description: 'Install AzCopy and set up authentication'
32+
steps:
33+
- run:
34+
when: always
35+
name: Install AzCopy
36+
command: |
37+
# Create a bin directory in the home folder
38+
mkdir -p ~/bin
39+
cd ~/bin
40+
wget -O azcopy.tar.gz https://github.com/Azure/azure-storage-azcopy/releases/download/v10.29.1/azcopy_linux_amd64_10.29.1.tar.gz
41+
tar -xf azcopy.tar.gz --strip-components=1
42+
chmod +x azcopy
43+
# Add to PATH and set environment variables
44+
echo 'export PATH=~/bin:$PATH' >> $BASH_ENV
45+
echo 'export AZCOPY_AUTO_LOGIN_TYPE="SPN"' >> $BASH_ENV
46+
echo 'export AZCOPY_SPA_APPLICATION_ID="$AZURE_CLIENT_ID"' >> $BASH_ENV
47+
echo 'export AZCOPY_SPA_CLIENT_SECRET="$AZURE_CLIENT_SECRET"' >> $BASH_ENV
48+
echo 'export AZCOPY_TENANT_ID="$AZURE_TENANT_ID"' >> $BASH_ENV
49+
source $BASH_ENV
50+
azcopy --version
2251
downstream:
2352
steps:
2453
- checkout
@@ -97,32 +126,66 @@ commands:
97126
branch=$(git symbolic-ref --short HEAD)
98127
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="<< parameters.regression_system >> << parameters.regression_color >> << parameters.regression_scale >> << parameters.regression_dir >>"
99128
yarn rollup -c test/visual/rollup.config.js
129+
- install-azcopy
100130
- run:
101131
when: always
102-
name: Publish review site
132+
name: Deploy VRT Results to Azure Blob Storage
103133
command: |
104-
cp projects/documentation/content/favicon.ico test/visual
105-
branch=$(git symbolic-ref --short HEAD)
106-
hash=$(echo -n $branch-<< parameters.regression_system >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >> | md5sum | cut -c 1-32)
107-
echo "Netlify alias hash: $hash"
108-
echo "Deploying from test/visual directory..."
109-
110-
max_attempts=3
111-
attempt=0
112-
113-
while [ $attempt -lt $max_attempts ]; do
114-
if yarn netlify deploy --alias=$hash --cwd test/visual; then
115-
echo "Deployment successful!"
116-
exit 0
134+
# Get PR number from CircleCI environment
135+
PR_NUMBER=""
136+
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
137+
PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
138+
echo "Deploying VRT for PR #$PR_NUMBER"
139+
elif [ -n "$CIRCLE_PR_NUMBER" ]; then
140+
PR_NUMBER="$CIRCLE_PR_NUMBER"
141+
echo "Deploying VRT for PR #$PR_NUMBER"
142+
elif [[ "$CIRCLE_BRANCH" =~ ^pull/[0-9]+$ ]]; then
143+
PR_NUMBER=$(echo $CIRCLE_BRANCH | sed 's/pull\///')
144+
echo "Deploying VRT for forked PR #$PR_NUMBER"
145+
elif [ -n "$GITHUB_TOKEN" ]; then
146+
# GitHub API fallback
147+
PR_NUMBER=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
148+
-H "Accept: application/vnd.github+json" \
149+
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \
150+
| grep -o '"number":[0-9]*' | head -1 | sed 's/"number"://')
151+
152+
if [ -n "$PR_NUMBER" ]; then
153+
echo "Deploying VRT for PR #$PR_NUMBER (via GitHub API)"
117154
else
118-
attempt=$((attempt + 1))
119-
echo "Deploy failed, retrying ($attempt/$max_attempts)..."
120-
sleep 10 # Adjust delay if needed
155+
echo "⏭️ No PR found - skipping VRT deployment"
156+
exit 0
121157
fi
122-
done
158+
else
159+
echo "⏭️ No PR detected - skipping VRT deployment"
160+
exit 0
161+
fi
162+
163+
# Only proceed if we have a valid PR number
164+
if [ -z "$PR_NUMBER" ]; then
165+
echo "⏭️ No PR number available - skipping VRT deployment"
166+
exit 0
167+
fi
123168
124-
echo "Deployment failed after $max_attempts attempts."
125-
exit 1
169+
# Create PR hash using just PR number for overwriting deployments
170+
PR_HASH="pr-${PR_NUMBER}"
171+
172+
# VRT combination for subdirectory
173+
combination="<< parameters.regression_system >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>"
174+
175+
# Prepare files for deployment
176+
cp projects/documentation/content/favicon.ico test/visual/ || echo "Failed to copy favicon"
177+
178+
# Upload VRT results to Azure Blob Storage
179+
echo "Uploading VRT results to ${PR_HASH}/${combination}/"
180+
azcopy copy "test/visual/*" \
181+
"https://swcpreviews.blob.core.windows.net/\$web/${PR_HASH}/${combination}/" \
182+
--recursive \
183+
--from-to LocalBlob
184+
185+
# Generate the deployment URL
186+
VRT_URL="https://swcpreviews.z13.web.core.windows.net/${PR_HASH}/${combination}/"
187+
echo "$VRT_URL" > vrt_url.txt
188+
echo "VRT URL for ${combination}: $VRT_URL"
126189
127190
# move "updated" screenshot into the baseline directory before making the new cache
128191
- run:
@@ -195,27 +258,17 @@ jobs:
195258
- store_test_results:
196259
path: /root/project/results/
197260

198-
preview-docs:
261+
lint:
199262
executor: node
263+
200264
steps:
201265
- downstream
202266
- run:
203-
name: Generate Custom Elements Manifest
204-
command: yarn docs:analyze
267+
name: Lint
268+
command: yarn lint
205269
- run:
206-
name: Move CEM to Storybook directory
207-
command: cp projects/documentation/custom-elements.json storybook/
208-
- run:
209-
name: Build documentation
210-
command: yarn docs:build
211-
- run:
212-
name: Build Storybook
213-
command: yarn storybook:build
214-
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
215-
- run: |
216-
branch=$(git symbolic-ref --short HEAD)
217-
branch=$(npx slugify-cli $branch)
218-
yarn netlify deploy --alias=$branch --cwd projects/documentation
270+
name: Are there changes?
271+
command: git diff-files --exit-code
219272

220273
beta-docs:
221274
executor: node
@@ -234,11 +287,29 @@ jobs:
234287
- run:
235288
name: Build Storybook
236289
command: yarn storybook:build
237-
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
238-
- run: |
239-
branch=$(git symbolic-ref --short HEAD)
240-
branch=$(npx slugify-cli $branch)
241-
yarn netlify deploy --alias=beta --cwd projects/documentation
290+
- install-azcopy
291+
- run:
292+
name: Deploy Beta Documentation to Azure Blob Storage
293+
command: |
294+
# Upload documentation to beta path
295+
echo "Uploading documentation to beta/docs/"
296+
azcopy copy "projects/documentation/dist/*" \
297+
"https://swcpreviews.blob.core.windows.net/\$web/beta/docs/" \
298+
--recursive \
299+
--from-to LocalBlob
300+
301+
# Upload Storybook to beta path
302+
echo "Uploading Storybook to beta/docs/storybook/"
303+
azcopy copy "storybook-static/*" \
304+
"https://swcpreviews.blob.core.windows.net/\$web/beta/docs/storybook/" \
305+
--recursive \
306+
--from-to LocalBlob
307+
308+
# Generate the deployment URLs
309+
DOCS_URL="https://swcpreviews.z13.web.core.windows.net/beta/docs/"
310+
STORYBOOK_URL="https://swcpreviews.z13.web.core.windows.net/beta/docs/storybook/"
311+
echo "Beta Documentation URL: $DOCS_URL"
312+
echo "Beta Storybook URL: $STORYBOOK_URL"
242313
243314
hcm-visual:
244315
executor: node
@@ -281,32 +352,64 @@ jobs:
281352
branch=$(git symbolic-ref --short HEAD)
282353
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="hcm"
283354
yarn rollup -c test/visual/rollup.config.js
355+
- install-azcopy
284356
- run:
285357
when: always
286-
name: Publish review site
358+
name: Deploy Visual Tests to Azure Blob Storage
287359
command: |
288-
cp projects/documentation/content/favicon.ico test/visual
289-
branch=$(git symbolic-ref --short HEAD)
290-
hash=$(echo -n $branch-hcm | md5sum | cut -c 1-32)
291-
echo "Netlify alias hash: $hash"
292-
echo "Deploying from test/visual directory..."
293-
294-
max_attempts=3
295-
attempt=0
296-
297-
while [ $attempt -lt $max_attempts ]; do
298-
if yarn netlify deploy --alias=$hash --cwd test/visual; then
299-
echo "Deployment successful!"
300-
exit 0
360+
# Get PR number from CircleCI environment
361+
set +x
362+
PR_NUMBER=""
363+
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
364+
PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
365+
echo "Deploying HCM VRT for PR #$PR_NUMBER"
366+
elif [ -n "$CIRCLE_PR_NUMBER" ]; then
367+
PR_NUMBER="$CIRCLE_PR_NUMBER"
368+
echo "Deploying HCM VRT for PR #$PR_NUMBER"
369+
elif [[ "$CIRCLE_BRANCH" =~ ^pull/[0-9]+$ ]]; then
370+
PR_NUMBER=$(echo $CIRCLE_BRANCH | sed 's/pull\///')
371+
echo "Deploying HCM VRT for forked PR #$PR_NUMBER"
372+
elif [ -n "$GITHUB_TOKEN" ]; then
373+
# GitHub API fallback
374+
PR_NUMBER=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
375+
-H "Accept: application/vnd.github+json" \
376+
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \
377+
| grep -o '"number":[0-9]*' | head -1 | sed 's/"number"://')
378+
379+
if [ -n "$PR_NUMBER" ]; then
380+
echo "Deploying HCM VRT for PR #$PR_NUMBER (via GitHub API)"
301381
else
302-
attempt=$((attempt + 1))
303-
echo "Deploy failed, retrying ($attempt/$max_attempts)..."
304-
sleep 10 # Adjust delay if needed
382+
echo "⏭️ No PR found - skipping HCM VRT deployment"
383+
exit 0
305384
fi
306-
done
385+
else
386+
echo "⏭️ No PR detected - skipping HCM VRT deployment"
387+
exit 0
388+
fi
389+
390+
# Only proceed if we have a valid PR number
391+
if [ -z "$PR_NUMBER" ]; then
392+
echo "⏭️ No PR number available - skipping HCM VRT deployment"
393+
exit 0
394+
fi
395+
396+
# Create PR hash using just PR number for overwriting deployments
397+
PR_HASH="pr-${PR_NUMBER}"
398+
399+
# Prepare files for deployment
400+
cp projects/documentation/content/favicon.ico test/visual/
307401
308-
echo "Deployment failed after $max_attempts attempts."
309-
exit 1
402+
# Upload HCM VRT results to Azure Blob Storage
403+
echo "Uploading HCM VRT to ${PR_HASH}/hcm/"
404+
azcopy copy "test/visual/*" \
405+
"https://swcpreviews.blob.core.windows.net/\$web/${PR_HASH}/hcm/" \
406+
--recursive \
407+
--from-to LocalBlob
408+
409+
# Generate the deployment URL
410+
VRT_URL="https://swcpreviews.z13.web.core.windows.net/${PR_HASH}/hcm/"
411+
echo "$VRT_URL" > vrt_url.txt
412+
echo "HCM Visual Test URL: $VRT_URL"
310413
311414
# move "updated" screenshot into the baseline directory before making the new cache
312415
- run:
@@ -357,11 +460,6 @@ workflows:
357460
branches:
358461
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
359462
ignore: /pull\/[0-9]+/
360-
- preview-docs:
361-
filters:
362-
branches:
363-
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
364-
ignore: /pull\/[0-9]+/
365463
- beta-docs:
366464
filters:
367465
branches:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Setup AzCopy'
2+
description: 'Downloads and installs AzCopy for use in workflows'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install AzCopy
8+
shell: bash
9+
run: |
10+
# Download and install AzCopy
11+
wget -O azcopy.tar.gz https://github.com/Azure/azure-storage-azcopy/releases/download/v10.29.1/azcopy_linux_amd64_10.29.1.tar.gz
12+
tar -xf azcopy.tar.gz --strip-components=1
13+
sudo mv azcopy /usr/local/bin/
14+
azcopy --version

0 commit comments

Comments
 (0)