tests.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: Python tests
  2. on: [workflow_dispatch, pull_request, push]
  3. jobs:
  4. tests:
  5. runs-on: ubuntu-latest
  6. strategy:
  7. matrix:
  8. python-version: [3.9]
  9. steps:
  10. - uses: actions/checkout@v2
  11. with:
  12. fetch-depth: 0
  13. - name: Set up Python ${{ matrix.python-version }}
  14. uses: actions/setup-python@v2
  15. with:
  16. python-version: ${{ matrix.python-version }}
  17. - name: Install dependencies
  18. run: |
  19. python -m pip install --upgrade pip
  20. pip install -r requirements-first.txt
  21. pip install -r requirements-dev.txt
  22. - name: Test with pytest
  23. run: pytest --cov=. --cov-config=.coveragerc --cov-report xml:coverage.xml
  24. - name: Track master branch
  25. run: git fetch --no-tags https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY +refs/heads/main:refs/remotes/origin/main
  26. - name: SonarCloud Debug
  27. env:
  28. GH_EVENT: ${{ github.event_name }}
  29. GH_REPO: ${{ github.event.repository.name }}
  30. run: echo "event $GH_EVENT repo $GH_REPO"
  31. - name: SonarCloud scan
  32. uses: sonarsource/sonarcloud-github-action@master
  33. if: github.event_name == 'push' && github.event.repository.name == 'make-all/tuya-local'
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}