Skip to content

fix: Add sprockets dependencies and fix Rails 8 compatibility #1

fix: Add sprockets dependencies and fix Rails 8 compatibility

fix: Add sprockets dependencies and fix Rails 8 compatibility #1

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
ruby: ['3.2', '3.3']
gemfile:
- rails_7_0_activeadmin_4_sprockets
- rails_7_1_activeadmin_4_sprockets
- rails_7_2_activeadmin_4_sprockets
- rails_7_2_activeadmin_4_importmap
- rails_7_2_activeadmin_4_esbuild
- rails_8_0_activeadmin_4_propshaft
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
RAILS_ENV: test
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/ms-playwright
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
# Cache APT packages for Playwright dependencies
- name: Cache APT packages
uses: awalsh128/cache-apt-pkgs-action@v1.5.3
with:
packages: libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libdbus-1-3 libatspi2.0-0 libx11-6 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxcb1 libxkbcommon0 libpango-1.0-0 libcairo2 libasound2 libvips file
version: 1.0
execute_install_scripts: true
# Get Playwright version for cache key
- name: Get Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test 2>/dev/null | grep @playwright/test | sed 's/.*@//' | head -1)
if [ -z "$PLAYWRIGHT_VERSION" ]; then
PLAYWRIGHT_VERSION=$(npx playwright --version | sed 's/Version //')
fi
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
# Cache Playwright browsers
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-
${{ runner.os }}-playwright-
# Install Node.js and npm dependencies
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install npm dependencies
run: npm install
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium
- name: Setup test database
run: |
cd spec/dummy
bundle exec rake db:create db:schema:load
- name: Prepare assets
run: |
bundle exec rake prepare_assets
cd spec/dummy && bundle exec rake webpacker:compile
- name: Run Utils Tests
run: |
bundle exec rspec ./spec/lib -f progress --no-color -p 10
- name: Run Feature Tests
run: |
bundle exec rspec ./spec/features -f progress --no-color -p 10
- name: Upload coverage reports
if: matrix.ruby == '3.3' && matrix.gemfile == 'rails_7_2_activeadmin_4'
uses: codecov/codecov-action@v4
with:
file: ./coverage/coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop --force-exclusion
build-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build npm package
run: npm run prepublishOnly
- name: Check package
run: npm pack --dry-run
- name: Run ESLint
run: npx eslint app/javascript --ext .js