main.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. name: CI
  2. on:
  3. push:
  4. branches-ignore:
  5. # Don't run CI for Dependabot branch pushes.
  6. - "dependabot/**"
  7. pull_request:
  8. env:
  9. # Git GITHUB_... variables are useful for translating Travis environment variables
  10. GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha }}
  11. GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
  12. GITHUB_PULL_REQUEST: ${{ github.event.number }}
  13. jobs:
  14. build:
  15. name: ${{ matrix.name }}
  16. runs-on: ${{ matrix.os }}
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. # Useful info: https://help.github.com/en/articles/workflow-syntax-for-github-actions
  21. include:
  22. - name: windows-msvc
  23. os: windows-2019
  24. python-version: 3.8
  25. # Can be 'msvc' or 'clang-cl'
  26. config: msvc-cl
  27. env:
  28. BAZEL_CONFIG: ${{ matrix.config }}
  29. PYTHON: ${{ matrix.python-version }}
  30. TRAVIS_COMMIT: ${{ github.sha }}
  31. #TRAVIS_PULL_REQUEST is defined in the scripts to account for "false"
  32. steps:
  33. - name: Pre-checkout system configuration
  34. # We add -l to process .bashrc, but need -e -o pipefail for consistency with GitHub Actions's default behavior.
  35. shell: bash -e -o pipefail -l {0}
  36. run: |
  37. # Note: only configure settings here that are required _before_ the repository is cloned (such as Git settings).
  38. # Different machines behave very differently with Bash initialization -- make them more uniform
  39. rm -f -- ~/.bash_profile ~/.profile ~/.bashrc
  40. printf '\n%s\n' 'if [ -n "${BASH_VERSION}" ] && [ -f ~/.bashrc ]; then . ~/.bashrc; fi' >> ~/.profile
  41. git config --global core.symlinks true && git config --global core.autocrlf false
  42. if command -v dpkg > /dev/null; then sudo dpkg-reconfigure debconf -f noninteractive -p high; fi
  43. - name: Checkout repository
  44. uses: actions/checkout@v1
  45. - name: Configure AWS Credentials
  46. continue-on-error: true
  47. if: github.repository == 'ray-project/ray' && github.event_name != 'pull_request'
  48. uses: aws-actions/configure-aws-credentials@v1
  49. with:
  50. aws-access-key-id: ${{ secrets.GHA_AWS_ACCESS_KEY_ID }}
  51. aws-secret-access-key: ${{ secrets.GHA_AWS_SECRET_ACCESS_KEY }}
  52. aws-region: us-west-2
  53. - name: Prepare caching
  54. id: info
  55. shell: bash
  56. run: |
  57. case "${OSTYPE}" in
  58. linux*) pip_cache=~/.cache/pip;;
  59. darwin*) pip_cache=~/Library/Caches/pip;;
  60. msys) pip_cache="${LOCALAPPDATA}\pip\Cache";;
  61. esac
  62. cat <<-EOF
  63. ::set-output name=git_tree_hash::$(git cat-file -p HEAD | sed -n "s/^tree //p")
  64. ::set-output name=pip_cache::${pip_cache}
  65. EOF
  66. - name: Cache (pip)
  67. uses: actions/cache@v1.1.2
  68. continue-on-error: true
  69. if: steps.info.outputs.pip_cache
  70. with:
  71. path: ${{ steps.info.outputs.pip_cache }}
  72. key: |
  73. pip-${{ runner.os }}-${{ steps.info.outputs.git_tree_hash }}
  74. restore-keys: |
  75. pip-${{ runner.os }}-
  76. pip-
  77. - name: Build
  78. shell: bash -x -e -o pipefail -l {0}
  79. env:
  80. BAZEL_CACHE_CREDENTIAL_B64: ${{ secrets.BAZEL_CACHE_CREDENTIAL_B64 }}
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. RAY_DEFAULT_BUILD: 1
  83. WINDOWS_WHEELS: 1
  84. BAZEL_LOG_BUCKET_ACCESS_KEY: ${{ secrets.BAZEL_LOG_BUCKET_ACCESS_KEY }}
  85. TRAVIS_BRANCH: ${{ github.ref }}
  86. TRAVIS_COMMIT: ${{ github.sha }}
  87. TRAVIS_JOB_ID: ${{ github.run_id }}
  88. run: |
  89. function clean_up() {
  90. echo "Performing cleanup"
  91. if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then ./ci/travis/upload_build_info.sh; fi
  92. }
  93. trap clean_up EXIT
  94. python -u ci/remote-watch.py --skip_repo=ray-project/ray &
  95. . ./ci/travis/ci.sh init
  96. . ./ci/travis/ci.sh build
  97. . ./ci/travis/ci.sh upload_wheels || true
  98. - name: Run Tests
  99. shell: bash -x -e -o pipefail -l {0}
  100. env:
  101. BAZEL_CACHE_CREDENTIAL_B64: ${{ secrets.BAZEL_CACHE_CREDENTIAL_B64 }}
  102. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  103. RAY_DEFAULT_BUILD: 1
  104. WINDOWS_WHEELS: 1
  105. BAZEL_LOG_BUCKET_ACCESS_KEY: ${{ secrets.BAZEL_LOG_BUCKET_ACCESS_KEY }}
  106. TRAVIS_BRANCH: ${{ github.ref }}
  107. TRAVIS_COMMIT: ${{ github.sha }}
  108. TRAVIS_JOB_ID: ${{ github.run_id }}
  109. run: |
  110. function clean_up() {
  111. echo "Performing cleanup"
  112. if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then ./ci/travis/upload_build_info.sh; fi
  113. }
  114. trap clean_up EXIT
  115. python -u ci/remote-watch.py --skip_repo=ray-project/ray &
  116. . ./ci/travis/ci.sh test_core
  117. . ./ci/travis/ci.sh test_python
  118. - name: Run Clang Include-What-You-Use
  119. continue-on-error: true
  120. if: runner.os == 'Linux'
  121. shell: bash -e -o pipefail -l {0}
  122. run: ci/travis/iwyu.sh process "//:*"