Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve verdaccio pipeline #7900

Merged
merged 12 commits into from
Mar 13, 2025
2 changes: 1 addition & 1 deletion .circleci/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function run() {
repo: 'react-spectrum',
commit_sha: process.env.CIRCLE_SHA1,
body: `Verdaccio builds:
[CRA Test App](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/build/index.html)
[CRA Test App](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/rsp-cra-18/index.html)
[NextJS Test App](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/next/index.html)
[RAC Tailwind Example](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/rac-tailwind/index.html)
[RAC Spectrum + Tailwind Example](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/verdaccio/rac-spectrum-tailwind/index.html)
Expand Down
271 changes: 265 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -461,22 +461,239 @@ jobs:
paths:
- '*/docs/'

docs-verdaccio:
verdaccio:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- run:
name: run verdaccio
command: ./scripts/verdaccio.sh ci
name: run verdaccio and publish built packages
command: |
mkdir -p verdaccio-workspace
./scripts/verdaccio-ci.sh
./scripts/verdaccio-deploy.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

# Store the prod docs website w/ verdaccio packages in a separate dist folder so it doesn't get deployed by "deploy" workflow
# This is because we have a separate deploy flow for the test prod docs website so it doesn't hold up the normal "deploy" workflow
- persist_to_workspace:
root: /tmp/verdaccio-workspace
paths:
- storage

v-docs:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build docs off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/docs'

v-rsp-cra-18:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build react-spectrum-cra-18 off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-rsp-cra-18.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/rsp-cra-18'

v-webpack-4:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build webpack-4 off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-webpack-4.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/webpack-4'

v-nextjs:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build nextjs off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-nextjs.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/'
- '*/verdaccio/next'

v-rac-tailwind:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build rac-tailwind off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-rac-tailwind.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/rac-tailwind'

v-rac-rsp-tailwind:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build rac-rsp-tailwind off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-rac-rsp-tailwind.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/rac-spectrum-tailwind'

v-s2-parcel:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build s2-parcel off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-s2-parcel.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/s2-parcel-example'

v-s2-webpack:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build s2-webpack off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-s2-webpack.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/s2-webpack-5-example'

v-icon-builder:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio-workspace

- run:
name: build icon-builder off verdaccio
command: |
./scripts/verdaccio-ci.sh
./scripts/verdaccio-build-icon-builder.sh
environment:
VERDACCIO_STORAGE_PATH: /tmp/verdaccio-workspace/storage

v-publish-stats:
executor: rsp
steps:
- restore_cache:
key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- attach_workspace:
at: /tmp/verdaccio_dist

- run:
name: build size diffs off verdaccio
command: |
./scripts/verdaccio-build-pre-azure.sh

- persist_to_workspace:
root: verdaccio_dist
paths:
- '*/verdaccio/publish-stats'

deploy:
docker:
Expand Down Expand Up @@ -646,12 +863,45 @@ workflows:
- docs:
requires:
- install
- docs-verdaccio:
- verdaccio:
filters:
branches:
only: main
requires:
- install
- v-docs:
requires:
- verdaccio
- v-rsp-cra-18:
requires:
- verdaccio
- v-webpack-4:
requires:
- verdaccio
- v-nextjs:
requires:
- verdaccio
- v-rac-tailwind:
requires:
- verdaccio
- v-rac-rsp-tailwind:
requires:
- verdaccio
- v-s2-parcel:
requires:
- verdaccio
- v-s2-webpack:
requires:
- verdaccio
- v-icon-builder:
requires:
- verdaccio
- v-publish-stats:
requires:
- verdaccio
- v-webpack-4
- v-nextjs
- v-rsp-cra-18
- deploy:
requires:
- lint
Expand All @@ -670,7 +920,16 @@ workflows:
- docs
- deploy-verdaccio:
requires:
- docs-verdaccio
- v-docs
- v-rsp-cra-18
- v-webpack-4
- v-nextjs
- v-rac-tailwind
- v-rac-rsp-tailwind
- v-s2-parcel
- v-s2-webpack
- v-icon-builder
- v-publish-stats
- comment:
name: comment-pr
filters:
Expand Down
5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ yarnPath: .yarn/releases/yarn-4.2.2.cjs

plugins:
- .yarn/plugins/plugin-nightly-prep.js

changesetIgnorePatterns:
- "**/*.test.*"
- "**/*.md"
- "**/test/**"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
"tempy": "^0.5.0",
"typescript": "^5.5.0",
"typescript-eslint": "^8.9.0",
"verdaccio": "^5.13.0",
"verdaccio": "^6.0.0",
"walk-object": "^4.0.0",
"wsrun": "^5.0.0",
"xml": "^1.0.1",
Expand Down
1 change: 1 addition & 0 deletions scripts/buildWebsite.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ async function build() {
'@parcel/transformer-css': packageJSON['@parcel/transformer-css']
};


// Add dependencies on each published package to the package.json, and
// copy the docs from the current package into the temp dir.
let packagesDir = path.join(__dirname, '..', 'packages');
Expand Down
4 changes: 2 additions & 2 deletions scripts/compareSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ async function compareBuildAppSize() {

if (commit) {
// Attempt to pull stats from last publish commit. If they don't exist, pull from a hardcoded commit (fallback until these records are generated for a first publish w/ this script)
let lastAppStatUrl = `https://reactspectrum.blob.core.windows.net/reactspectrum/${commit}/verdaccio/publish-stats/${currentAppStatsFile}`;
let lastPublishStatUrl = `https://reactspectrum.blob.core.windows.net/reactspectrum/${commit}/verdaccio/publish-stats/${currentPublishStatsFile}`;
let lastAppStatUrl = `https://reactspectrum.blob.core.windows.net/reactspectrum/${commit}/verdaccio/rsp-cra-18/publish-stats/${currentAppStatsFile}`;
let lastPublishStatUrl = `https://reactspectrum.blob.core.windows.net/reactspectrum/${commit}/verdaccio/rsp-cra-18/publish-stats/${currentPublishStatsFile}`;
let lastAppStatPath = path.join(__dirname, '..', lastAppStatsFile);
let lastPublishStatPath = path.join(__dirname, '..', lastPublishStatsFile);
await download(lastAppStatUrl, lastAppStatPath);
Expand Down
40 changes: 40 additions & 0 deletions scripts/verdaccio-build-icon-builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

port=4000
registry="http://localhost:$port"
output="output.out"

set -e

echo "Building docs with verdaccio"

# Wait for verdaccio to start
grep -q 'http address' <(tail -f $output)

if curl -sI http://localhost:4000/ >/dev/null; then
echo "Verdaccio is running on port 4000."
else
echo "Verdaccio is NOT running on port 4000."
fi

curl -s http://localhost:4000/@adobe/react-spectrum

yarn config set npmPublishRegistry --home $registry
yarn config set npmRegistryServer --home $registry
yarn config set npmAlwaysAuth --home false
yarn config set npmAuthToken --home abc
yarn config set unsafeHttpWhitelist --home localhost
npm set registry $registry

# Rename the dist folder from dist/production/docs to verdaccio_dist/COMMIT_HASH_BEFORE_PUBLISH/verdaccio/docs
# This is so we can have verdaccio build in a separate stream from deploy and deploy_prod
verdaccio_path=verdaccio_dist/`git rev-parse HEAD~0`/verdaccio
mkdir -p $verdaccio_path

echo 'test icon builder'
cd examples/s2-webpack-5-example
mkdir icon-test
cp ../../packages/@react-spectrum/s2/s2wf-icons/S2_Icon_3D_20_N.svg icon-test/S2_Icon_3D_20_N.svg
npx @react-spectrum/s2-icon-builder -i ./icon-test/S2_Icon_3D_20_N.svg -o ./icon-dist

netstat -tpln | awk -F'[[:space:]/:]+' '$5 == 4000 {print $(NF-2)}' | xargs kill
Loading