action.yml 2.8 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. with:
  30. path: ~/llvm
  31. key: LLVM-19.1.7-Cache-ubuntu-${{ runner.arch }}
  32. - name: Download LLVM and Clang installation
  33. if: steps.cache-llvm-ubuntu.outputs.cache-hit != 'true'
  34. shell: bash
  35. run: |
  36. cd ~
  37. LLVM_RELEASE=19.1.7
  38. LLVM_TARBALL_NAME=LLVM-$LLVM_RELEASE-Linux-X64
  39. LLVM_PATH=~/llvm
  40. echo "*** Downloading $LLVM_RELEASE"
  41. wget --show-progress=off "https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_RELEASE/$LLVM_TARBALL_NAME.tar.xz"
  42. echo "*** Extracting $LLVM_TARBALL_NAME.tar.xz"
  43. mkdir $LLVM_PATH
  44. tar -xJf $LLVM_TARBALL_NAME.tar.xz --strip-components=1 -C $LLVM_PATH
  45. echo "*** Deleting $LLVM_TARBALL_NAME.tar.xz"
  46. rm $LLVM_TARBALL_NAME.tar.xz
  47. echo "*** Testing `clang++ --version`"
  48. $LLVM_PATH/bin/clang++ --version
  49. # The installation contains *huge* parts of LLVM we don't need for the
  50. # toolchain. Prune them here to keep our cache small.
  51. echo "*** Cleaning the 'llvm' directory"
  52. rm $LLVM_PATH/lib/{*.a,*.so,*.so.*}
  53. rm $LLVM_PATH/bin/{flang-*,mlir-*,clang-{scan-deps,check,repl},*-test,llvm-{lto*,reduce,bolt*,exegesis,jitlink},bugpoint,opt,llc}
  54. echo "*** Size of the 'llvm' directory"
  55. du -hs $LLVM_PATH
  56. - name: Setup LLVM and Clang paths
  57. shell: bash
  58. run: |
  59. LLVM_PATH=~/llvm
  60. echo "Using ${LLVM_PATH}"
  61. echo "${LLVM_PATH}/bin" >> $GITHUB_PATH
  62. echo '*** ls "${LLVM_PATH}"'
  63. ls "${LLVM_PATH}"
  64. echo '*** ls "${LLVM_PATH}/bin"'
  65. ls "${LLVM_PATH}/bin"