Skip to content

Commit

Permalink
test: update screenshots only in PRs (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsvetkov-splunk authored Feb 16, 2024
1 parent d0b9e6f commit ef93d0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/storybook-visual.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Storybook Visual'
name: "Storybook Visual"
on:
workflow_call:
inputs:
Expand All @@ -13,6 +13,8 @@ jobs:
working-directory: ui
shell: bash
runs-on: ubuntu-latest
env:
isPR: ${{ github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main' }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -29,12 +31,13 @@ jobs:
run: yarn playwright install
- name: Build Storybook
run: yarn build-storybook --quiet
- name: Serve Storybook and run tests
- name: Serve Storybook and update screenshots
run: |
npx concurrently --kill-others --success first -n "SB,TEST" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test-storybook -u"
"npx wait-on tcp:6006 && yarn test-storybook ${{ env.isPR && '-u' || ''}}"
- name: Import GPG key
if: ${{ env.isPR }}
uses: crazy-max/ghaction-import-gpg@v6
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
Expand All @@ -44,12 +47,13 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true
- name: Push updated screenshots
if: ${{ env.isPR }}
run: |
git add \*.png
git diff --staged --exit-code || (git commit -S -m "update screenshots" && git push)
- uses: actions/upload-artifact@v4
name: 'Upload test report'
name: "Upload test report"
if: ${{ failure() }}
with:
name: storybook-tests-report
path: ui/test-reports/
path: ui/test-reports/
5 changes: 3 additions & 2 deletions ui/.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ WORKDIR /usr/src/app

# Install dependencies
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile && \
yarn playwright install --with-deps
RUN npm install --global --force yarn && \
yarn install --frozen-lockfile && \
yarn playwright install --with-deps chromium

# Copy everything except 'src' (specified in .dockerignore)
COPY . .
Expand Down

0 comments on commit ef93d0e

Please sign in to comment.