From 39b854d0ac339a8804442c43014583729d72281d Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 21 Sep 2023 08:06:26 +0200 Subject: [PATCH] lower disk space usage in CI to remove spurious errors (#8843) Co-authored-by: vsaw --- .github/workflows/ccpp.yml | 24 +++++++++++++++--------- .github/workflows/on_pr.yml | 22 ++++++++++++++-------- build.ps1 | 6 +++++- scripts/deploy-cuda.sh | 12 +++++++----- scripts/setup.sh | 15 ++++++++------- 5 files changed, 49 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index b59a4710719..cb231b989ba 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -86,7 +86,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -101,7 +103,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -154,7 +156,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -205,7 +209,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -354,7 +360,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -392,7 +398,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -488,7 +494,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -538,7 +544,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -600,7 +606,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" diff --git a/.github/workflows/on_pr.yml b/.github/workflows/on_pr.yml index f32c2797550..2af8e96c7ee 100644 --- a/.github/workflows/on_pr.yml +++ b/.github/workflows/on_pr.yml @@ -72,7 +72,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -87,7 +89,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -113,7 +115,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -154,7 +158,9 @@ jobs: - name: Update apt run: sudo apt update - name: Install dependencies - run: sudo apt-get install -y yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + run: sudo apt-get install -y --no-install-recommends yasm nasm gperf libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + - name: Clean downloads + run: sudo apt-get clean - name: 'Install CUDA' run: ${{ github.workspace }}/scripts/deploy-cuda.sh @@ -259,7 +265,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -283,7 +289,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; mono $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -331,7 +337,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" @@ -362,7 +368,7 @@ jobs: - name: 'Setup vcpkg and NuGet artifacts backend' shell: bash run: > - git clone https://github.com/microsoft/vcpkg ; + git clone --depth 1 https://github.com/microsoft/vcpkg ; ./vcpkg/bootstrap-vcpkg.sh ; $(./vcpkg/vcpkg fetch nuget | tail -n 1) sources add -Name "vcpkgbinarycache" diff --git a/build.ps1 b/build.ps1 index a85fcca7b8b..768a478442b 100755 --- a/build.ps1 +++ b/build.ps1 @@ -721,7 +721,11 @@ if ($UseVCPKG -And -Not $ForceLocalVCPKG) { } if (($null -eq $vcpkg_path) -and $UseVCPKG) { if (-Not (Test-Path "$PWD/vcpkg${VCPKGSuffix}")) { - $proc = Start-Process -NoNewWindow -PassThru -FilePath $GIT_EXE -ArgumentList "clone https://github.com/microsoft/vcpkg vcpkg${VCPKGSuffix}" + $shallow_copy = "" + if($ForceOpenCVVersion -eq 0) { + $shallow_copy = " --depth 1 " + } + $proc = Start-Process -NoNewWindow -PassThru -FilePath $GIT_EXE -ArgumentList "clone $shallow_copy https://github.com/microsoft/vcpkg vcpkg${VCPKGSuffix}" $handle = $proc.Handle $proc.WaitForExit() $exitCode = $proc.ExitCode diff --git a/scripts/deploy-cuda.sh b/scripts/deploy-cuda.sh index 952669cb87f..b95258c2875 100755 --- a/scripts/deploy-cuda.sh +++ b/scripts/deploy-cuda.sh @@ -23,13 +23,15 @@ sudo apt-key del 7fa2af80 wget https://developer.download.nvidia.com/compute/cuda/repos/$distr_name/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update -sudo apt-get install -y build-essential g++ -sudo apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget -sudo apt-get install -y zlib1g +sudo apt-get install -y --no-install-recommends build-essential g++ +sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg software-properties-common wget +sudo apt-get install -y --no-install-recommends zlib1g sudo apt-get dist-upgrade -y sudo apt-get install -y --no-install-recommends cuda-${CUDA_VERSION_DASHED} -sudo apt-get install -y libcudnn8 -sudo apt-get install -y libcudnn8-dev +sudo apt-get install -y --no-install-recommends libcudnn8 +sudo apt-get install -y --no-install-recommends libcudnn8-dev sudo rm -rf /usr/local/cuda sudo ln -s /usr/local/cuda-${CUDA_VERSION} /usr/local/cuda + +sudo apt-get clean diff --git a/scripts/setup.sh b/scripts/setup.sh index 4ca00f749ba..e583e972369 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -75,9 +75,9 @@ elif [[ $(cut -f2 <<< $(lsb_release -i)) == "Ubuntu" ]]; then if [ "$install_tools" = true ] ; then echo "Installing tools" sudo apt-get update - sudo apt-get install -y git ninja-build build-essential g++ nasm yasm gperf - sudo apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget - sudo apt-get install -y libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev + sudo apt-get install -y --no-install-recommends git ninja-build build-essential g++ nasm yasm gperf + sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg software-properties-common wget + sudo apt-get install -y --no-install-recommends libgles2-mesa-dev libx11-dev libxft-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxdamage-dev libxinerama-dev libdbus-1-dev libxtst-dev wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(cut -f2 <<< $(lsb_release -c)) main" wget -q https://packages.microsoft.com/config/ubuntu/$(cut -f2 <<< $(lsb_release -r))/packages-microsoft-prod.deb @@ -85,10 +85,11 @@ elif [[ $(cut -f2 <<< $(lsb_release -i)) == "Ubuntu" ]]; then sudo add-apt-repository universe sudo apt-get update sudo apt-get dist-upgrade -y - sudo apt-get install -y cmake - sudo apt-get install -y powershell - sudo apt-get install -y curl zip unzip tar - sudo apt-get install -y pkg-config autoconf libtool bison + sudo apt-get install -y --no-install-recommends cmake + sudo apt-get install -y --no-install-recommends powershell + sudo apt-get install -y --no-install-recommends curl zip unzip tar + sudo apt-get install -y --no-install-recommends pkg-config autoconf libtool bison + sudo apt-get clean fi else if [ "$install_cuda" = true ] ; then