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