|
| 1 | +# Generates Playwright visual baseline images in CI and uploads them to S3 |
| 2 | +# |
| 3 | +# This workflow builds the project, runs Playwright to produce fresh baselines, |
| 4 | +# and pushes them to S3. Use this when baselines need to be regenerated from |
| 5 | +# scratch in a clean CI environment. |
| 6 | +# |
| 7 | +name: CI Baselines Generate & Upload |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + workflow_call: |
| 12 | +env: |
| 13 | + NPM_AUTH_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }} |
| 14 | + CKEDITOR5_LICENSE_KEY: ${{ secrets.CKEDITOR5_LICENSE_KEY }} |
| 15 | + |
| 16 | +jobs: |
| 17 | + upload: |
| 18 | + name: Generate and upload baselines to S3 |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + |
| 23 | + - uses: actions/setup-node@v6 |
| 24 | + with: |
| 25 | + node-version: ${{ vars.NODE_VERSION }} |
| 26 | + |
| 27 | + - name: Install root dependencies |
| 28 | + run: npm install |
| 29 | + |
| 30 | + - name: Build |
| 31 | + run: npm run build |
| 32 | + |
| 33 | + - name: Install E2E test dependencies |
| 34 | + run: | |
| 35 | + npm install |
| 36 | + npx playwright install --with-deps |
| 37 | + working-directory: ./tests |
| 38 | + |
| 39 | + - name: Generate baseline images |
| 40 | + run: npx playwright test -g "MTHTML-23 Validate formula alignment" --update-snapshots |
| 41 | + working-directory: ./tests |
| 42 | + |
| 43 | + - name: Configure AWS credentials |
| 44 | + uses: aws-actions/configure-aws-credentials@v4 |
| 45 | + with: |
| 46 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} |
| 47 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} |
| 48 | + aws-region: eu-west-2 |
| 49 | + |
| 50 | + - name: Upload baselines to S3 |
| 51 | + run: | |
| 52 | + aws s3 sync tests/fixtures/ s3://wiris-integrations-staging-html/html/baselines/ci \ |
| 53 | + --delete \ |
| 54 | + --exclude "*" \ |
| 55 | + --include "*.png" |
| 56 | + echo "Baselines uploaded successfully" |
| 57 | +
|
| 58 | + - name: Generate and upload manifest |
| 59 | + run: | |
| 60 | + find tests/fixtures/ -name "*.png" -printf "%P\n" | sort > manifest.txt |
| 61 | + aws s3 cp manifest.txt s3://wiris-integrations-staging-html/html/baselines/ci/manifest.txt |
| 62 | + echo "Manifest uploaded successfully" |
0 commit comments