CI #867
This file contains 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: CI | |
on: | |
pull_request: ~ | |
push: | |
branches: ['main'] | |
schedule: | |
- cron: '0 */12 * * *' | |
jobs: | |
composer-validate: | |
name: Validate composer.json | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: none | |
- name: Validate composer.json | |
run: composer validate --strict | |
cs-php: | |
name: Check coding standards | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: php-cs-fixer | |
- name: Run PHP-CS-Fixer | |
run: php-cs-fixer fix --dry-run --diff | |
sca-php: | |
name: PHPStan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
- name: Install composer dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Run PHPStan | |
run: vendor/bin/phpstan analyse | |
cs-js: | |
name: JavaScript Coding Style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Get yarn cache directory path | |
working-directory: ./storybook | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- working-directory: ./storybook | |
run: yarn install --immutable | |
- working-directory: ./storybook | |
run: yarn check-lint | |
- working-directory: ./storybook | |
run: yarn check-format | |
tests-php: | |
name: PHPUnit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
- name: Install composer dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Run PHPUnit | |
run: vendor/bin/simple-phpunit | |
tests-js: | |
name: Vitest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Get yarn cache directory path | |
working-directory: ./storybook | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- working-directory: ./storybook | |
run: yarn install --immutable | |
- working-directory: ./storybook | |
run: yarn test | |
js-dist-current: | |
name: Check for un-built JS dist files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Get yarn cache directory path | |
working-directory: ./storybook | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- working-directory: ./storybook | |
run: yarn install --immutable && yarn build | |
- name: Check if JS dist files are current | |
id: changes | |
run: | | |
echo "STATUS=$(git status --porcelain)" >> $GITHUB_OUTPUT | |
- name: No changes found | |
if: steps.changes.outputs.STATUS == '' | |
run: | | |
echo "git status is clean" | |
- name: Changes were found | |
if: steps.changes.outputs.STATUS != '' | |
run: | | |
echo "JS dist files need to be rebuilt" | |
echo "${{ steps.changes.outputs.STATUS }}" | |
exit 1 | |
tests-integration: | |
name: Storybook Test Runner | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
- name: Configure sandbox app | |
run: ./sandbox/bin/setup-standalone | |
- name: Install Playwright | |
run: npx playwright install --with-deps | |
working-directory: sandbox | |
- name: Run Storybook test suite | |
run: ./scripts/test-sandbox.sh |