Skip to content

Commit

Permalink
[CI] Add yaml validation
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Sep 16, 2021
1 parent d4b148f commit 62cb254
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: YAML

on:
push:
paths:
- '**.yaml'
- '**.yml'
pull_request:
paths:
- '**.yaml'
- '**.yml'

jobs:
yaml-validation:
name: YAML validation
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mbstring
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: |
composer update --no-progress --prefer-dist --optimize-autoloader
- name: Lint yaml files
run: |
make yaml-lint
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: qa
qa: coding-standards tests
qa: coding-standards tests yaml-lint

.PHONY: code-coverage
code-coverage: vendor
Expand All @@ -22,6 +22,10 @@ vendor: composer.json composer.lock
xlf-lint:
xmllint --schema Resources/Private/Language/xliff-core-1.2-strict.xsd --noout Resources/Private/Language/*.xlf

.PHONY: yaml-lint
yaml-lint: vendor
find -regex '.*\.ya?ml' ! -path "./.Build/*" ! -path "./Build/*" -exec .Build/bin/yaml-lint -v {} \;

.PHONY: zip
zip:
grep -Po "(?<='version' => ')([0-9]+\.[0-9]+\.[0-9]+)" ext_emconf.php | xargs -I {version} sh -c 'mkdir -p ../zip; git archive -v -o "../zip/$(shell basename $(CURDIR))_{version}.zip" v{version}'
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"friendsofphp/php-cs-fixer": "^2.19",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^8.5 || ^9.5",
"symfony/yaml": "^4.4 || 5.3",
"typo3/coding-standards": "^0.3"
},
"suggest": {
Expand Down

0 comments on commit 62cb254

Please sign in to comment.