Update ci.yml #6420
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: | |
jobs: | |
clang-format: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '19' | |
check-path: . | |
clang-tidy-cppcheck: | |
name: clang-tidy and cppcheck | |
runs-on: macos-15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: Install dependencies | |
run: | | |
brew update | |
brew install llvm | |
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV | |
echo "CPPFLAGS=-I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV | |
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV | |
echo "LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/lib" >> $GITHUB_ENV | |
echo "CPATH=$HOMEBREW_PREFIX/include:$CPATH" >> $GITHUB_ENV | |
brew install openmpi gsl cppcheck || true | |
python3 -m pip install compiledb | |
- name: Generate compile_commands.json | |
run: | | |
cp artisoptions_nltenebular.h artisoptions.h | |
make clean | |
python3 -m compiledb -n --full-path make TESTMODE=ON | |
- name: Run clang-tidy | |
run: | | |
clang-tidy --version | |
xcrun run-clang-tidy | |
- name: Run cppcheck | |
run: | | |
cppcheck --version | |
cppcheck --force --error-exitcode=1 --language=c++ --enable=all --inconclusive --suppress=knownConditionTrueFalse --suppress=constParameterCallback --suppress=redundantAssignment --suppress=knownArgument --suppress=missingIncludeSystem --suppress=unusedFunction --check-level=exhaustive . | |
compile: | |
strategy: | |
matrix: | |
compiler: | |
[ | |
{name: gcc, ver: 12}, | |
{name: gcc, ver: 13}, | |
{name: gcc, ver: 14}, | |
{name: clang, ver: 19}, | |
{name: nvc++, ver: '25.1'}, | |
] | |
fail-fast: false | |
runs-on: ubuntu-24.04 | |
name: Ubuntu ${{ matrix.compiler.name }} ${{ matrix.compiler.ver }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Show CPU type and core count | |
id: cpu-count | |
run: | | |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3 | |
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")' | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
- name: Install GCC | |
if: matrix.compiler.name == 'gcc' | |
run: | | |
echo "CXX=g++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
echo "OMPI_CXX=g++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
- name: Install Clang | |
if: matrix.compiler.name == 'clang' | |
run: | | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y lld-${{ matrix.compiler.ver }} clang-${{ matrix.compiler.ver }} libomp-${{ matrix.compiler.ver }}-dev libomp5-${{ matrix.compiler.ver }} | |
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ matrix.compiler.ver }} 100 | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ matrix.compiler.ver }} 100 | |
echo "CXX=clang++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
echo "OMPI_CXX=clang++-${{ matrix.compiler.ver }}" >> $GITHUB_ENV | |
echo "LDFLAGS=-L/usr/lib/llvm-${{ matrix.compiler.ver }}/lib" >> $GITHUB_ENV | |
- name: Install nvc++ | |
if: matrix.compiler.name == 'nvc++' | |
uses: fortran-lang/setup-fortran@v1 | |
with: | |
compiler: nvidia-hpc | |
version: ${{ matrix.compiler.ver }} | |
- name: Set nvc++ as compiler | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
echo "CXX=nvc++" >> $GITHUB_ENV | |
echo "OMPI_CXX=nvc++" >> $GITHUB_ENV | |
- name: Install GSL | |
run: | | |
sudo apt install libgsl-dev | |
- name: Install TBB | |
if: matrix.compiler.name == 'gcc' | |
run: | | |
sudo apt install libtbb-dev | |
- name: Install OpenMPI | |
run: | | |
sudo apt install -y openmpi-bin libopenmpi-dev | |
- name: Compile classic mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode OPENMP=ON | |
run: | | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode STDPAR=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile classic mode STDPAR=ON GPU=ON | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode OPENMP=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode STDPAR=ON | |
if: matrix.compiler.name != 'nvc++' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile nebular mode STDPAR=ON GPU=ON | |
if: matrix.compiler.name == 'nvc++' | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON GPU=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Compile all remaining option files | |
run: | | |
find . -name "artisoptions_*.h" ! -name "artisoptions_classic.h" ! -name "artisoptions_nebular.h" -exec sh -c 'cp -v -p {} artisoptions.h && make sn3d' \; | |
mac-clang: | |
runs-on: macos-15 | |
name: Apple Clang and LLVM Clang | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Show CPU Core Count | |
id: cpu-count | |
run: | | |
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")' | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 'latest-stable' | |
- name: Install dependencies | |
run: | | |
brew update | |
brew install gsl openmpi || true | |
- name: Install OpenMP | |
run: | | |
brew install libomp || true | |
brew link --force libomp | |
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib $LDFLAGS" >> $GITHUB_ENV | |
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include $CXXFLAGS" >> $GITHUB_ENV | |
- name: Apple Clang Compile classic mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile classic mode OPENMP=ON | |
run: | | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile classic mode STDPAR=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile nebular mode OPENMP=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile nebular mode STDPAR=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: Apple Clang Compile all remaining option files | |
run: | | |
find . -name "artisoptions_*.h" ! -name "artisoptions_classic.h" ! -name "artisoptions_nebular.h" -exec sh -c 'cp -v -p {} artisoptions.h && make sn3d' \; | |
- name: Install LLVM | |
run: | | |
brew install llvm || true | |
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | |
echo "LDFLAGS=-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -lunwind" >> $GITHUB_ENV | |
echo "CPPFLAGS=-I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
- name: LLVM Clang Compile classic mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile classic mode OPENMP=ON | |
run: | | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile classic mode STDPAR=ON | |
run: | | |
clang++ -v | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile nebular mode | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile nebular mode OPENMP=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make OPENMP=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile nebular mode STDPAR=ON | |
run: | | |
cp -v -p artisoptions_classic.h artisoptions.h | |
make clean | |
make STDPAR=ON -j${{ steps.cpu-count.outputs.count}} sn3d exspec | |
- name: LLVM Clang Compile all remaining option files | |
run: | | |
find . -name "artisoptions_*.h" ! -name "artisoptions_classic.h" ! -name "artisoptions_nebular.h" -exec sh -c 'cp -v -p {} artisoptions.h && make sn3d' \; |