Bump actions/checkout from 4 to 6 #145
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: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Security audit dependencies | |
| run: bundle exec bundler-audit --update | |
| - name: Run RuboCop | |
| run: bundle exec rubocop --parallel | |
| test: | |
| name: Test (Ruby ${{ matrix.ruby }}) | |
| runs-on: ubuntu-latest | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - ruby: '3.2' | |
| experimental: false | |
| - ruby: '3.3' | |
| experimental: false | |
| - ruby: '3.4' | |
| experimental: true | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - name: Set up database | |
| run: RAILS_ENV=test bundle exec rake -f spec/dummy/Rakefile db:schema:load | |
| - name: Run tests | |
| run: bundle exec rspec | |
| generate-docs: | |
| name: Generate Docs | |
| needs: [lint, test] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for relevant changes | |
| id: changes | |
| run: | | |
| CHANGED=$(git diff --name-only HEAD~1 HEAD | grep -E '^(lib/|docs/playground/)' | grep -v 'docs/playground/public/' | grep -v 'docs/reference/' || true) | |
| if [ -z "$CHANGED" ]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "No relevant changes, skipping generation" | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "Changed files:" | |
| echo "$CHANGED" | |
| fi | |
| - uses: ruby/setup-ruby@v1 | |
| if: steps.changes.outputs.skip != 'true' | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| working-directory: docs/playground | |
| - name: Cache YARD | |
| if: steps.changes.outputs.skip != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: .yardoc | |
| key: yard-${{ hashFiles('lib/**/*.rb') }} | |
| - name: Generate docs | |
| if: steps.changes.outputs.skip != 'true' | |
| env: | |
| RAILS_ENV: test | |
| run: | | |
| cd docs/playground | |
| bundle exec rake db:setup | |
| bundle exec rake apiwork:docs:reference | |
| bundle exec rake docs:generate | |
| - name: Commit and push | |
| if: steps.changes.outputs.skip != 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/reference/ docs/playground/public/ docs/examples/ | |
| git diff --staged --quiet || git commit -m "chore: regenerate docs" | |
| git push | |
| all-green: | |
| name: All tests passing | |
| if: always() | |
| needs: [lint, test, generate-docs] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check status | |
| run: | | |
| if [ "${{ needs.lint.result }}" != "success" ]; then | |
| echo "Lint failed" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.test.result }}" != "success" ]; then | |
| echo "Tests failed" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.generate-docs.result }}" != "success" ] && [ "${{ needs.generate-docs.result }}" != "skipped" ]; then | |
| echo "Docs generation failed" | |
| exit 1 | |
| fi |