1# https://docs.github.com/en/actions
2
3name: "Update screenshots"
4
5on:
6  workflow_dispatch:
7
8jobs:
9  tests_update_snapshots:
10    name: "Update Tests snapshots"
11
12    runs-on: "ubuntu-latest"
13
14    strategy:
15      matrix:
16        php-version:
17          - "8.2"
18        node-version:
19          - "22.x"
20
21    env:
22      HTTP_HOST: "localhost:8080"
23
24    steps:
25      - name: "Checkout"
26        uses: "actions/checkout@v4"
27
28      - name: "Set up PHP"
29        uses: "shivammathur/setup-php@v2"
30        with:
31          coverage: "none"
32          extensions: "none, curl, dom, json, mbstring, tokenizer, xml, xmlwriter"
33          php-version: "${{ matrix.php-version }}"
34
35      - name: Use Node.js ${{ matrix.node-version }}
36        uses: actions/setup-node@v4
37        with:
38          node-version: ${{ matrix.node-version }}
39
40      - name: "Set up problem matchers for PHP"
41        run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
42
43      - name: "Set up problem matchers for phpunit/phpunit"
44        run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
45
46      - name: "Determine composer cache directory"
47        run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
48
49      - name: "Cache dependencies installed with composer"
50        uses: "actions/cache@v4"
51        with:
52          path: "${{ env.COMPOSER_CACHE_DIR }}"
53          key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
54          restore-keys: "php-${{ matrix.php-version }}-composer-"
55
56      - name: "Install dependencies with composer"
57        run: "composer install --ansi --no-interaction --no-progress"
58
59      - name: "Install dependencies"
60        run: "yarn install"
61
62      - name: "Install Playwright"
63        run: "npx playwright install"
64
65      - name: "Run visual tests"
66        run: "make tests_update_snapshots"
67
68      - name: Update snapshots
69        uses: test-room-7/action-update-file@v1
70        if: ${{ !cancelled() }}
71        with:
72          file-path: tests/Visual/**/*
73          commit-msg: Update snapshots
74          github-token: ${{ secrets.GITHUB_TOKEN }}
75