tests.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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.10']
  9. steps:
  10. - uses: actions/checkout@v3
  11. with:
  12. fetch-depth: 0
  13. - name: Set up Python ${{ matrix.python-version }}
  14. uses: actions/setup-python@v4
  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-dev.txt
  21. - name: Test with pytest
  22. run: pytest --cov=. --cov-config=.coveragerc --cov-report xml:coverage.xml
  23. - name: Track master branch
  24. if: github.event.sender.login == github.event.repository.owner.login
  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 scan
  27. uses: sonarsource/sonarcloud-github-action@master
  28. if: github.event.sender.login == github.event.repository.owner.login
  29. env:
  30. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  31. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}