chore: lean on Ruby 4 for fallback chains and the bot token #512
Workflow file for this run
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: | |
| pull_request: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| scan_ruby: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install system packages | |
| run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libvips42 | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Scan for common Rails security vulnerabilities using static analysis | |
| run: bin/brakeman --no-pager | |
| scan_js: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install system packages | |
| run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libvips42 | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Scan for security vulnerabilities in JavaScript dependencies | |
| run: bin/importmap audit | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install system packages | |
| run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libvips42 | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Lint code for consistent style | |
| run: bin/rubocop -f github | |
| test: | |
| runs-on: ubuntu-latest | |
| # services: | |
| # redis: | |
| # image: redis | |
| # ports: | |
| # - 6379:6379 | |
| # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - name: Install packages | |
| run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev libvips42 pkg-config google-chrome-stable | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Run tests | |
| env: | |
| RAILS_ENV: test | |
| # REDIS_URL: redis://localhost:6379/0 | |
| run: bin/rails db:test:prepare test test:system | |
| - name: Keep screenshots from failed system tests | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: screenshots | |
| path: ${{ github.workspace }}/tmp/screenshots | |
| if-no-files-found: ignore | |
| - name: Extract coverage percentage | |
| if: success() && github.ref == 'refs/heads/main' | |
| id: coverage | |
| run: | | |
| COVERAGE=$(grep -oP '[\d.]+(?=%)' coverage/summary.txt | head -1) | |
| echo "percent=$COVERAGE" >> "$GITHUB_OUTPUT" | |
| - name: Extract Ruby version | |
| if: success() && github.ref == 'refs/heads/main' | |
| id: ruby | |
| run: | | |
| RUBY_VER=$(cat .ruby-version | sed 's/ruby-//') | |
| echo "version=$RUBY_VER" >> "$GITHUB_OUTPUT" | |
| - name: Extract Rails version | |
| if: success() && github.ref == 'refs/heads/main' | |
| id: rails | |
| run: | | |
| RAILS_VER=$(grep -A1 '^\s*rails ' Gemfile.lock | grep -oP '[\d.]+' | head -1) | |
| echo "version=$RAILS_VER" >> "$GITHUB_OUTPUT" | |
| - name: Update coverage badge | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: schneegans/dynamic-badges-action@v1.9.0 | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: ${{ vars.BADGE_GIST_ID }} | |
| filename: coverage.json | |
| label: coverage | |
| message: "${{ steps.coverage.outputs.percent }}%" | |
| valColorRange: ${{ steps.coverage.outputs.percent }} | |
| minColorRange: 0 | |
| maxColorRange: 100 | |
| - name: Update Ruby badge | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: schneegans/dynamic-badges-action@v1.9.0 | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: ${{ vars.BADGE_GIST_ID }} | |
| filename: ruby.json | |
| label: ruby | |
| message: "${{ steps.ruby.outputs.version }}" | |
| color: CC342D | |
| - name: Update Rails badge | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: schneegans/dynamic-badges-action@v1.9.0 | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: ${{ vars.BADGE_GIST_ID }} | |
| filename: rails.json | |
| label: rails | |
| message: "${{ steps.rails.outputs.version }}" | |
| color: D30001 |