test.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Test
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. types:
  8. - opened
  9. - synchronize
  10. jobs:
  11. test:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v4
  16. - name: Set up Python
  17. uses: actions/setup-python@v5
  18. with:
  19. python-version: '3.10'
  20. - run: docker compose build
  21. - run: docker compose down -v --remove-orphans
  22. - run: docker compose up -d
  23. - name: Lint
  24. run: docker compose exec -T backend bash /app/scripts/lint.sh
  25. - name: Run tests
  26. run: docker compose exec -T backend bash /app/tests-start.sh "Coverage for ${{ github.sha }}"
  27. - run: docker compose down -v --remove-orphans
  28. - name: Store coverage files
  29. uses: actions/upload-artifact@v4
  30. with:
  31. name: coverage-html
  32. path: backend/htmlcov
  33. # https://github.com/marketplace/actions/alls-green#why
  34. alls-green: # This job does nothing and is only used for the branch protection
  35. if: always()
  36. needs:
  37. - test
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Decide whether the needed jobs succeeded or failed
  41. uses: re-actors/alls-green@release/v1
  42. with:
  43. jobs: ${{ toJSON(needs) }}