|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: |
| 4 | + - master |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + services: |
| 13 | + redis: |
| 14 | + image: redis |
| 15 | + ports: |
| 16 | + - 6379:6379 |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Set up Ruby |
| 24 | + uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 |
| 25 | + with: |
| 26 | + ruby-version: 2.4 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: bundle install |
| 30 | + |
| 31 | + - name: Run tests |
| 32 | + run: bundle exec rake |
| 33 | + |
| 34 | + - name: SonarQube Scan (Push) |
| 35 | + if: github.event_name == 'push' |
| 36 | + uses: SonarSource/sonarcloud-github-action@v1.5 |
| 37 | + env: |
| 38 | + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} |
| 39 | + with: |
| 40 | + projectBaseDir: . |
| 41 | + args: > |
| 42 | + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} |
| 43 | + -Dsonar.projectName=${{ github.event.repository.name }} |
| 44 | + -Dsonar.projectKey=${{ github.event.repository.name }} |
| 45 | + -Dsonar.ruby.coverage.reportPaths='coverage/.resultset.json' |
| 46 | + -Dsonar.c.file.suffixes=- |
| 47 | + -Dsonar.cpp.file.suffixes=- |
| 48 | + -Dsonar.objc.file.suffixes=- |
| 49 | + -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" |
| 50 | + -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" |
| 51 | +
|
| 52 | + - name: SonarQube Scan (Pull Request) |
| 53 | + if: github.event_name == 'pull_request' |
| 54 | + uses: SonarSource/sonarcloud-github-action@v1.5 |
| 55 | + env: |
| 56 | + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} |
| 57 | + with: |
| 58 | + projectBaseDir: . |
| 59 | + args: > |
| 60 | + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} |
| 61 | + -Dsonar.projectName=${{ github.event.repository.name }} |
| 62 | + -Dsonar.projectKey=${{ github.event.repository.name }} |
| 63 | + -Dsonar.ruby.coverage.reportPaths='coverage/.resultset.json' |
| 64 | + -Dsonar.c.file.suffixes=- |
| 65 | + -Dsonar.cpp.file.suffixes=- |
| 66 | + -Dsonar.objc.file.suffixes=- |
| 67 | + -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" |
| 68 | + -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" |
| 69 | + -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} |
| 70 | + -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} |
| 71 | + -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} |
0 commit comments