Skip to content

WIP Libaaec 38 migrate from circle ci to GitHub actions to handle ci #35

WIP Libaaec 38 migrate from circle ci to GitHub actions to handle ci

WIP Libaaec 38 migrate from circle ci to GitHub actions to handle ci #35

Workflow file for this run

name: Ensure Rubocop Passes
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # Automatically handles caching for gems
# Step 3: Restore Rubocop Cache
- name: Restore Rubocop Cache
uses: actions/cache@v3
with:
path: .rubocop_cache
key: rubocop-cache-${{ runner.os }}-${{ hashFiles('**/*.rb') }}
restore-keys: |
rubocop-cache-${{ runner.os }}-
# Step 4: Install Dependencies
- name: Install Dependencies
run: bundle install
# Step 5: Run Rubocop and Save Output
- name: Run Rubocop
run: |
mkdir -p tmp
bundle exec rubocop --format offenses --out tmp/rubocop-output.txt
continue-on-error: true
# Step 6: Analyze Rubocop Output
- name: Analyze Rubocop Output
run: |
if grep -q 'Offense:' tmp/rubocop-output.txt; then
echo "Rubocop found offenses."
exit 1
else
echo "Rubocop passed without offenses."
fi
# Step 7: Upload Rubocop Report
- name: Upload Rubocop Report
uses: actions/upload-artifact@v4
with:
name: rubocop-report
path: tmp/rubocop-output.txt
# Step 8: Save Rubocop Cache
- name: Save Rubocop Cache
uses: actions/cache@v3
with:
path: .rubocop_cache
key: rubocop-cache-${{ runner.os }}-${{ hashFiles('**/*.rb') }}