Merge pull request #17 from MichaelvanLaar/claude/code-scanning-secur… #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| php-tests: | |
| name: PHP Tests (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| php: ["8.2", "8.3", "8.4"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json, pcre | |
| coverage: none | |
| - name: Get Composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Run PHPUnit tests | |
| run: vendor/bin/phpunit | |
| - name: Run PHPStan | |
| run: vendor/bin/phpstan analyse --memory-limit=1G | |
| javascript-tests: | |
| name: JavaScript Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint:js | |
| - name: Run Stylelint | |
| run: npm run lint:css | |
| - name: Run YAML Lint | |
| run: npm run lint:yaml | |
| - name: Run Vitest tests with coverage | |
| run: npm run test:js:coverage | |
| - name: Upload JS coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./.coverage/js/lcov.info | |
| flags: javascript | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| build-test: | |
| name: Build Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Build assets | |
| run: npm run build | |
| - name: Check for build artifacts | |
| run: | | |
| # hashup renames main.css → main.<hash>.css after webpack runs | |
| find assets/css -maxdepth 1 -type f -name 'main*.css' -size +0c | grep -q . \ | |
| || (echo "CSS build produced empty or missing file" && exit 1) | |
| find assets/js -maxdepth 1 -type f -name 'main*.js' -size +0c | grep -q . \ | |
| || (echo "JS build produced empty or missing file" && exit 1) |