From b69fa845a5948a0ebeb499431cffaf82a4e75f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Wed, 16 Aug 2023 05:17:29 -0300 Subject: [PATCH] [ENG-937] Work-around running out of space in GitHub CI for cache factory (#1158) * Attmept to workaround Linux and Windows CI runners out-of-space problems * Don't mix cmd and powershell * bruh * Attempt to fix prisma cache * No need to cd, as the step is already in the correct cwd * Leave enough room in root to install the necessary system packages * Attempt to fix macOS cache being ovewritten * Fix dumb mistake * Up linux root free size to 6GB because - The cache action compress the data to root and it need more free space * Remove pull_request trigger from cache_factory --------- Co-authored-by: Oscar Beaumont Co-authored-by: Utku <74243531+utkubakir@users.noreply.github.com> --- .github/actions/setup-rust/action.yaml | 17 +++++----- .github/workflows/cache-factory.yaml | 18 +++++++++++ .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++ .github/workflows/release.yml | 18 +++++++++++ 4 files changed, 86 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup-rust/action.yaml b/.github/actions/setup-rust/action.yaml index affb9f7e8..2108fe1c2 100644 --- a/.github/actions/setup-rust/action.yaml +++ b/.github/actions/setup-rust/action.yaml @@ -7,9 +7,9 @@ inputs: save-cache: description: Whether to save the Rust cache required: false - default: 'false' + default: "false" runs: - using: 'composite' + using: "composite" steps: - name: Install Rust id: toolchain @@ -22,25 +22,22 @@ runs: - name: Cache Rust Dependencies uses: Swatinem/rust-cache@v2 with: - key: ${{ inputs.targets }} save-if: ${{ inputs.save-cache }} - prefix-key: 'v0' - shared-key: rust-deps - # Windows is having disk related problems with target caching - cache-targets: ${{ runner.os != 'Windows' }} + prefix-key: "v0-rust-deps" + shared-key: ${{ inputs.targets }} - name: Restore cached Prisma codegen id: cache-prisma-restore uses: actions/cache/restore@v3 with: key: prisma-1-${{ runner.os }}-${{ hashFiles('./core/prisma/*', './crates/sync-generator/*', './Cargo.toml') }} - path: ./crates/prisma/src/prisma*.rs + path: crates/prisma/src/**/*.rs - name: Generate Prisma client working-directory: core if: ${{ steps.cache-prisma-restore.outputs.cache-hit != 'true' }} shell: bash - run: cargo run -p prisma-cli --bin prisma -- generate + run: cargo prisma generate - name: Save Prisma codegen id: cache-prisma-save @@ -48,4 +45,4 @@ runs: uses: actions/cache/save@v3 with: key: ${{ steps.cache-prisma-restore.outputs.cache-primary-key }} - path: ./crates/prisma/src/prisma*.rs + path: crates/prisma/src/**/*.rs diff --git a/.github/workflows/cache-factory.yaml b/.github/workflows/cache-factory.yaml index 67ee90a6d..db91e4ea5 100644 --- a/.github/workflows/cache-factory.yaml +++ b/.github/workflows/cache-factory.yaml @@ -49,9 +49,27 @@ jobs: name: 'Make Cache' runs-on: ${{ matrix.settings.host }} steps: + - name: Maximize build space + if: ${{ runner.os == 'Linux' }} + uses: easimon/maximize-build-space@master + with: + swap-size-mb: 3072 + root-reserve-mb: 6144 + remove-dotnet: 'true' + remove-codeql: 'true' + remove-haskell: 'true' + remove-docker-images: 'true' + - name: Checkout repository uses: actions/checkout@v3 + - name: Symlink target to C:\ + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\spacedrive_target + New-Item -Path target -ItemType Junction -Value C:\spacedrive_target + - name: Setup System and Rust uses: ./.github/actions/setup-system with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c66affb17..413cdecb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,9 +47,27 @@ jobs: name: Rust Formatting runs-on: ubuntu-20.04 steps: + - name: Maximize build space + if: ${{ runner.os == 'Linux' }} + uses: easimon/maximize-build-space@master + with: + swap-size-mb: 3072 + root-reserve-mb: 6144 + remove-dotnet: 'true' + remove-codeql: 'true' + remove-haskell: 'true' + remove-docker-images: 'true' + - name: Checkout repository uses: actions/checkout@v3 + - name: Symlink target to C:\ + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\spacedrive_target + New-Item -Path target -ItemType Junction -Value C:\spacedrive_target + - uses: dorny/paths-filter@v2 id: filter with: @@ -81,9 +99,27 @@ jobs: matrix: platform: [ubuntu-20.04, macos-latest, windows-latest] steps: + - name: Maximize build space + if: ${{ runner.os == 'Linux' }} + uses: easimon/maximize-build-space@master + with: + swap-size-mb: 3072 + root-reserve-mb: 6144 + remove-dotnet: 'true' + remove-codeql: 'true' + remove-haskell: 'true' + remove-docker-images: 'true' + - name: Checkout repository uses: actions/checkout@v3 + - name: Symlink target to C:\ + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\spacedrive_target + New-Item -Path target -ItemType Junction -Value C:\spacedrive_target + - uses: dorny/paths-filter@v2 id: filter with: @@ -100,6 +136,13 @@ jobs: - 'Cargo.toml' - 'Cargo.lock' + - name: Symlink target to C:\ + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\spacedrive_target + New-Item -Path target -ItemType Junction -Value C:\spacedrive_target + - name: Setup System and Rust if: steps.filter.outputs.changes == 'true' uses: ./.github/actions/setup-system diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9fd6e5e41..bf72157ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,9 +36,27 @@ jobs: name: Desktop - Main ${{ matrix.settings.target }} runs-on: ${{ matrix.settings.host }} steps: + - name: Maximize build space + if: ${{ runner.os == 'Linux' }} + uses: easimon/maximize-build-space@master + with: + swap-size-mb: 3072 + root-reserve-mb: 6144 + remove-dotnet: 'true' + remove-codeql: 'true' + remove-haskell: 'true' + remove-docker-images: 'true' + - name: Checkout repository uses: actions/checkout@v3 + - name: Symlink target to C:\ + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\spacedrive_target + New-Item -Path target -ItemType Junction -Value C:\spacedrive_target + - name: Remove 32-bit libs if: ${{ runner.os == 'Linux' }} run: |