Migrate to ActiveAdmin 4, Rails 8, and rails-settings-cached 2.x #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ['3.3', '3.4'] | |
| gemfile: | |
| - rails_7.2_active_admin_4.x | |
| - rails_8.0_active_admin_4.x | |
| env: | |
| BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile | |
| RAILS_ENV: test | |
| PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/ms-playwright | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - 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 | |
| version: 1.0 | |
| execute_install_scripts: true | |
| # Get Playwright version for cache key | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: | | |
| PLAYWRIGHT_VERSION=$(cd spec/internal && 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('spec/internal/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}- | |
| ${{ runner.os }}-playwright- | |
| - name: Install npm dependencies | |
| run: | | |
| cd spec/internal | |
| npm install | |
| - name: Build JavaScript assets | |
| run: | | |
| cd spec/internal | |
| npm run build:js | |
| - name: Build CSS assets | |
| run: | | |
| cd spec/internal | |
| npm run build:css | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: npx playwright install chromium | |
| - name: Setup test database | |
| run: | | |
| cd spec/internal | |
| ./bin/rails db:create db:schema:load RAILS_ENV=test | |
| - name: Run tests with coverage | |
| run: bundle exec rspec --format progress | |
| - name: Upload coverage | |
| if: matrix.ruby == '3.4' && matrix.gemfile == 'rails_8.0_active_admin_4.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage/ | |
| retention-days: 7 | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - name: Run RuboCop | |
| run: bundle exec rubocop --force-exclusion |