python-app.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # This workflow will install Python dependencies, run tests and lint with a single version of Python
  2. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
  3. name: Python application
  4. on:
  5. push:
  6. branches: [ master ]
  7. pull_request:
  8. branches: [ master ]
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: Set up Python 3.7
  15. uses: actions/setup-python@v2
  16. with:
  17. python-version: 3.7
  18. - name: Install dependencies
  19. run: |
  20. python -m pip install --upgrade pip
  21. pip install flake8 pytest
  22. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  23. - name: Lint with flake8
  24. run: |
  25. # stop the build if there are Python syntax errors or undefined names
  26. flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  27. # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
  28. flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  29. - name: Checkout other repo
  30. uses: actions/checkout@v2
  31. with:
  32. repository: imperial-genomics-facility/data-management-python
  33. ref: cellranger_v6
  34. path: data-management-python
  35. - name: Test with pytest
  36. run: |
  37. airflow upgradedb
  38. pytest --log-cli-level=10 test/
  39. env:
  40. PYTHONPATH: /home/runner/work/igf-airflow-hpc/igf-airflow-hpc/data-management-python
  41. AIRFLOW__CORE__DAGBAG_IMPORT_TIMEOUT: 20
  42. AIRFLOW__SECRETS__BACKEND: airflow.secrets.local_filesystem.LocalFilesystemBackend
  43. AIRFLOW__SECRETS__BACKEND_KWARGS: '{"variables_file_path":"/home/runner/work/igf-airflow-hpc/igf-airflow-hpc/airflow_var/var.json","connections_file_path":"/home/runner/work/igf-airflow-hpc/igf-airflow-hpc/airflow_var/conn.json"}'
  44. - name: Send custom JSON data to Slack workflow
  45. id: slack
  46. uses: slackapi/slack-github-action@v1.14.0
  47. with:
  48. channel-id: '#code_development'
  49. payload: "{\"status\":\${{ job.status }}\"}" # This data can be any valid JSON from a previous step in the GitHub Action
  50. if: always()
  51. env:
  52. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}