Skip to content

Commit

Permalink
Merge pull request #111 from Noam-Elisha/master
Browse files Browse the repository at this point in the history
Adding testing on every commit.
  • Loading branch information
fmckenna authored Sep 4, 2024
2 parents e9bda54 + 0d620b4 commit c0131ed
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run quoFEM tests

on: push
# workflow_dispatch:
# schedule:
# - cron: "0 5 * * *"

jobs:
setup_and_test:
name: Setup and run tests
runs-on: ubuntu-latest
environment: quoFEM

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
run: |
chmod +x bootstrap.sh
sh ./bootstrap.sh
- name: Build SimCenter Applications
run: |
chmod +x build_backend_apps.sh
sh ./build_backend_apps.sh
- name: Run Examples
run: |
chmod +x run_examples.sh
sh ./run_examples.sh
49 changes: 49 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Updates the package lists for upgrades and new package installations
sudo apt-get update

# Installs the 'sudo' package. The '-y' flag automatically answers yes to prompts.
apt-get install -y sudo python3.9

# Install the needed packages
sudo apt install -y software-properties-common cmake python3-pip git

# Upgrades pip (Python package installer) to the latest version
sudo python3 -m pip install -U pip

# Installs the Conan package manager
pip3 install conan==1.60.1
pip3 install nheri-simcenter

python3 --version

which python3

which conan

wget https://github.com/snl-dakota/dakota/releases/download/v6.15.0/dakota-6.15.0-public-src-cli.tar.gz
sudo apt-get install -y libboost-dev libboost-all-dev libopenmpi-dev openmpi-bin xorg-dev libmotif-dev
tar zxBf dakota-6.15.0-public-src-cli.tar.gz
mv dakota-6.15.0-public-src-cli dakota-6.15.0
cd dakota-6.15.0
mkdir build; cd build
cmake ..
cmake --build . --config Release
cmake --install .
cd ../..; rm -fr dakot*

sudo apt-get install -y cmake liblapack-dev libomp-dev libssl-dev apt-transport-https ca-certificates wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
sudo apt-get update
sudo apt-get install -y cmake gfortran gcc g++
git clone -b $versionOpenSees --single-branch https://github.com/OpenSees/OpenSees.git
cd OpenSees
mkdir build; cd build
conan install .. --build missing
cmake ..
cmake --build . --config Release
cmake --install .
sudo mv ./lib/* /usr/local/lib
cd ../..; rm -fr OpenSees
39 changes: 39 additions & 0 deletions build_backend_apps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

git clone --branch master --depth 1 https://github.com/NHERI-SimCenter/SimCenterBackendApplications.git

cp ./SimCenterBackendApplications/modules/performUQ/SimCenterUQ/nataf_gsa/CMakeLists.txt.UBUNTU ./SimCenterBackendApplications/modules/performUQ/SimCenterUQ/nataf_gsa/CMakeLists.txt

rm -fr ~/.conan

sudo apt-get install -y liblapack-dev libomp-dev libssl-dev apt-transport-https ca-certificates \

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test

sudo apt-get update

sudo apt-get install -y gcc-10 g++-10 gfortran-10

export CC=gcc-10

export CXX=g++-10

export FC=gfortran-10

conan remote add simcenter https://nherisimcenter.jfrog.io/artifactory/api/conan/simcenter

cd SimCenterBackendApplications

mkdir build

cd build

conan install .. --build missing

cmake ..

cmake --build . --config Release

cmake --install .

cd ../..
26 changes: 25 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

// Written: fmckenna

#include "SimCenterPreferences.h"
#include "qjsondocument.h"
#include <QApplication>
#include <QFile>
#include <QTime>
Expand All @@ -55,6 +57,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.



#include <TapisV3.h>

#include <QSettings>
// customMessgaeOutput code from web:
// https://stackoverflow.com/questions/4954140/how-to-redirect-qdebug-qwarning-qcritical-etc-output

Expand Down Expand Up @@ -158,6 +163,7 @@ int main(int argc, char *argv[])
//

QString tenant("designsafe");

//QString storage("agave://designsafe.storage.default/")
QString storage("designsafe.storage.default/");
QString dirName("quoFEM");
Expand Down Expand Up @@ -256,7 +262,25 @@ int main(int argc, char *argv[])
view.show();
view.hide();
******************************************************************** */


// Make sure the Python environment exists and is up to date
//w.updatePythonEnvironment();

//TapisV3 testing
// QString tenantString("designsafe.tapi.io");
// TapisV3 *tapis = new TapisV3(tenantString, storage, &dirName);
// tapis->login("noamelisha", "Abcdefghijklmnop123456789");

// QString val;
// QFile file1;
// file.setFileName("C:/Users/noame/Documents/Tapis/Sample App/job.json");
// file.open(QIODevice::ReadOnly | QIODevice::Text);
// val = file.readAll();
// file.close();
// QJsonDocument d = QJsonDocument::fromJson(val.toUtf8());
// QJsonObject sett2 = d.object();
// tapis->startJob(sett2);

//
// exe application event-loop
//
Expand Down
30 changes: 30 additions & 0 deletions nightly_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run quoFEM tests

on:
workflow_dispatch:
schedule:
- cron: "0 5 * * *"

jobs:
setup_and_test:
name: Setup and run tests
runs-on: ubuntu-latest
environment: quoFEM

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
run: |
chmod +x bootstrap.sh
sh ./bootstrap.sh
- name: Build SimCenter Applications
run: |
chmod +x build_backend_apps.sh
sh ./build_backend_apps.sh
- name: Test Examples
run: |
chmod +x run_examples.sh
sh ./run_examples.sh
31 changes: 31 additions & 0 deletions run_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

echo In folder $PWD

# Clone the examples
git clone --branch master --depth 1 https://github.com/NHERI-SimCenter/quoFEM.git

# Create the working directoy
mkdir tmp.SimCenter
mkdir tmp.SimCenter/templatedir
cp -a $PWD/Examples/qfem-0001/src/. $PWD/tmp.SimCenter/templatedir/

sudo apt-get install jq

inputfile=$PWD/Examples/qfem-0001/src/input.json

echo "doing jq ================="
echo $(cat $inputfile | jq '. + { "runDir": "'"$PWD/tmp.SimCenter"'" }') > $inputfile
echo $(cat $inputfile | jq '. + { "localAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile
echo $(cat $inputfile | jq '. + { "remoteAppDir": "'"$PWD/SimCenterBackendApplications"'" }') > $inputfile
echo $(cat $inputfile | jq '. + { "runType": "runningLocal" }') > $inputfile
echo "did jq ==================="

echo "catting the thing now ==================="
cat $inputfile

ls $PWD/tmp.SimCenter/templatedir

# Run the example in the backend
python $PWD/SimCenterBackendApplications/applications/Workflow/qWHALE.py "runningLocal" $inputfile $PWD/SimCenterBackendApplications/applications/Workflow/WorkflowApplications.json

0 comments on commit c0131ed

Please sign in to comment.