Skip to content

Commit

Permalink
Workflows, add lint and lando start
Browse files Browse the repository at this point in the history
  • Loading branch information
almunnings committed Feb 3, 2024
1 parent 6eb1b4b commit a9d65ec
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ on:
push:
branches: [main]

env:
TERM: xterm

jobs:
lando:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: lando/setup-lando@v2
with:
lando-version: latest
- run: lando start

ddev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ddev/github-action-setup-ddev@v1
with:
version: latest
47 changes: 47 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint

on:
pull_request:

env:
PHP_VERSION: 8.1
TERM: xterm

jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: "actions/checkout@v4"
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: "{docroot,web}/{modules,themes}/custom/**/*.{php,module,inc,install,test,profile,theme,yml}"
files_ignore: |
*Test.php
*TestBase.php
**/tests/
- name: Set up PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr, phpcs, composer"
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}

- name: Install Drupal Coder
run: |
composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --ignore-platform-reqs drupal/coder
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}

- name: PHPCS
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
phpcs -q --report=checkstyle --standard=Drupal,DrupalPractice -n $file | cs2pr
done
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}

0 comments on commit a9d65ec

Please sign in to comment.