kapoorlakshya/screen-recorder

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
  
name: Tests

on: [push, pull_request]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  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 rake rubocop

  test-ubuntu:
    runs-on: ubuntu-latest
    needs: lint
    strategy:
      matrix:
        ruby-version: [3.0, jruby]
    env:
      DISPLAY: ":0"
    steps:
    - uses: actions/checkout@v4
    - name: Set up ffmpeg
      uses: FedericoCarboni/setup-ffmpeg@v3
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
      id: setup-ffmpeg
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true
    - run: bundle list
    - name: Run tests
      uses: coactions/setup-xvfb@v1
      with:
        run: bundle exec rake spec
        options: :99 -ac -screen 0 640x480x24

  test-windows:
    runs-on: windows-latest
    needs: lint
    strategy:
      matrix:
        ruby-version: [3.0]
    steps:
      - uses: actions/checkout@v4
      - name: Set up ffmpeg
        uses: FedericoCarboni/setup-ffmpeg@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
        id: setup-ffmpeg
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true
      - run: bundle list
      - name: Run tests
        run: bundle exec rake spec

  test-macos:
    runs-on: macos-13
    needs: lint
    strategy:
      matrix:
        ruby-version: [3.0]
    steps:
      - uses: actions/checkout@v4
      - name: Set up ffmpeg
        uses: FedericoCarboni/setup-ffmpeg@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
        id: setup-ffmpeg
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true
      - run: bundle list
      - name: Run tests
        run: bundle exec rake spec