mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
allow getdeps github actions to free up disk (#689)
Summary: X-link: https://github.com/facebookincubator/velox/pull/6927 allow getdeps github actions to free up disk Allow getdeps to free up some disk from the runner and intermediate build steps as some runs (notably the linux eden and mononoke ones) are hitting disk space limits Pull Request resolved: https://github.com/facebook/sapling/pull/689 Test Plan: Regenerate and run CI for mononoke. Mononoke Mac should continue to work Mononoke Linux should go from broken to working ``` ./build/fbcode_builder/getdeps.py --allow-system-packages generate-github-actions --free-up-disk --src-dir=. --output-dir=.github/workflows --job-name="Mononoke " --job-file-prefix=mononoke_ mononoke ``` --- Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/689). * https://github.com/facebook/sapling/issues/693 * https://github.com/facebook/sapling/issues/696 * https://github.com/facebook/sapling/issues/692 * https://github.com/facebook/sapling/issues/691 * https://github.com/facebook/sapling/issues/682 * __->__ https://github.com/facebook/sapling/issues/689 * https://github.com/facebook/sapling/issues/697 * https://github.com/facebook/sapling/issues/706 * https://github.com/facebook/sapling/issues/730 Reviewed By: sggutier Differential Revision: D49875256 Pulled By: genevievehelsel fbshipit-source-id: b85b6b2f11857670915b64f47d3c0abd4ca8ca31
This commit is contained in:
parent
5d87e7902b
commit
616e2eb859
92
.github/workflows/mononoke_linux.yml
vendored
92
.github/workflows/mononoke_linux.yml
vendored
@ -15,12 +15,20 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Show disk space at start
|
||||
run: df -h
|
||||
- name: Free up disk space
|
||||
run: sudo rm -rf /usr/local/lib/android
|
||||
- name: Show disk space after freeing up
|
||||
run: df -h
|
||||
- name: Update system package info
|
||||
run: sudo apt-get update
|
||||
- name: Install system deps
|
||||
run: sudo python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive mononoke
|
||||
- name: Install Rust Stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Fetch lld
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests lld
|
||||
- name: Fetch ninja
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests ninja
|
||||
- name: Fetch cmake
|
||||
@ -59,18 +67,20 @@ jobs:
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests libtool
|
||||
- name: Fetch libsodium
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests libsodium
|
||||
- name: Fetch libffi
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests libffi
|
||||
- name: Fetch ncurses
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests ncurses
|
||||
- name: Fetch python
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests python
|
||||
- name: Fetch xz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests xz
|
||||
- name: Fetch folly
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests folly
|
||||
- name: Fetch fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests fizz
|
||||
- name: Fetch mvfst
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests mvfst
|
||||
- name: Fetch libffi
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests libffi
|
||||
- name: Fetch ncurses
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests ncurses
|
||||
- name: Fetch python
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests python
|
||||
- name: Fetch wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests wangle
|
||||
- name: Fetch fbthrift
|
||||
@ -79,64 +89,68 @@ jobs:
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests fb303
|
||||
- name: Fetch rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests rust-shed
|
||||
- name: Build lld
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests lld
|
||||
- name: Build ninja
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests ninja
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests ninja
|
||||
- name: Build cmake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests cmake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests cmake
|
||||
- name: Build fmt
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fmt
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fmt
|
||||
- name: Build googletest
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests googletest
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests googletest
|
||||
- name: Build python-six
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests python-six
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests python-six
|
||||
- name: Build zstd
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests zstd
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests zstd
|
||||
- name: Build boost
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests boost
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests boost
|
||||
- name: Build double-conversion
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests double-conversion
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests double-conversion
|
||||
- name: Build gflags
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests gflags
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests gflags
|
||||
- name: Build glog
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests glog
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests glog
|
||||
- name: Build libevent
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libevent
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libevent
|
||||
- name: Build lz4
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests lz4
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests lz4
|
||||
- name: Build snappy
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests snappy
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests snappy
|
||||
- name: Build zlib
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests zlib
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests zlib
|
||||
- name: Build bz2
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests bz2
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests bz2
|
||||
- name: Build autoconf
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests autoconf
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests autoconf
|
||||
- name: Build automake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests automake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests automake
|
||||
- name: Build libtool
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libtool
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libtool
|
||||
- name: Build libsodium
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libsodium
|
||||
- name: Build libffi
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libffi
|
||||
- name: Build ncurses
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests ncurses
|
||||
- name: Build python
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests python
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libsodium
|
||||
- name: Build xz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests xz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests xz
|
||||
- name: Build folly
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests folly
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests folly
|
||||
- name: Build fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fizz
|
||||
- name: Build mvfst
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests mvfst
|
||||
- name: Build libffi
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libffi
|
||||
- name: Build ncurses
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests ncurses
|
||||
- name: Build python
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests python
|
||||
- name: Build wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests wangle
|
||||
- name: Build fbthrift
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fbthrift
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fbthrift
|
||||
- name: Build fb303
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fb303
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fb303
|
||||
- name: Build rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests rust-shed
|
||||
- name: Build mononoke
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --src-dir=. mononoke --project-install-prefix mononoke:/usr/local
|
||||
- name: Copy artifacts
|
||||
@ -147,3 +161,5 @@ jobs:
|
||||
path: _artifacts
|
||||
- name: Test mononoke
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. mononoke --project-install-prefix mononoke:/usr/local
|
||||
- name: Show disk space at end
|
||||
run: df -h
|
||||
|
64
.github/workflows/mononoke_mac.yml
vendored
64
.github/workflows/mononoke_mac.yml
vendored
@ -15,6 +15,12 @@ jobs:
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Show disk space at start
|
||||
run: df -h
|
||||
- name: Free up disk space
|
||||
run: sudo rm -rf /usr/local/lib/android
|
||||
- name: Show disk space after freeing up
|
||||
run: df -h
|
||||
- name: Install system deps
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive mononoke
|
||||
- name: Install Rust Stable
|
||||
@ -63,6 +69,8 @@ jobs:
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests folly
|
||||
- name: Fetch fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests fizz
|
||||
- name: Fetch mvfst
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests mvfst
|
||||
- name: Fetch wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests wangle
|
||||
- name: Fetch fbthrift
|
||||
@ -72,57 +80,59 @@ jobs:
|
||||
- name: Fetch rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages fetch --no-tests rust-shed
|
||||
- name: Build openssl
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests openssl
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests openssl
|
||||
- name: Build ninja
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests ninja
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests ninja
|
||||
- name: Build cmake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests cmake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests cmake
|
||||
- name: Build fmt
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fmt
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fmt
|
||||
- name: Build googletest
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests googletest
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests googletest
|
||||
- name: Build python-six
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests python-six
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests python-six
|
||||
- name: Build zstd
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests zstd
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests zstd
|
||||
- name: Build boost
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests boost
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests boost
|
||||
- name: Build double-conversion
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests double-conversion
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests double-conversion
|
||||
- name: Build gflags
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests gflags
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests gflags
|
||||
- name: Build glog
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests glog
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests glog
|
||||
- name: Build libevent
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libevent
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libevent
|
||||
- name: Build lz4
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests lz4
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests lz4
|
||||
- name: Build snappy
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests snappy
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests snappy
|
||||
- name: Build zlib
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests zlib
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests zlib
|
||||
- name: Build autoconf
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests autoconf
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests autoconf
|
||||
- name: Build automake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests automake
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests automake
|
||||
- name: Build libtool
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libtool
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libtool
|
||||
- name: Build libsodium
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests libsodium
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests libsodium
|
||||
- name: Build xz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests xz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests xz
|
||||
- name: Build folly
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests folly
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests folly
|
||||
- name: Build fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fizz
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fizz
|
||||
- name: Build mvfst
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests mvfst
|
||||
- name: Build wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests wangle
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests wangle
|
||||
- name: Build fbthrift
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fbthrift
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fbthrift
|
||||
- name: Build fb303
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests fb303
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests fb303
|
||||
- name: Build rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --no-tests rust-shed
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --free-up-disk --no-tests rust-shed
|
||||
- name: Build mononoke
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages build --src-dir=. mononoke --project-install-prefix mononoke:/usr/local
|
||||
- name: Copy artifacts
|
||||
@ -133,3 +143,5 @@ jobs:
|
||||
path: _artifacts
|
||||
- name: Test mononoke
|
||||
run: python3 build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. mononoke --project-install-prefix mononoke:/usr/local
|
||||
- name: Show disk space at end
|
||||
run: df -h
|
||||
|
@ -795,6 +795,12 @@ class BuildCmd(ProjectCmdBase):
|
||||
action="store_true",
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--free-up-disk",
|
||||
help="Remove unused tools and clean up intermediate files if possible to maximise space for the build",
|
||||
action="store_true",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
@cmd("fixup-dyn-deps", "Adjusts dynamic dependencies for packaging purposes")
|
||||
@ -1015,6 +1021,19 @@ jobs:
|
||||
|
||||
out.write(" - uses: actions/checkout@v2\n")
|
||||
|
||||
if build_opts.free_up_disk:
|
||||
free_up_disk = "--free-up-disk "
|
||||
if not build_opts.is_windows():
|
||||
out.write(" - name: Show disk space at start\n")
|
||||
out.write(" run: df -h\n")
|
||||
# remove the unused github supplied android dev tools
|
||||
out.write(" - name: Free up disk space\n")
|
||||
out.write(" run: sudo rm -rf /usr/local/lib/android\n")
|
||||
out.write(" - name: Show disk space after freeing up\n")
|
||||
out.write(" run: df -h\n")
|
||||
else:
|
||||
free_up_disk = ""
|
||||
|
||||
allow_sys_arg = ""
|
||||
if (
|
||||
build_opts.allow_system_packages
|
||||
@ -1065,7 +1084,7 @@ jobs:
|
||||
has_same_repo_dep = True
|
||||
out.write(" - name: Build %s\n" % m.name)
|
||||
out.write(
|
||||
f" run: {getdepscmd}{allow_sys_arg} build {src_dir_arg}--no-tests {m.name}\n"
|
||||
f" run: {getdepscmd}{allow_sys_arg} build {src_dir_arg}{free_up_disk}--no-tests {m.name}\n"
|
||||
)
|
||||
|
||||
out.write(" - name: Build %s\n" % manifest.name)
|
||||
@ -1111,6 +1130,9 @@ jobs:
|
||||
out.write(
|
||||
f" run: {getdepscmd}{allow_sys_arg} test --src-dir=. {manifest.name} {project_prefix}\n"
|
||||
)
|
||||
if build_opts.free_up_disk and not build_opts.is_windows():
|
||||
out.write(" - name: Show disk space at end\n")
|
||||
out.write(" run: df -h\n")
|
||||
|
||||
def setup_project_cmd_parser(self, parser):
|
||||
parser.add_argument(
|
||||
@ -1155,6 +1177,12 @@ jobs:
|
||||
help="add a prefix to all job names",
|
||||
default=None,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--free-up-disk",
|
||||
help="Remove unused tools and clean up intermediate files if possible to maximise space for the build",
|
||||
action="store_true",
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def get_arg_var_name(args):
|
||||
|
@ -136,6 +136,16 @@ class BuilderBase(object):
|
||||
self._prepare(install_dirs=install_dirs, reconfigure=reconfigure)
|
||||
self._build(install_dirs=install_dirs, reconfigure=reconfigure)
|
||||
|
||||
if self.build_opts.free_up_disk:
|
||||
# don't clean --src-dir=. case as user may want to build again or run tests on the build
|
||||
if self.src_dir.startswith(self.build_opts.scratch_dir) and os.path.isdir(
|
||||
self.build_dir
|
||||
):
|
||||
if os.path.islink(self.build_dir):
|
||||
os.remove(self.build_dir)
|
||||
else:
|
||||
shutil.rmtree(self.build_dir)
|
||||
|
||||
# On Windows, emit a wrapper script that can be used to run build artifacts
|
||||
# directly from the build directory, without installing them. On Windows $PATH
|
||||
# needs to be updated to include all of the directories containing the runtime
|
||||
|
@ -51,6 +51,7 @@ class BuildOptions(object):
|
||||
lfs_path=None,
|
||||
shared_libs: bool = False,
|
||||
facebook_internal=None,
|
||||
free_up_disk: bool = False,
|
||||
) -> None:
|
||||
"""fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
|
||||
or for shipit-transformed repos, the build dir that
|
||||
@ -65,6 +66,7 @@ class BuildOptions(object):
|
||||
use_shipit - use real shipit instead of the simple shipit transformer
|
||||
vcvars_path - Path to external VS toolchain's vsvarsall.bat
|
||||
shared_libs - whether to build shared libraries
|
||||
free_up_disk - take extra actions to save runner disk space
|
||||
"""
|
||||
|
||||
if not install_dir:
|
||||
@ -103,6 +105,7 @@ class BuildOptions(object):
|
||||
self.allow_system_packages = allow_system_packages
|
||||
self.lfs_path = lfs_path
|
||||
self.shared_libs = shared_libs
|
||||
self.free_up_disk = free_up_disk
|
||||
|
||||
lib_path = None
|
||||
if self.is_darwin():
|
||||
@ -602,6 +605,7 @@ def setup_build_options(args, host_type=None) -> BuildOptions:
|
||||
"allow_system_packages",
|
||||
"lfs_path",
|
||||
"shared_libs",
|
||||
"free_up_disk",
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user