From e1490307b6c5cd2e63733da105443d6e58314551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Thu, 30 Jan 2025 11:05:28 +0100 Subject: [PATCH] Build Portal before running "Run visual tests" --- .github/workflows/icons-lib.yml | 76 ++++++++++--------------- .github/workflows/visual-regression.yml | 3 + 2 files changed, 33 insertions(+), 46 deletions(-) diff --git a/.github/workflows/icons-lib.yml b/.github/workflows/icons-lib.yml index d5d4737de4a..fe95d61487e 100644 --- a/.github/workflows/icons-lib.yml +++ b/.github/workflows/icons-lib.yml @@ -21,7 +21,7 @@ jobs: process-icons: name: Fetch and Build Icons - runs-on: ubuntu-latest + runs-on: macos-15 timeout-minutes: 60 @@ -48,67 +48,51 @@ jobs: if: steps.modules-cache.outputs.cache-hit != 'true' run: yarn install --immutable + - name: Use Playwright cache + uses: actions/cache@v4 + id: playwright-cache + with: + path: | + ~/Library/Caches/ms-playwright + ~/.cache/ms-playwright + %USERPROFILE%\AppData\Local\ms-playwright + key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-playwright-${{ hashFiles('**/yarn.lock') }} + - run: yarn workspace @dnb/eufemia playwright install --with-deps firefox + if: steps.playwright-cache.outputs.cache-hit != 'true' + - run: yarn workspace @dnb/eufemia playwright install-deps firefox + if: steps.playwright-cache.outputs.cache-hit == 'true' + - name: Icons fetch and prebuild run: yarn workspace @dnb/eufemia prebuild:figma:ci - name: Prebuild Library run: yarn workspace @dnb/eufemia prebuild:ci + - name: Postbuild Library + run: yarn workspace @dnb/eufemia postbuild:ci + - name: Test prebuild run: yarn workspace @dnb/eufemia test:update - name: Build portal run: yarn workspace dnb-design-system-portal build:visual-test - - name: Store portal artifacts - uses: actions/upload-artifact@v4 - with: - name: portal-build-artifact - path: ./packages/dnb-design-system-portal/public - - - name: Commit icons - run: yarn workspace @dnb/eufemia postbuild:commit - - visual-test: - needs: process-icons - name: Run visual e2e-test for icons - - runs-on: macos-latest - - timeout-minutes: 60 - - steps: - - name: Git checkout - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version-file: 'package.json' - - - name: Use yarn cache - uses: actions/cache@v4 - id: yarn-cache - with: - path: ./.yarn/cache - key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps- - - - name: Install dependencies - run: yarn install --immutable + - name: Run visual tests + run: yarn workspace dnb-design-system-portal test:screenshots:ci:update - - name: Re-store portal artifacts - uses: actions/download-artifact@v4.1.7 + - uses: actions/upload-artifact@v4 + if: failure() with: - name: portal-build-artifact - path: ./packages/dnb-design-system-portal/public + name: visual-test-artifact + path: | + ./packages/dnb-eufemia/src/**/*.snap-diff.png + ./packages/dnb-eufemia/jest-visual-diff-report/* - - name: Run visual tests - run: yarn workspace dnb-design-system-portal test:screenshots:ci + - name: Run visual tests info + if: failure() + run: echo '\n\nšŸ‘‰ Download the diff files as a ZIP file. \nIt is called "visual-test-artifact" and you find it in the test "Summary" under "Artifacts".\n\n\n' - - name: Commit updated snapshots + - name: Commit icons and updated snapshots run: yarn workspace @dnb/eufemia postbuild:commit - name: Slack diff --git a/.github/workflows/visual-regression.yml b/.github/workflows/visual-regression.yml index 8049784b35e..cd5e5345a34 100644 --- a/.github/workflows/visual-regression.yml +++ b/.github/workflows/visual-regression.yml @@ -37,6 +37,7 @@ env: ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }} ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} RUN_POST_BUILD: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }} + RUN_VISUAL_TEST: ${{ !startsWith(github.ref, 'refs/heads/icon') }} jobs: visual-regression: @@ -91,9 +92,11 @@ jobs: run: yarn workspace @dnb/eufemia postbuild:ci - name: Build portal + if: env.RUN_VISUAL_TEST == 'true' run: yarn workspace dnb-design-system-portal build:visual-test - name: Run visual tests + if: env.RUN_VISUAL_TEST == 'true' run: yarn workspace dnb-design-system-portal test:screenshots:ci - uses: actions/upload-artifact@v4