Skip to content

Merge pull request #193 from csrc-sdsu/feat/comparison_example_2waywave #295

Merge pull request #193 from csrc-sdsu/feat/comparison_example_2waywave

Merge pull request #193 from csrc-sdsu/feat/comparison_example_2waywave #295

Workflow file for this run

---
name: Build, Test, and Documentation
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
lint-new-code:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0
- name: Run super-linter
uses: super-linter/super-linter/slim@v5
env:
DISABLE_ERRORS: true
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-MOLE-ubuntu:
runs-on: ubuntu-latest
needs: lint-new-code
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update Libraries
run: sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y cmake g++ libgtest-dev libarmadillo-dev libopenblas-dev libsuperlu-dev libeigen3-dev
cd /usr/src/googletest && sudo cmake . && sudo make && sudo make install
- name: Create build directory
run: mkdir -p build
- name: Run CMake
run: cmake -S . -B build
- name: Build MOLE library
run: cmake --build build
- name: Run tests
run: |
cd build
make run_tests
build-MOLE-macOSX:
runs-on: macOS-latest
needs: lint-new-code
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
brew update && (brew list cmake || brew install cmake)
brew install openblas eigen libomp lapack
sudo ln -sf /opt/homebrew/bin/gfortran-14 /opt/homebrew/bin/gfortran
- name: Export Environment Variables
run: |
ls /opt/homebrew/bin/gfortran*
# brew link gcc
export FC="/opt/homebrew/bin/gfortran-14"
export CMAKE_Fortran_COMPILER="/opt/homebrew/bin/gfortran-14"
export LDFLAGS+=" -L/opt/homebrew/opt/openblas/lib"
export CPPFLAGS+=" -I/opt/homebrew/opt/openblas/include"
export PKG_CONFIG_PATH+=" /opt/homebrew/opt/openblas/lib/pkgconfig"
export LDFLAGS+=" -L/opt/homebrew/opt/libomp/lib"
export CPPFLAGS+=" -I/opt/homebrew/opt/libomp/include"
export LDFLAGS+=" -L/opt/homebrew/opt/lapack/lib"
export CPPFLAGS+=" -I/opt/homebrew/opt/lapack/include"
export PKG_CONFIG_PATH+=" /opt/homebrew/opt/lapack/lib/pkgconfig"
- name: Create build directory
run: mkdir -p build
- name: Run CMake
run: cmake -DCMAKE_Fortran_COMPILER="/opt/homebrew/bin/gfortran-14" -S . -B build
- name: Build MOLE library
run: cmake --build build
- name: Run tests
run: |
cd build
make run_tests
Recompile-JOSS-paper:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if subfolder changed
id: changes
run: |
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
CHANGED=$(git diff --name-only FETCH_HEAD HEAD | grep '^doc/papers/' || true)
# git fetch origin ${{ github.base_ref }}
# CHANGED=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep '^doc/papers/' || true)
if [ -n "$CHANGED" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Run build if subfolder changed
if: steps.changes.outputs.changed == 'true'
run: echo "Building subfolder components..."
- name: Build draft PDF
if: steps.changes.outputs.changed == 'true'
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
paper-path: doc/papers/joss/paper.md
- name: Upload a Build Artifact
if: steps.changes.outputs.changed == 'true'
uses: actions/upload-artifact@v4
with:
name: paper
path: doc/papers/joss/paper.pdf
Build-Documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if documentation sources changed
id: changes
run: |
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1
CHANGED=$(git diff --name-only FETCH_HEAD HEAD | grep -E '^(doc/sphinx/|doc/doxygen/|.*\.md$|.*\.rst$|\.github/workflows/build_and_gtest\.yml$)' || true)
# For push events, check against previous commit
if [ "${{ github.event_name }}" = "push" ]; then
CHANGED=$(git diff --name-only HEAD~1 HEAD | grep -E '^(doc/sphinx/|doc/doxygen/|.*\.md$|.*\.rst$|\.github/workflows/build_and_gtest\.yml$)' || true)
fi
if [ -n "$CHANGED" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Documentation sources have changed:"
echo "$CHANGED"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No documentation sources changed"
fi
- name: Set up Python
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install system dependencies
if: steps.changes.outputs.changed == 'true'
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz inkscape
sudo apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-latex-extra
# Verify graphviz installation
dot -V
- name: Install Python dependencies
if: steps.changes.outputs.changed == 'true'
run: |
cd doc/sphinx
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Documentation
if: steps.changes.outputs.changed == 'true'
run: |
cd doc/sphinx
make doc-clean
make doc-doxygen
make doc-html
make doc-latexpdf
- name: Prepare for deployment
if: steps.changes.outputs.changed == 'true'
run: |
# Create .nojekyll file to prevent GitHub Pages from ignoring files that begin with an underscore
touch doc/sphinx/build/html/.nojekyll
- name: Deploy to GitHub Pages
if: steps.changes.outputs.changed == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/sphinx/build/html
force_orphan: true
commit_message: "Deploy documentation updates"
enable_jekyll: false
- name: Upload Documentation Artifacts
if: steps.changes.outputs.changed == 'true'
uses: actions/upload-artifact@v4
with:
name: documentation
path: |
doc/sphinx/build/html/
doc/sphinx/build/latex/*.pdf