diff --git a/.github/workflows/test_and_scan.yml b/.github/workflows/test_and_scan.yml index 61e5fc4..49eb697 100644 --- a/.github/workflows/test_and_scan.yml +++ b/.github/workflows/test_and_scan.yml @@ -11,27 +11,51 @@ on: - '**' jobs: + lint: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.0" + bundler-cache: true + + - name: Lint via rubocop + run: + bundle exec rake -- rubocop + test: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + strategy: + matrix: + ruby-version: ["2.7", "3.0", "3.1", "3.2", "3.4"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Test + run: | + bundle exec rake -- test + sonar: + runs-on: ubuntu-20.04 + needs: test + steps: - name: Checkout code - uses: actions/checkout@v3 - + uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0.0' # Specify the Ruby version you are using - bundler-cache: true # Caches 'bundle install' automatically - - - name: Install dependencies - run: bundle install - - - name: Run RuboCop - run: bundle exec rubocop - - - name: Run tests - run: bundle exec rake test + ruby-version: "3.0" + bundler-cache: true - name: Run SonarCloud Scan env: