Read shells from file #2787
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Compile and lint | |
on: | |
push: | |
branches-ignore: | |
- classic* | |
workflow_dispatch: | |
# pull_request: | |
# branches-ignore: | |
# - classic* | |
jobs: | |
cppcheck: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install dependencies | |
run: | | |
brew update | |
brew install gsl openmpi cppcheck || true | |
cp artisoptions_nltenebular.h artisoptions.h | |
- name: run cppcheck and check for errors | |
run: | | |
cppcheck --version | |
cppcheck --force --error-exitcode=1 --language=c++ --std=c++20 --enable=warning,performance,portability . | |
- name: show cppcheck style suggestions | |
run: | | |
cppcheck --version | |
cppcheck --force --language=c++ --std=c++20 --enable=style --suppress=knownConditionTrueFalse . | |
clang-format: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '16' | |
check-path: . | |
clang-tidy: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: install dependencies | |
run: | | |
brew update | |
brew install openmpi gsl || true | |
brew link openmpi | |
- name: install llvm | |
run: | | |
brew install llvm || true | |
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH | |
echo "CXX=clang++" >> $GITHUB_ENV | |
echo "OMPI_CXX=clang++" >> $GITHUB_ENV | |
echo "LDFLAGS=-L/usr/local/opt/llvm/lib" >> $GITHUB_ENV | |
echo "CPPFLAGS=-I/usr/local/opt/llvm/include" >> $GITHUB_ENV | |
echo "LDFLAGS=-L/usr/local/opt/libomp/lib" >> $GITHUB_ENV | |
echo "CXXFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV | |
echo "LIBRARY_PATH=/usr/local/opt/lib" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=/usr/local/opt/lib" >> $GITHUB_ENV | |
echo "CPATH=/usr/local/opt/include" >> $GITHUB_ENV | |
echo "compiledb" > requirements.txt | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
cache: pip | |
python-version: '3.12' | |
- name: Generate compile_commands.json | |
run: | | |
python3 -m pip install compiledb | |
cp artisoptions_nltenebular.h artisoptions.h | |
make version.h | |
python3 -m compiledb -n --full-path make | |
- name: cat compile_commands.json | |
run: cat compile_commands.json | |
- name: run-clang-tidy | |
run: | | |
clang-tidy --version | |
run-clang-tidy | |
compile: | |
runs-on: ubuntu-22.04 | |
env: | |
CXX: g++ | |
strategy: | |
matrix: | |
compiler: | |
[ | |
{name: gcc, ver: 11}, | |
{name: gcc, ver: 12}, | |
{name: gcc, ver: 13}, | |
{name: clang, ver: 14}, | |
{name: clang, ver: 15}, | |
] | |
mpi: [ON, OFF] | |
openmp: [ON, OFF] | |
exclude: | |
- compiler: {name: clang, ver: 15} | |
openmp: ON | |
fail-fast: false | |
name: ${{ matrix.compiler.name }}-${{ matrix.compiler.ver }}${{ matrix.mpi == 'ON' && ' MPI' || ''}}${{ matrix.openmp == 'ON' && ' OpenMP' || ''}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: CPU type and core count | |
id: cpu-count | |
run: | | |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3 | |
# echo "count=$(python3 -c 'import psutil; print(int(psutil.cpu_count(logical=False)))')" >> $GITHUB_OUTPUT | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
- name: apt update | |
run: | | |
sudo add-apt-repository main | |
sudo add-apt-repository universe | |
sudo add-apt-repository restricted | |
sudo add-apt-repository multiverse | |
sudo apt-get update | |
- name: Install gcc-${{ matrix.compiler.ver }} | |
if: matrix.compiler.name == 'gcc' | |
run: | | |
sudo apt install -y gcc-${{ matrix.compiler.ver }} g++-${{ matrix.compiler.ver }} | |
echo "CXX=g++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
- name: Install clang-${{ matrix.compiler.ver }} | |
if: matrix.compiler.name == 'clang' | |
run: | | |
sudo apt install -y clang-${{ matrix.compiler.ver }} --install-suggests | |
echo "CXX=clang++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
- name: install openmpi | |
if: matrix.mpi == 'ON' | |
run: | | |
sudo apt install -y openmpi-bin libopenmpi-dev | |
- name: install OpenMP | |
if: matrix.openmp == 'ON' | |
run: | | |
sudo apt-get install -y libomp5-14 libomp-dev | |
- name: install gsl | |
run: sudo apt install libgsl-dev | |
# - name: Set compiler environment variables (MPI off) | |
# if: matrix.mpi == 'OFF' | |
# run: echo "CXX=${{ matrix.compiler.cmd }}" >> $GITHUB_ENV | |
- name: Set compiler environment variables (MPI on) | |
if: matrix.mpi == 'ON' | |
run: | | |
echo "OMPI_CXX=$CXX" >> $GITHUB_ENV | |
echo "CXX=mpicxx" >> $GITHUB_ENV | |
mpicxx --showme:version | |
- name: Show compiler version and CPU type | |
run: | | |
${{ env.CXX }} --version | |
- name: Compile classic mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make MPI=${{matrix.mpi}} OPENMP=${{matrix.openmp}} -j${{ steps.cpu-count.outputs.count}} sn3d exspec |