mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-02 09:45:18 +00:00
Update CI to ensure sufficient space
This commit is contained in:
parent
8d01b46a05
commit
31bfcdc660
64
.github/scripts/cli-create-lvm.sh
vendored
Executable file
64
.github/scripts/cli-create-lvm.sh
vendored
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
###########################################
|
||||
## GitHub runner create LVM volume merging /mnt with / for more space
|
||||
##
|
||||
## Written: Jordan Carlin, jcarlin@hmc.edu
|
||||
## Created: 30 Jan 2025
|
||||
## Based on https://github.com/easimon/maximize-build-space/blob/master/action.yml
|
||||
##
|
||||
## Purpose: Combine free space from multiple disks into a single logical volume for GitHub Actions runner
|
||||
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||
## https://github.com/openhwgroup/cvw
|
||||
##
|
||||
## Copyright (C) 2021-25 Harvey Mudd College & Oklahoma State University
|
||||
##
|
||||
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||
##
|
||||
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||
## may obtain a copy of the License at
|
||||
##
|
||||
## https:##solderpad.org/licenses/SHL-2.1/
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
## either express or implied. See the License for the specific language governing permissions
|
||||
## and limitations under the License.
|
||||
################################################################################################
|
||||
|
||||
ROOT_SAVE_SPACE="${1:-20}" # in GB, needed for installing packages, etc.
|
||||
MOUNT="${2:-$GITHUB_WORKSPACE}"
|
||||
|
||||
# First disable and remove swap file on /mnt
|
||||
sudo swapoff -a
|
||||
sudo rm -f /mnt/swapfile
|
||||
|
||||
# Create / LVM physical volume
|
||||
ROOT_FREE_SPACE=$(df --block-size=1024 --output=avail / | tail -1)
|
||||
ROOT_LVM_SIZE=$(((ROOT_FREE_SPACE - (ROOT_SAVE_SPACE * 1024 * 1024)) * 1024))
|
||||
sudo touch /pv.img && sudo fallocate -z -l $ROOT_LVM_SIZE /pv.img
|
||||
ROOT_LOOP_DEV=$(sudo losetup --find --show /pv.img)
|
||||
sudo pvcreate -f "$ROOT_LOOP_DEV"
|
||||
|
||||
# Create /mnt LVM physical volume
|
||||
MNT_FREE_SPACE=$(df --block-size=1024 --output=avail /mnt | tail -1)
|
||||
MNT_LVM_SIZE=$(((MNT_FREE_SPACE - (1 * 1024)) * 1024)) # Leave 1MB free on /mnt
|
||||
sudo touch /mnt/pv.img && sudo fallocate -z -l $MNT_LVM_SIZE /mnt/pv.img
|
||||
MNT_LOOP_DEV=$(sudo losetup --find --show /mnt/pv.img)
|
||||
sudo pvcreate -f "$MNT_LOOP_DEV"
|
||||
|
||||
# Create LVM volume group
|
||||
sudo vgcreate runnervg "$ROOT_LOOP_DEV" "$MNT_LOOP_DEV"
|
||||
|
||||
# Recreate swap
|
||||
sudo lvcreate -L 4G -n swap runnervg
|
||||
sudo mkswap /dev/mapper/runnervg-swap
|
||||
sudo swapon /dev/mapper/runnervg-swap
|
||||
|
||||
# Create LVM logical volume
|
||||
sudo lvcreate -l 100%FREE -n runnerlv runnervg
|
||||
sudo mkfs.ext4 /dev/mapper/runnervg-runnerlv
|
||||
sudo mkdir -p "$MOUNT"
|
||||
sudo mount /dev/mapper/runnervg-runnerlv "$MOUNT"
|
||||
sudo chown runner:runner "$MOUNT"
|
||||
sudo rm -rf "$MOUNT/lost+found"
|
16
.github/workflows/install.yml
vendored
16
.github/workflows/install.yml
vendored
@ -127,9 +127,11 @@ jobs:
|
||||
run: |
|
||||
df -h
|
||||
if [ -z ${{ matrix.image }} ]; then
|
||||
./.github/cli-space-cleanup.sh
|
||||
./.github/scripts/cli-space-cleanup.sh
|
||||
./.github/scripts/cli-create-lvm.sh
|
||||
else
|
||||
nsenter -t 1 -m -u -n -i bash -c "$(cat .github/cli-space-cleanup.sh)"
|
||||
nsenter -t 1 -m -u -n -i bash -c "$(cat .github/scripts/cli-space-cleanup.sh)"
|
||||
nsenter -t 1 -m -u -n -i bash -c "$(cat .github/scripts/cli-create-lvm.sh)"
|
||||
fi
|
||||
df -h
|
||||
# Run main tool chain installation script, either as a user or system wide
|
||||
@ -159,16 +161,16 @@ jobs:
|
||||
with:
|
||||
name: installation-logs-${{ matrix.name }}
|
||||
path: ${{ env.RISCV }}/logs/
|
||||
# Only the linux-testvectors are needed, so remove the rest of the buildroot to save space
|
||||
- name: Remove Buildroot to Save Space
|
||||
run: |
|
||||
rm -rf $RISCV/buildroot/ || sudo rm -rf $RISCV/
|
||||
df -h
|
||||
# Make riscof and zsbl only as that is the only testsuite used by standard regression
|
||||
- name: make tests
|
||||
run: |
|
||||
source setup.sh
|
||||
make riscof zsbl --jobs $(nproc --ignore 1)
|
||||
# Only the linux-testvectors are needed, so remove the rest of the buildroot to save space
|
||||
- name: Remove Buildroot to Save Space
|
||||
run: |
|
||||
rm -rf $RISCV/buildroot/output/build || sudo rm -rf $RISCV/buildroot/output/build
|
||||
df -h
|
||||
# Run standard regression, skipping distros that are known to be broken with Verilator
|
||||
- name: Regression
|
||||
if: ${{ matrix.regressionFail != true }}
|
||||
|
Loading…
Reference in New Issue
Block a user