Skip to content

[Toolkit] Add lint kit command and CI lint workflow #6

[Toolkit] Add lint kit command and CI lint workflow

[Toolkit] Add lint kit command and CI lint workflow #6

name: Toolkit Lint Kits
defaults:
run:
shell: bash
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'src/Toolkit/**'
- '.github/workflows/toolkit-lint-kits.yaml'
pull_request:
paths:
- 'src/Toolkit/**'
- '.github/workflows/toolkit-lint-kits.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
discover:
name: Discover kits
runs-on: ubuntu-latest
outputs:
kits: ${{ steps.set.outputs.kits }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
persist-credentials: false
- id: set
name: Build matrix from src/Toolkit/kits/*
run: |
KITS=$(find src/Toolkit/kits -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | jq -R . | jq -sc .)
echo "Kits: $KITS"
echo "kits=$KITS" >> "$GITHUB_OUTPUT"
lint:
name: Lint ${{ matrix.kit }}
needs: discover
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kit: ${{ fromJson(needs.discover.outputs.kits) }}
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@083d5237d9340d541bf95e2a6eceaf3529b85892
with:
php-version: '8.4'
- name: Install Toolkit dependencies
uses: ramsey/composer-install@5c2bcf28d7b060ef3c601d7b476d5430a7b46c27
with:
working-directory: src/Toolkit
- name: Lint kit
working-directory: src/Toolkit
env:
COLUMNS: 120
KIT: ${{ matrix.kit }}
run: php bin/ux-toolkit-kit-lint --ansi --fail-on-warning "kits/$KIT"