pytest_cpu_gha_runner.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: "[GHA][CPU] llama-recipes Pytest tests on CPU GitHub hosted runner."
  2. on:
  3. pull_request:
  4. branches:
  5. - 'main'
  6. paths:
  7. - 'src/llama-recipes/configs/*.py'
  8. - 'src/llama-recipes/utils/*.py'
  9. - 'src/llama-recipes/datasets/*.py'
  10. - 'src/llama-recipes/data/*.py'
  11. - 'src/llama-recipes/*.py'
  12. # triggers workflow manually for debugging purposes.
  13. workflow_dispatch:
  14. inputs:
  15. runner:
  16. description: 'GHA Runner Scale Set label to run workflow on.'
  17. required: true
  18. default: ubuntu-20.04
  19. debug:
  20. description: 'Run debugging steps?'
  21. required: false
  22. default: "true"
  23. env:
  24. PYTORCH_WHEEL_URL: https://download.pytorch.org/whl/test/cu118
  25. jobs:
  26. execute_workflow:
  27. name: Execute workload on GHA CPU Runner
  28. defaults:
  29. run:
  30. shell: bash # default shell to run all steps for a given job.
  31. runs-on: ${{ github.event.inputs.runner != '' && github.event.inputs.runner || 'ubuntu-20.04' }}
  32. steps:
  33. - name: "[DEBUG] Get runner container OS information"
  34. id: os_info
  35. if: ${{ github.event.inputs.debug == 'true' }}
  36. run: |
  37. cat /etc/os-release
  38. - name: "Checkout 'facebookresearch/llama-recipes' repository"
  39. id: checkout
  40. uses: actions/checkout@v4
  41. - name: "[DEBUG] Content of the repository after checkout"
  42. id: content_after_checkout
  43. if: ${{ github.event.inputs.debug == 'true' }}
  44. run: |
  45. ls -la ${GITHUB_WORKSPACE}
  46. - name: "Installing Python dependencies"
  47. id: python_dependencies
  48. run: |
  49. pip3 install --upgrade pip
  50. pip3 install setuptools
  51. - name: "Installing 'llama-recipes' project"
  52. id: install_llama_recipes_package
  53. run: |
  54. echo "Installing 'llama-recipes' project (re: https://github.com/facebookresearch/llama-recipes?tab=readme-ov-file#install-with-optional-dependencies)"
  55. pip install --extra-index-url ${PYTORCH_WHEEL_URL} -e '.[tests]'
  56. - name: "Running PyTest tests on GHA CPU Runner"
  57. id: pytest
  58. run: |
  59. echo "Running PyTest tests at 'GITHUB_WORKSPACE' path: ${GITHUB_WORKSPACE}"
  60. cd $GITHUB_WORKSPACE && python3 -m pytest --junitxml="$GITHUB_WORKSPACE/result.xml"
  61. - name: Publish Test Summary
  62. id: test_summary
  63. uses: test-summary/action@v2
  64. with:
  65. paths: "**/*.xml"
  66. if: always()