diff --git a/.github/workflows/storybook-visual.yml b/.github/workflows/storybook-visual.yml index 22ddf73c0..eb650b3fb 100644 --- a/.github/workflows/storybook-visual.yml +++ b/.github/workflows/storybook-visual.yml @@ -1,4 +1,4 @@ -name: 'Storybook Visual' +name: "Storybook Visual" on: workflow_call: inputs: @@ -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: @@ -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 }} @@ -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/ \ No newline at end of file + path: ui/test-reports/ diff --git a/ui/.Dockerfile b/ui/.Dockerfile index 5dcd277d8..433832eb2 100644 --- a/ui/.Dockerfile +++ b/ui/.Dockerfile @@ -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 . .