Skip to content

Commit

Permalink
Supporting multiple versions of storybook in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rishigupta1599 committed May 5, 2024
1 parent 3e39d27 commit eda48b0
Show file tree
Hide file tree
Showing 17 changed files with 6,421 additions and 31,822 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-storybook-v6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: ./prepare-storybook-v6-tests.sh
- run: ./prepare-storybook-tests.sh 6
- uses: actions/cache@v3
with:
path: node_modules
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-storybook-v7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: ./prepare-storybook-tests.sh 7
- uses: actions/cache@v3
with:
path: node_modules
Expand All @@ -54,4 +55,4 @@ jobs:
yarn link `echo $PERCY_PACKAGES`
npx percy --version
- run: yarn test:coverage
- run: yarn test
57 changes: 57 additions & 0 deletions .github/workflows/test-storybook-v8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test
on:
push:
workflow_dispatch:
inputs:
branch:
required: false
type: string
default: master
jobs:
test:
name: Test Storybook v8
strategy:
matrix:
os: [ubuntu-latest]
node: [18]
runs-on: ${{ matrix.os }}
steps:
- uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b
id: regex-match
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
text: ${{ inputs.branch }}
regex: '^[a-zA-Z0-9_/\-]+$'
- name: Break on invalid branch name
run: exit 1
if: ${{ github.event_name == 'workflow_dispatch' && steps.regex-match.outputs && steps.regex-match.outputs.match == '' }}
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}/node-${{ matrix.node }}/${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}/node-${{ matrix.node }}/
- run: yarn
env:
PERCY_POSTINSTALL_BROWSER: true
- run: yarn build
- name: Set up @percy/cli from git
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
cd /tmp
git clone --branch ${{ inputs.branch }} --depth 1 https://github.com/percy/cli
cd cli
PERCY_PACKAGES=`find packages -type d -mindepth 1 -maxdepth 1 | sed -e 's/packages/@percy/g' | tr '\n' ' '`
echo "Packages: $PERCY_PACKAGES"
git log -1
yarn
yarn build
yarn global:link
cd ${{ github.workspace }}
yarn link `echo $PERCY_PACKAGES`
npx percy --version
- run: yarn test:coverage
19 changes: 19 additions & 0 deletions babel.config.old.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
presets: [
['@babel/env', {
modules: false,
targets: {
node: '18'
}
}]
],
env: {
test: {
plugins: [
['istanbul', {
exclude: ['dist', 'test']
}]
]
}
}
};
Loading

0 comments on commit eda48b0

Please sign in to comment.