Skip to content

Commit 0faaab2

Browse files
committed
build: align tooling with s2-foundations branch
1 parent eda9897 commit 0faaab2

File tree

331 files changed

+15707
-17063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+15707
-17063
lines changed

.github/workflows/development.yml

+48-7
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ jobs:
8585
styles_modified_files: ${{ steps.changed-files.outputs.styles_modified_files }}
8686
eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }}
8787
eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }}
88+
plugins_modified_files: ${{ steps.changed-files.outputs.plugins_modified_files }}
89+
plugins_added_files: ${{ steps.changed-files.outputs.plugins_added_files }}
8890
permissions:
8991
pull-requests: read
9092

9193
steps:
9294
- name: Get changed files
9395
id: changed-files
94-
uses: tj-actions/changed-files@v44
96+
uses: tj-actions/changed-files@v45
9597
with:
9698
files_yaml: |
9799
styles:
@@ -100,6 +102,8 @@ jobs:
100102
- components/*/themes/express.css
101103
eslint:
102104
- components/*/stories/*.js
105+
plugins:
106+
- plugins/**/*
103107
104108
# -------------------------------------------------------------
105109
# Lint pre-compiled assets for consistency
@@ -116,6 +120,49 @@ jobs:
116120
eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }}
117121
secrets: inherit
118122

123+
# -------------------------------------------------------------
124+
# Run the test suites for the plugins if there are changes
125+
# to any of the plugin files
126+
# -------------------------------------------------------------
127+
plugin_tests:
128+
name: Plugin tests
129+
runs-on: ubuntu-latest
130+
needs: [changed_files]
131+
if: ${{ needs.changed_files.outputs.plugins_added_files != '' || needs.changed_files.outputs.plugins_modified_files != '' }}
132+
steps:
133+
- name: Check out code
134+
uses: actions/checkout@v4
135+
136+
- name: Use Node LTS version
137+
uses: actions/setup-node@v4
138+
with:
139+
node-version: 20
140+
cache: yarn
141+
142+
- name: Enable Corepack
143+
run: corepack enable
144+
145+
## --- YARN CACHE --- ##
146+
- name: Check for cached dependencies
147+
continue-on-error: true
148+
id: cache-dependencies
149+
uses: actions/cache@v4
150+
with:
151+
path: |
152+
.cache/yarn
153+
node_modules
154+
key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }}
155+
156+
## --- INSTALL --- ##
157+
# If statement isn't needed here b/c yarn will leverage the cache if it exists
158+
- name: Install dependencies
159+
shell: bash
160+
run: yarn install --immutable
161+
162+
## --- Run plugins test suites --- ##
163+
- name: Run plugin tests
164+
run: yarn test:plugins
165+
119166
# -------------------------------------------------------------
120167
# RUN VISUAL REGRESSION TESTS --- #
121168
# Run VRT on:
@@ -142,14 +189,8 @@ jobs:
142189
# -------------------------------------------------------------
143190
publish_site:
144191
name: Publish
145-
# The build step ensures we are leveraging the cache for the build
146-
needs: [vrt]
147-
# Note: the goal here is to allow vrt to be skipped but still require the build to succeed
148-
if: ${{ always() }}
149192
uses: ./.github/workflows/publish-site.yml
150193
with:
151194
deploy-message: ${{ github.event.pull_request.title }}
152195
alias: pr-${{ github.event.number }}
153-
# Only pass the storybook url if the vrt was successful
154-
storybook-url: ${{ needs.vrt.outputs.storybook-url || '' }}
155196
secrets: inherit

.github/workflows/lint.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,31 @@ jobs:
7676
shell: bash
7777
run: yarn install --immutable
7878

79+
# Components must be built before linting so that the custom properties are available
80+
# in the dependencies for passthrough and token verification
81+
- name: Build components & ui-icons
82+
shell: bash
83+
run: yarn build
84+
7985
- name: Lint component styles
8086
if: ${{ inputs.styles_added_files != '' || inputs.styles_modified_files != '' }}
81-
uses: reviewdog/action-stylelint@v1.18.1
87+
uses: reviewdog/action-stylelint@v1.30.0
8288
with:
83-
fail_on_error: true
84-
level: error
85-
reporter: github-pr-check
89+
fail_level: error
8690
filter_mode: diff_context
91+
level: error
92+
reporter: github-pr-review
8793
# stylelint_input: "components/*/index.css components/*/themes/*.css"
8894
stylelint_input: "${{ inputs.styles_added_files }} ${{ inputs.styles_modified_files }}"
8995
stylelint_config: stylelint.config.js
9096

9197
- name: Run eslint on packages and stories
92-
uses: reviewdog/action-eslint@v1.20.0
98+
uses: reviewdog/action-eslint@v1.33.0
9399
if: ${{ inputs.eslint_added_files != '' || inputs.eslint_modified_files != '' }}
94100
with:
95-
fail_on_error: true
101+
fail_level: error
96102
level: error
97-
reporter: github-pr-check
103+
reporter: github-pr-review
98104
filter_mode: diff_context
99105
# eslint_flags: "components/*/stories/*.js"
100106
eslint_flags: "${{ inputs.eslint_added_files }} ${{ inputs.eslint_modified_files }}"

.github/workflows/production.yml

-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ name: Build and verify production
77
# - Publish the PR branch to Netlify
88
# -------------------------------------------------------------
99

10-
1110
on:
1211
push:
1312
branches: [main, spectrum-two]
@@ -62,11 +61,7 @@ jobs:
6261
# -------------------------------------------------------------
6362
publish_site:
6463
name: Publish
65-
# The build step ensures we are leveraging the cache for the build
66-
needs: [vrt]
6764
uses: ./.github/workflows/publish-site.yml
68-
with:
69-
storybook-url: ${{ needs.vrt.outputs.storybook-url || '' }}
7065
secrets: inherit
7166

7267
todo_to_issue:

.github/workflows/publish-site.yml

+2-18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
alias:
1313
required: false
1414
type: string
15-
storybook-url:
16-
required: false
17-
type: string
18-
default: ''
1915
workflow_call:
2016
inputs:
2117
deploy-message:
@@ -24,10 +20,6 @@ on:
2420
alias:
2521
required: false
2622
type: string
27-
storybook-url:
28-
required: false
29-
type: string
30-
default: ''
3123

3224
permissions:
3325
contents: read
@@ -75,22 +67,14 @@ jobs:
7567
run: yarn install --immutable
7668

7769
## --- BUILD --- ##
78-
- name: Build docs site
79-
shell: bash
80-
run: yarn build:site
81-
env:
82-
CHROMATIC_URL: ${{ inputs.storybook-url }}
83-
84-
- name: Build storybook site
85-
if: ${{ ! inputs.storybook-url }}
70+
- name: Build storybook
8671
shell: bash
87-
run: yarn nx run storybook:build:docs
72+
run: yarn build:docs
8873

8974
## --- DEPLOY WEBSITE TO NETLIFY --- ##
9075
- name: Deploy
9176
uses: nwtgck/actions-netlify@v3
9277
with:
93-
# publish-dir: site/dist
9478
publish-dir: dist
9579
production-branch: main
9680
production-deploy: false
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Snapshot
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag used on changeset version and npm package"
8+
required: false
9+
type: string
10+
11+
jobs:
12+
get-snapshot-tag:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
id-token: write
17+
steps:
18+
- name: Split branch name
19+
id: split
20+
env:
21+
BRANCH: ${{ github.ref_name }}
22+
run: echo "fragment=${BRANCH##*snapshot-}" >> $GITHUB_OUTPUT
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Get last author info
27+
id: author
28+
run: |
29+
echo "authorName=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT
30+
echo "authorEmail=$(git log -1 --pretty=format:'%ae')" >> $GITHUB_OUTPUT
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 18
35+
cache: yarn
36+
- name: Install Dependencies
37+
run: yarn install --frozen-lockfile
38+
- name: Create snapshot release and publish to npm
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
SNAPSHOT_TAG: ${{ inputs.tag || steps.split.outputs.fragment }}
43+
USERNAME: ${{ steps.author.outputs.authorName }}
44+
EMAIL: ${{ steps.author.outputs.authorEmail }}
45+
run: |
46+
yarn changeset version --snapshot $SNAPSHOT_TAG && yarn --mode="update-lockfile"
47+
yarn ci
48+
git config --global user.name "$USERNAME"
49+
git config --global user.email "$EMAIL"
50+
git add .
51+
git commit -m "chore: snapshot release $SNAPSHOT_TAG"
52+
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
53+
yarn changeset publish --tag $SNAPSHOT_TAG
54+
git push origin HEAD
55+
git push --tags

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
- spectrum-two
8+
- s2-foundations-redux
89

910
concurrency: ${{ github.workflow }}-${{ github.ref }}
1011

.github/workflows/vrt.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Visual regression testing
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
- "!changeset-release/**"
8+
- "!dependabot/**"
49
workflow_dispatch:
510
workflow_call:
611
inputs:
@@ -20,12 +25,12 @@ permissions:
2025

2126
jobs:
2227
vrt:
28+
if: ${{!startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/changeset-release/') }}
2329
name: Chromatic
2430
runs-on: ubuntu-latest
2531
timeout-minutes: 20
2632
outputs:
27-
storybook-url: ${{ steps.chromatic.outputs.storybookUrl != 'undefined' && steps.chromatic.outputs.storybookUrl || '' }}
28-
33+
storybook-url: ${{ steps.chromatic.outputs.storybookUrl != 'undefined' && steps.chromatic.outputs.storybookUrl || '' }}
2934
steps:
3035
- name: Check out code
3136
uses: actions/checkout@v4
@@ -59,7 +64,7 @@ jobs:
5964

6065
- name: Publish to Chromatic
6166
id: chromatic
62-
uses: chromaui/action@v11
67+
uses: chromaui/action@latest
6368
with:
6469
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
6570
buildScriptName: ci:storybook
@@ -68,7 +73,8 @@ jobs:
6873
exitOnceUploaded: true
6974
onlyChanged: true
7075
traceChanged: true
71-
untraced: ".github/actions/*/package.json site/package.json generator/package.json"
76+
untraced: ".github/actions/*/package.json generator/package.json"
7277
diagnostics: true
78+
autoAcceptChanges: "main"
7379
# Lets VRT pass without running so as not to waste snapshots
7480
skip: ${{ inputs.skip }}

.gitignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
dist
2-
dist-site
3-
!tokens/dist
2+
!tokens/dist/index.css
3+
!tokens/dist/css/*.css
4+
5+
# Not committing the map assets, these are dev-only
6+
*.map
47

58
# Recommended update re:https://docs.netlify.com/integrations/frameworks/eleventy/
69
**/node_modules/**

.husky/commit-msg

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
yarn commitlint --edit $1

.husky/pre-commit

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
yarn lint-staged --allow-empty --config lint-staged.config.js
+5
Loading
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
Loading
Loading
Loading
Loading

.storybook/assets/images/npm_logo.svg

+11
Loading
File renamed without changes.

.storybook/assets/images/wc_logo.svg

+28
Loading

0 commit comments

Comments
 (0)