Skip to content

Commit

Permalink
CI/CD (#437)
Browse files Browse the repository at this point in the history
Upstreaming CI/CD pipeline developed by Leo Lai
---------

Co-authored-by: Leo Lai <[email protected]>
Co-authored-by: Finn Wilkinson <[email protected]>
  • Loading branch information
3 people authored Nov 6, 2024
1 parent 1d9e277 commit 84f4c7f
Show file tree
Hide file tree
Showing 24 changed files with 2,572 additions and 249 deletions.
113 changes: 113 additions & 0 deletions .github/actions/select_setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Setup compiler and OS combo
description: installs dependencies and correct compiler/OS versions to build and test simeng

##############################################################################
# Calls the correct setup action based on parameters passed into this action.
##############################################################################

inputs:
OS:
required: true
COMPILER:
required: true
MODE:
required: true

runs:
using: 'composite'
steps:
##########################################
# GCC jobs
##########################################

# ubuntu
- if: ${{ contains( inputs.COMPILER, 'gcc') && contains( inputs.OS, 'ubuntu') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_gcc_ubuntu
with:
OS: ${{ inputs.OS }}
gcc-version: ${{ inputs.COMPILER }}
MODE: ${{ inputs.mode }}

# rocky linux
- if: ${{ contains( inputs.COMPILER, 'gcc') && contains( inputs.OS, 'rocky') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_gcc_rocky
with:
OS: ${{ inputs.OS }}
gcc-version: ${{ inputs.COMPILER }}
MODE: ${{ inputs.mode }}

# red hat
- if: ${{ contains( inputs.COMPILER, 'gcc') && contains( inputs.OS, 'redhat') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_gcc_redhat
with:
OS: ${{ inputs.OS }}
gcc-version: ${{ inputs.COMPILER }}
MODE: ${{ inputs.mode }}

# debian
- if: ${{ contains( inputs.COMPILER, 'gcc') && contains( inputs.OS, 'debian') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_gcc_debian
with:
OS: ${{ inputs.OS }}
gcc-version: ${{ inputs.COMPILER }}
MODE: ${{ inputs.mode }}

# macos
- if: ${{ contains( inputs.COMPILER, 'gcc') && contains( inputs.OS, 'macos') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_gcc_macos
with:
OS: ${{ inputs.OS }}
gcc-version: ${{ inputs.COMPILER }}
MODE: ${{ inputs.mode }}

##########################################
# APPLE CLANG
##########################################

- if: ${{ contains( inputs.COMPILER, 'clang') && contains( inputs.OS, 'macos') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_clang_macos
with:
OS: ${{ inputs.OS }}
MODE: ${{ inputs.mode }}

##########################################
# ARM CLANG
##########################################

# ubuntu
- if: ${{ contains( inputs.COMPILER, 'armclang') && contains( inputs.OS, 'ubuntu') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_armclang_ubuntu
with:
OS: ${{ inputs.OS }}
MODE: ${{ inputs.mode }}

# debian
- if: ${{ contains( inputs.COMPILER, 'armclang') && contains( inputs.OS, 'debian') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_armclang_debian
with:
OS: ${{ inputs.OS }}
MODE: ${{ inputs.mode }}

# redhat
- if: ${{ contains( inputs.COMPILER, 'armclang') && contains( inputs.OS, 'redhat') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_armclang_redhat
with:
OS: ${{ inputs.OS }}
MODE: ${{ inputs.mode }}

# rocky
- if: ${{ contains( inputs.COMPILER, 'armclang') && contains( inputs.OS, 'rocky') }}
name: Install ${{ inputs.COMPILER }} + Build SimEng
uses: ./.github/actions/setup_armclang_rocky
with:
OS: ${{ inputs.OS }}
MODE: ${{ inputs.mode }}
95 changes: 95 additions & 0 deletions .github/actions/setup_armclang_debian/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: setup armclang
description: installs dependencies and correct armclang version to build and test simeng

inputs:
OS:
description: docker image name
required: true
MODE:
description: simeng-mode e.g. Release or Debug
required: true

runs:
using: 'composite'
steps:
#######################################
# Install dependencies required (cmake, etc).
#######################################
- name: Install dependencies
shell: bash
run: |
export DEBIAN_FRONTEND=noninteractive
# Update package lists
apt-get update
# Install essential packages
apt-get install -y \
python3-launchpadlib \
software-properties-common \
build-essential \
sudo \
wget \
zlib1g-dev \
python3 \
build-essential \
libssl-dev \
ninja-build \
tree \
git
# add pyparsing for benchmarking
apt-get install -y python3-pip
pip3 install pyparsing
apt-get update
apt-get upgrade -y
#######################################
# Install Cmake
#######################################
- name: Install Cmake via apt
shell: bash
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && \
apt update && apt install cmake -y
apt upgrade -y
#######################################
# Install ArmClang
#######################################
- name: Install armclang
shell: bash
run: |
apt-get update
apt-get upgrade -y
apt-get install environment-modules
source /etc/profile.d/modules.sh
wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Compiler-for-Linux/Version_24.04/arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
tar -xf arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
./arm-compiler-for-linux_24.04_Ubuntu-20.04/arm-compiler-for-linux_24.04_Ubuntu-20.04.sh --install-to ./armclang_compiler
export MODULEPATH=$MODULEPATH:$(pwd)/armclang_compiler/modulefiles
module avail
module load acfl/24.04
armclang -v
echo "C_COMPILER=$(which armclang)" >> $GITHUB_ENV
echo "CPP_COMPILER=$(which armclang++)" >> $GITHUB_ENV
#######################################
# Build SimEng
#######################################
- name: Build SimEng
shell: bash
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ inputs.MODE }} -DSIMENG_ENABLE_TESTS=ON -DSIMENG_OPTIMIZE=ON -DCMAKE_C_COMPILER=${{ env.C_COMPILER }} -DCMAKE_CXX_COMPILER=${{ env.CPP_COMPILER }}
cmake --build build -j $(nproc)
cmake --build build --target install
91 changes: 91 additions & 0 deletions .github/actions/setup_armclang_redhat/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: setup armclang
description: installs dependencies and correct armclang version to build and test simeng

inputs:
OS:
description: docker image name
required: true
MODE:
description: simeng-mode e.g. Release or Debug
required: true

runs:
using: 'composite'
steps:
#######################################
# Install dependencies required (cmake, etc).
#######################################
- name: Install dependencies
shell: bash
run: |
dnf -y update && \
dnf -y install \
gcc gcc-c++ make \
wget \
python3 \
git \
diffutils \
openssl-devel \
bzip2 \
automake \
autoconf \
cmake \
file \
zlib-devel
if [[ ${{ inputs.OS }} == 'redhat/ubi8:latest' ]]; then
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
elif [[ ${{ inputs.OS }} == 'redhat/ubi9:latest' ]]; then
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
fi
# add pyparsing for benchmarking
dnf install -y python3-pip
pip3 install pyparsing
dnf update -y
dnf upgrade -y
dnf clean all
#######################################
# Install Cmake
#######################################
- name: Install Cmake via DNF
shell: bash
run: |
dnf install -y cmake
######################################
# Install ArmClang
######################################
- name: Install armclang
shell: bash
run: |
dnf install -y environment-modules
source /etc/profile.d/modules.sh
wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Compiler-for-Linux/Version_24.04/arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
tar -xf arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
./arm-compiler-for-linux_24.04_Ubuntu-20.04/arm-compiler-for-linux_24.04_Ubuntu-20.04.sh --install-to ./armclang_compiler
export MODULEPATH=$MODULEPATH:$(pwd)/armclang_compiler/modulefiles
module avail
module load acfl/24.04
armclang -v
echo "C_COMPILER=$(which armclang)" >> $GITHUB_ENV
echo "CPP_COMPILER=$(which armclang++)" >> $GITHUB_ENV
#######################################
# Build SimEng
#######################################
- name: Build SimEng
shell: bash
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ inputs.MODE }} -DSIMENG_ENABLE_TESTS=ON -DSIMENG_OPTIMIZE=ON -DCMAKE_C_COMPILER=${{ env.C_COMPILER }} -DCMAKE_CXX_COMPILER=${{ env.CPP_COMPILER }}
cmake --build build -j $(nproc)
cmake --build build --target install
86 changes: 86 additions & 0 deletions .github/actions/setup_armclang_rocky/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: setup armclang
description: installs dependencies and correct armclang version to build and test simeng

inputs:
OS:
description: docker image name
required: true
MODE:
description: simeng-mode e.g. Release or Debug
required: true

runs:
using: 'composite'
steps:
#######################################
# Install dependencies required (cmake, etc).
#######################################
- name: Install dependencies
shell: bash
run: |
dnf -y update && \
dnf install -y epel-release \
gcc gcc-c++ make \
git \
wget \
openssl-devel \
automake \
autoconf \
bzip2 \
file \
sudo \
tree \
zlib-devel
# add pyparsing for benchmarking
dnf install -y python3-pip
pip3 install pyparsing
dnf group install -y "Development Tools"
dnf update -y
dnf upgrade -y
#######################################
# Install Cmake
#######################################
- name: Install Cmake via DNF
shell: bash
run: |
dnf install -y cmake
######################################
# Install ArmClang
######################################
- name: Install armclang
shell: bash
run: |
dnf install -y environment-modules
source /etc/profile.d/modules.sh
wget https://developer.arm.com/-/cdn-downloads/permalink/Arm-Compiler-for-Linux/Version_24.04/arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
tar -xf arm-compiler-for-linux_24.04_Ubuntu-22.04_aarch64.tar
./arm-compiler-for-linux_24.04_Ubuntu-20.04/arm-compiler-for-linux_24.04_Ubuntu-20.04.sh --install-to ./armclang_compiler
export MODULEPATH=$MODULEPATH:$(pwd)/armclang_compiler/modulefiles
module avail
module load acfl/24.04
armclang -v
echo "C_COMPILER=$(which armclang)" >> $GITHUB_ENV
echo "CPP_COMPILER=$(which armclang++)" >> $GITHUB_ENV
#######################################
# Build SimEng
#######################################
- name: Build SimEng
shell: bash
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ inputs.MODE }} -DSIMENG_ENABLE_TESTS=ON -DSIMENG_OPTIMIZE=ON -DCMAKE_C_COMPILER=${{ env.GCC_DIR }} \
-DCMAKE_CXX_COMPILER=${{ env.CPP_DIR }}
cmake --build build -j $(nproc)
cmake --build build --target install
Loading

0 comments on commit 84f4c7f

Please sign in to comment.