diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2d5cc5ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: ci +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + services: + redis: + image: redis + ports: + - 6379:6379 + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.6' + + - name: Install dependencies + run: | + pip install -U setuptools pip + pip install -e .[cpphash,redis,uwsgi] + + - name: Run tests + run: python setup.py test + + - name: SonarQube Scan (Push) + if: github.event_name == 'push' + uses: SonarSource/sonarcloud-github-action@v1.5 + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + with: + projectBaseDir: . + args: > + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} + -Dsonar.projectName=${{ github.event.repository.name }} + -Dsonar.projectKey=${{ github.event.repository.name }} + -Dsonar.python.coverage.reportPaths=coverage.xml + -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" + -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" + + - name: SonarQube Scan (Pull Request) + if: github.event_name == 'pull_request' + uses: SonarSource/sonarcloud-github-action@v1.5 + env: + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + with: + projectBaseDir: . + args: > + -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} + -Dsonar.projectName=${{ github.event.repository.name }} + -Dsonar.projectKey=${{ github.event.repository.name }} + -Dsonar.python.coverage.reportPaths=coverage.xml + -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" + -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" + -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} + -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} + -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}