tests.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. name: test
  5. on:
  6. push:
  7. branches: [trunk]
  8. paths:
  9. # Conservatively run the tests. However, skip them if the only paths in
  10. # the pull request match files that we know don't impact the build.
  11. - '**'
  12. - '!**/*.md'
  13. - '!LICENSE'
  14. - '!CODEOWNERS'
  15. - '!.git*'
  16. pull_request:
  17. paths:
  18. # Conservatively run the tests. However, skip them if the only paths in
  19. # the pull request match files that we know don't impact the build.
  20. - '**'
  21. - '!**/*.md'
  22. - '!LICENSE'
  23. - '!CODEOWNERS'
  24. - '!.git*'
  25. jobs:
  26. test:
  27. strategy:
  28. matrix:
  29. os: [ubuntu-latest, macos-latest]
  30. build_mode: [fastbuild, opt]
  31. runs-on: ${{ matrix.os }}
  32. steps:
  33. - name: Checkout
  34. uses: actions/checkout@v2
  35. with:
  36. submodules: true
  37. # Setup Python and related tools.
  38. - uses: actions/setup-python@v2
  39. with:
  40. # Match the min version listed in docs/project/contribution_tools.md
  41. python-version: '3.6'
  42. - name: Install python modules
  43. run: |
  44. pip install gql PyGitHub
  45. # On macOS we need Go and to use it to install Bazelisk.
  46. - uses: actions/setup-go@v2
  47. if: matrix.os == 'macos-latest'
  48. - name: Install bazelisk
  49. if: matrix.os == 'macos-latest'
  50. run: |
  51. go get github.com/bazelbuild/bazelisk
  52. echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
  53. # Print the various tool versions to help in debugging.
  54. - name: Print tool versions
  55. run: |
  56. bazelisk --version
  57. python --version
  58. echo gql "$(pip show gql | grep Version)"
  59. echo PyGitHub "$(pip show PyGitHub | grep Version)"
  60. # Build all targets first to isolate build failures.
  61. - name: Build (${{ matrix.build_mode }})
  62. run: |
  63. bazelisk build -c ${{ matrix.build_mode }} --verbose_failures \
  64. //...:all
  65. # Run all test targets.
  66. - name: Test (${{ matrix.build_mode }})
  67. run: |
  68. bazelisk test -c ${{ matrix.build_mode }} --test_output errors \
  69. --verbose_failures //...:all