hopsoft/turbo_ready

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Tests

permissions:
  # Read the baseline artifact in order to perform
  # the AppMap comparison.
  actions: read

  # Commit the AppMap configuration.
  # If the EndBug/add-and-commit is removed,
  # this can be changed to 'read'.
  contents: write

  # Add check annotations to the source code when
  # a problem is detected.
  checks: write

  # Add a comment to the pull request.
  pull-requests: write

on:
  # Run on pull request, so that the PR can be analyzed.
  pull_request:
    branches:
      - '*'

  # Run on merge to the base branch, so that the baseline
  # AppMap archive can be brought up-to-date.
  # If your base branch is not 'main', (e.g. 'master', 'develop'),
  # change this accordingly.
  push:
    branches:
      - main

  # Run weekly, so that the baseline AppMap artifact does not expire.
  schedule:
    - cron: '0 0 * * 0'

jobs:
  ruby_test:
    name: Ruby Test Action
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['3.0', '3.1', '3.2']

    steps:
      - uses: actions/checkout@v4

      - name: Set up Ruby ${{ matrix.ruby-version }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20.x'
          cache: 'npm'

      - name: NPM Install
        run: 'npm install --legacy-peer-deps'

      - name: Install Playwright Browsers
        run: 'npx playwright install chromium --with-deps'

      - name: Run Tests
        run: 'bundle exec rake test'

      - name: Save AppMaps
        uses: actions/cache/save@v3
        if: always()
        with:
          path: ./tmp/appmap
          key: appmaps-${{ github.sha }}-${{ github.run_attempt }}

  appmap-analysis:
    if: always()
    needs: [ruby_test]
    uses: getappmap/analyze-action/.github/workflows/appmap-analysis.yml@v1
    permissions:
      actions: read
      contents: read
      checks: write
      pull-requests: write