action.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: Setup build environment (Ubuntu)
  5. runs:
  6. using: composite
  7. steps:
  8. # Ubuntu images start with ~23GB available; this takes a few seconds to add
  9. # ~22GB more.
  10. #
  11. # Although we could delete more, if we run into a limit, not deleting
  12. # everything provides a little flexibility to get space while trying
  13. # to shrink the build.
  14. - name: Free up disk space
  15. uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
  16. with:
  17. android: true
  18. dotnet: true
  19. haskell: true
  20. # Enabling large-packages adds ~3 minutes to save ~4GB, so turn it off
  21. # to save time.
  22. large-packages: false
  23. # Cache and install a recent version of LLVM. This uses the GitHub action
  24. # cache to avoid directly downloading on each iteration and improve
  25. # reliability.
  26. - name: Cache LLVM and Clang installation
  27. id: cache-llvm-ubuntu
  28. uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
  29. env:
  30. cache-name: cache-llvm
  31. with:
  32. path: ~/llvm
  33. key: LLVM-16-Cache-ubuntu-${{ runner.arch }}
  34. - name: Download LLVM and Clang installation
  35. if: steps.cache-llvm-ubuntu.outputs.cache-hit != 'true'
  36. shell: bash
  37. run: |
  38. cd ~
  39. LLVM_RELEASE=clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04
  40. echo "*** Downloading $LLVM_RELEASE"
  41. wget --show-progress=off "https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.4/$LLVM_RELEASE.tar.xz"
  42. echo "*** Extracting $LLVM_RELEASE"
  43. tar -xJf "$LLVM_RELEASE.tar.xz"
  44. echo "*** Moving to 'llvm'"
  45. mv "$LLVM_RELEASE" llvm
  46. echo "*** Testing `clang++ --version`"
  47. ~/llvm/bin/clang++ --version
  48. # The installation contains *huge* parts of LLVM we don't need for the
  49. # toolchain. Prune them here to keep our cache small.
  50. echo "*** Cleaning the 'llvm' directory"
  51. rm llvm/lib/{*.a,*.so,*.so.*,*.bc}
  52. rm llvm/bin/{flang-*,mlir-*,clang-{scan-deps,check,repl},*-test,llvm-{lto*,reduce,bolt*,exegesis,jitlink},bugpoint,opt,llc}
  53. echo "*** Size of the 'llvm' directory"
  54. du -hs llvm
  55. - name: Setup LLVM and Clang paths
  56. shell: bash
  57. run: |
  58. LLVM_PATH=~/llvm
  59. echo "Using ${LLVM_PATH}"
  60. echo "${LLVM_PATH}/bin" >> $GITHUB_PATH
  61. echo '*** ls "${LLVM_PATH}"'
  62. ls "${LLVM_PATH}"
  63. echo '*** ls "${LLVM_PATH}/bin"'
  64. ls "${LLVM_PATH}/bin"