Skip to content

Commit

Permalink
Merge pull request #1015 from jordancarlin/main
Browse files Browse the repository at this point in the history
Add Installation CI
  • Loading branch information
rosethompson authored Oct 16, 2024
2 parents de8083b + ffee136 commit 2a54921
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/cli-space-cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
###########################################
## GitHub runner space cleanup
##
## Written: Jordan Carlin, jcarlin@hmc.edu
## Created: 30 June 2024
## Modified:
##
## Purpose: Remove unnecessary packages/directories from GitHub Actions runner

## A component of the CORE-V-WALLY configurable RISC-V project.
## https://github.com/openhwgroup/cvw
##
## Copyright (C) 2021-23 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.
################################################################################################

# Remove unnecessary packages
removePacks=( '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' '^dotnet-sdk-.*' 'azure-cli' 'google-cloud-cli' 'google-chrome-stable' 'firefox' '^powershell*' 'microsoft-edge-stable' 'mono-devel' 'hhvm' )
for pack in "${removePacks[@]}"; do
sudo apt-get purge -y "$pack" || true
done
sudo apt-get autoremove -y || true
sudo apt-get clean || true

# Remove unnecessary directories
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/share/miniconda
sudo rm -rf /usr/share/az*
sudo rm -rf /usr/share/gradle-*
sudo rm -rf /usr/share/sbt
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/julia*
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/share/vcpkg
sudo rm -rf /usr/local/games
sudo rm -rf /usr/local/sqlpackage
sudo rm -rf /usr/lib/google-cloud-sdk
sudo rm -rf /usr/lib/jvm
sudo rm -rf /usr/lib/mono
sudo rm -rf /usr/lib/R
sudo rm -rf /usr/lib/postgresql
sudo rm -rf /usr/lib/heroku
sudo rm -rf /usr/lib/firefox
sudo rm -rf /opt/hostedtoolcache

# Clean up docker images
sudo docker image prune --all --force
146 changes: 146 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
##################################
# install.yml
# jcarlin@hmc.edu October 2024
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
#
# GitHub Action to test the wally-tool-chain-install.sh script for all supported linux distributions
# and configurations. Runs weekly and on pull requests that modify the installation scripts.
##################################

name: Installation

# Run on PR that modifies the installation scripts, weekly, or manually
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'bin/wally-tool-chain-install.sh'
- 'bin/wally-distro-check.sh'
- 'wally-package-install.sh'
schedule:
- cron: "0 0 * * 3" # Run at 12:00 AM on Wednesdays

# Use bash shell with extra GitHub Actions options for all jobs
defaults:
run:
shell: bash

jobs:
installation_test:
name: Test installation for ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu Installations
- name: ubuntu-20.04
os: ubuntu-20.04
container: null
- name: ubuntu-22.04
os: ubuntu-22.04
container: null
- name: ubuntu-24.04
os: ubuntu-24.04
container: null
# Red Hat Installations
- name: rocky-8
os: ubuntu-latest
image: rockylinux:8
- name: rocky-9
os: ubuntu-latest
image: rockylinux:9
- name: almalinux-8
os: ubuntu-latest
image: almalinux:8
- name: almalinux-9
os: ubuntu-latest
image: almalinux:9
# User level installation
- name: user-install
os: ubuntu-latest
image: null
user: true
# Custom location installation
- name: custom-install
os: ubuntu-latest
image: null
riscv_path: /home/riscv

# run on selected version of ubuntu or on ubuntu-latest with docker image
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.image }}
options: --privileged --mount type=bind,source=/,target=/host --pid=host --entrypoint /bin/bash # Allow for connection with host

steps:
# Docker images need git installed or the checkout action fails
- name: Install Dependencies for Red Hat
if: ${{ matrix.image != null }}
run: |
dnf install -y sudo git
dnf install curl -y --allowerasing || true
# Only clone submodules needed for standard tests/regression to save space
- uses: actions/checkout@v4
- name: Clone Necessary Submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init addins/riscv-arch-test addins/verilog-ethernet
# Free up space on the host machine, either from the container or the host
- name: Free Up Storage
run: |
df -h
if [ -z ${{ matrix.image }} ]; then
./.github/cli-space-cleanup.sh
else
nsenter -t 1 -m -u -n -i bash -c "$(cat .github/cli-space-cleanup.sh)"
fi
df -h
# Run main tool chain installation script, either as a user or system wide
- name: Install
run: |
if [ -z ${{ matrix.user }} ]; then
sudo ./bin/wally-tool-chain-install.sh --clean ${{ matrix.riscv_path }}
else
sudo ./bin/wally-package-install.sh
./bin/wally-tool-chain-install.sh --clean ${{ matrix.riscv_path }}
fi
# Set environment variables for the rest of the job
- name: Set Environment Variables
run: |
if [ ! -z ${{ matrix.riscv_path }} ]; then
sed -i 's,exit 1,export RISCV=${{ matrix.riscv_path }},g' setup.sh
fi
source setup.sh
echo "RISCV=$RISCV" >> "$GITHUB_ENV"
# Upload installation logs for debugging
- name: Upload Installation Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: installation-logs-${{ matrix.name }}
path: ${{ env.RISCV }}/logs/
# Make riscof only as that is the only testsuite used by standard regression
- name: make tests
run: |
source setup.sh
make riscof --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: |
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.name != 'ubuntu-20.04' && matrix.name != 'rocky-8' && matrix.name != 'almalinux-8'}}
run: |
source setup.sh
regression-wally
# Upload regression logs for debugging
- name: Upload regression logs
uses: actions/upload-artifact@v4
if: always()
with:
name: regression-logs-${{ matrix.name }}
path: ${{ github.workspace }}/sim/verilator/logs/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.vscode/
__pycache__/
**/work*
!.github/*
/**/obj_dir*
/**/gmon*

Expand Down

0 comments on commit 2a54921

Please sign in to comment.