Skip to content

Commit

Permalink
Set up github regression
Browse files Browse the repository at this point in the history
  • Loading branch information
kathlenemagnus committed Nov 14, 2024
1 parent 249c70d commit 7b9787c
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @kathlenemagnus
54 changes: 54 additions & 0 deletions .github/actions/build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -x

source "/usr/share/miniconda/etc/profile.d/conda.sh"
conda activate riscv_func_model

echo "Starting Build Entry"
echo "HOME:" $HOME
echo "GITHUB_WORKSPACE:" $GITHUB_WORKSPACE
echo "GITHUB_EVENT_PATH:" $GITHUB_EVENT_PATH
echo "CONDA_PREFIX:" $CONDA_PREFIX
echo "PWD:" `pwd`

CXX_COMPILER=${COMPILER/clang/clang++}

#
# Compile Sparta Infra (always build with release)
# Have other build types point to release
#
echo "Building Sparta Infra"
cd ${GITHUB_WORKSPACE}/map/sparta
mkdir -p release
cd release
CC=$COMPILER CXX=$CXX_COMPILER cmake .. -DCMAKE_BUILD_TYPE=Release -DGEN_DEBUG_INFO=OFF -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}
if [ $? -ne 0 ]; then
echo "ERROR: CMake for Sparta framework failed"
exit 0
fi
make -j$(nproc --all) install > install.log
BUILD_SPARTA=$?
if [ ${BUILD_SPARTA} -ne 0 ]; then
echo "ERROR: build sparta FAILED!!!"
echo "$(<install.log)"
exit 1
fi
rm install.log

cd ${GITHUB_WORKSPACE}
mkdir $ATLAS_BUILD_TYPE
cd $ATLAS_BUILD_TYPE
CC=$COMPILER CXX=$CXX_COMPILER cmake .. -DCMAKE_BUILD_TYPE=$ATLAS_BUILD_TYPE -DGEN_DEBUG_INFO=OFF
if [ $? -ne 0 ]; then
echo "ERROR: CMake for atlas failed"
exit 1
fi
make -j$(nproc --all) regress > regress.log
BUILD_ATLAS=$?
if [ ${BUILD_ATLAS} -ne 0 ]; then
echo "ERROR: build/regress of Atlas FAILED!!!"
echo "$(<regress.log)"
exit 1
fi
rm regress.log
91 changes: 91 additions & 0 deletions .github/workflows/ubuntu-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
on:
pull_request:
branches:
- master

env:
CACHE_VERSION: v1

name: Regress Atlas on Ubuntu
jobs:
build_test_job:
strategy:
# Strategy is a matrix of debug and release builds/regression
matrix:
os: [ubuntu-latest]
BUILD_TYPE: [Debug,Release]
COMPILER: [gcc,clang]

name: Ubuntu-${{ matrix.BUILD_TYPE }}-${{matrix.COMPILER}}
runs-on: ${{ matrix.os }}

# Set up a global environment variable for build scripts
env:
ATLAS_BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
COMPILER: ${{ matrix.COMPILER }}

steps:
- name: Setup Keys
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

# Get Atlas
- name: Clone Atlas
uses: actions/checkout@v4
with:
submodules: recursive

# Get Sparta
- name: Checkout Sparta
uses: actions/checkout@v4
with:
repository: sparcians/map
path: map
ref: map_v2.0.14

# Setup Conda and build environment
- name: Grab Python v3.8
uses: actions/setup-python@v3
with:
python-version: 3.8

# Cache the conda dependencies to
- name: Cache conda deps
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-${{ matrix.BUILD_TYPE }}-${{ matrix.COMPILER }}-conda-${{ hashFiles('conda/environment.yml') }}
path: /usr/share/miniconda/envs/riscv_func_model # Default path for conda

# Setup CCache to cache builds
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.BUILD_TYPE }}-${{ matrix.COMPILER }}-ccache-${{ github.ref_name }}
restore-keys: |
${{ matrix.os }}-${{ matrix.BUILD_TYPE }}-${{ matrix.COMPILER }}-ccache-master
${{ matrix.os }}-${{ matrix.BUILD_TYPE }}-${{ matrix.COMPILER }}-ccache
- name: Setup Conda Environment
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
$CONDA/bin/conda config --set channel_priority strict
$CONDA/bin/conda env update --file ${{ github.workspace }}/conda/environment.yml
$CONDA/bin/conda init bash
# Build
- name: Build & Regress
run: ./.github/actions/build/entrypoint.sh

# Save error logs, etc
- name: Save artifacts
if: failure()
uses: actions/upload-artifact@main
with:
name: ErrorLogs-${{matrix.BUILD_TYPE}}-${{matrix.COMPILER}}
path: ${{matrix.BUILD_TYPE}}/test/

#- name: CTest
# # Run CTests without Valgrind tests otherwise the runtime will be TOO long
# if: ${{ env.DABBLE_BUILD_TYPE == 'release' }} && ${{ env.VALGRIND == 'false' }}
# uses: ./.github/actions/ctest # Uses an action.yml in directory

0 comments on commit 7b9787c

Please sign in to comment.