Skip to content

Commit

Permalink
BSD fixes #271: Updated to 1.4.0-alpha release of robovalidate and ad…
Browse files Browse the repository at this point in the history
…ded github action to validate.
  • Loading branch information
mattsqd committed Aug 6, 2024
1 parent 9b355cf commit af2e4fd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 6 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/run-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Run validation with RoboValidate

on:
# Run on any branch so validate branch can always run.
push:
# Commit message validation requires a target branch which is only available in a PR.
pull_request:

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
# https://github.com/shivammathur/setup-php?tab=readme-ov-file#disable-coverage
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 and initialize Robo
run: |
composer install --ignore-platform-reqs --optimize-autoloader --no-progress --no-ansi
# If a Robo command exits with a failure and a RoboFile.php does not exist
# a warning about 'Robo is not initialized here. Please run `robo init` to create a new RoboFile.'
# will be created, which might make users think that is what the error was caused by.
if [ ! -f "RoboFile.php" ]; then
vendor/bin/robo init
fi
- name: Validate a change to any branch
if: github.event_name == 'push'
run: |
# Initialize status variables to 0
status1=0
status2=0
status3=0
# Run all commands and capture their exit statuses
vendor/bin/robo validate:branch-name || status1=$? || status1=0
vendor/bin/robo validate:composer-lock || status3=$? || status3=0
vendor/bin/robo validate:coding-standards || status2=$? || status2=0
# Exit with a non-zero status if any command failed
if [ "$status1" -ne 0 ] || [ "$status2" -ne 0 ] || [ "$status3" -ne 0 ]; then
exit 1
fi
- name: Validate pull requests
if: github.event_name == 'pull_request'
run: |
vendor/bin/robo validate:commit-messages --target-branch="${{ github.base_ref }}" --current-branch="${{ github.head_ref }}"
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions composer.log
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ d0b264b8bfd2f16b57808145e6c7b950|Matt Poole|feature/BSD-212-smpt-enable|Tue Jul
1cc6d6789783135d19582c52d712125d|Buddy Harlow|feature/BSD-244-blog-images-marked-decorative|Wed Jul 31 14:36:44 EDT 2024|./composer.sh require drupal/decorative_image_widget
4d4eeea0afa18c0874d2696e7ccf9b64|Matt Poole|feature/BSD-244-blog-images-marked-decorative|Wed Jul 31 14:45:51 EDT 2024|./composer.sh require drupal/media_library_edit:^3.0
3257dd27ca54b3c2e8ec96a100874f2a|Matt Poole|feature/BSD-254-update-deps|Wed Jul 31 15:09:47 EDT 2024|./composer.sh update
59d81fa4a3cb5b4021dd9824956e194c|Matt Poole|feature/BSD-271-validation-action|Tue Aug 6 13:13:48 EDT 2024|./composer.sh update mattsqd/robovalidate

0 comments on commit af2e4fd

Please sign in to comment.