From 972dbe9ff58cdcbc82dac9883654e312de1b6508 Mon Sep 17 00:00:00 2001 From: marvinfriede <51965259+marvinfriede@users.noreply.github.com> Date: Fri, 13 Jan 2023 11:28:46 +0100 Subject: [PATCH 1/3] Add workflow for testing --- .github/workflows/test.yml | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..948504a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,88 @@ +name: CI + +on: [push, pull_request] + +env: + M_BUILD_DIR: _build_meson + C_BUILD_DIR: _build_cmake + PIP_PACKAGES: >- + meson==0.55.3 + ninja + cmake + gcovr +jobs: + gcc-build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + gcc_v: [9, 10] + + env: + FC: gfortran + CC: gcc + GCC_V: ${{ matrix.gcc_v }} + OMP_NUM_THREADS: 2,1 + PYTHON_V: 3.8 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/setup-python@v1 + with: + python-version: ${{ env.PYTHON_V }} + + - name: Install GCC (OSX) + if: contains(matrix.os, 'macos') + run: | + ln -s /usr/local/bin/gfortran-${{ env.GCC_V }} /usr/local/bin/gfortran + ln -s /usr/local/bin/gcc-${{ env.GCC_V }} /usr/local/bin/gcc + ln -s /usr/local/bin/g++-${{ env.GCC_V }} /usr/local/bin/g++ + + - name: Install GCC (Linux) + if: contains(matrix.os, 'ubuntu') + run: >- + sudo update-alternatives + --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} + --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }} + + - name: Install CBLAS and LAPACKE + if: contains(matrix.os, 'ubuntu') + run: sudo apt-get install libopenblas-dev liblapacke liblapacke-dev libatlas-base-dev + + - name: Install meson and test dependencies + run: pip3 install ${{ env.PIP_PACKAGES }} + + - name: Configure build + run: >- + meson setup ${{ env.M_BUILD_DIR }} + --buildtype=debug + --prefix=$PWD/_dist + --libdir=lib + --warnlevel=0 + -Db_coverage=${{ env.COVERAGE }} + env: + COVERAGE: ${{ contains(matrix.os, 'ubuntu') && 'true' || 'false' }} + + - name: Build library + run: meson compile -C ${{ env.M_BUILD_DIR }} + + - name: Run unit tests + run: | + meson test -C ${{ env.M_BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2 + + - name: Create coverage report + if: contains(matrix.os, 'ubuntu') + run: | + ninja -C ${{ env.M_BUILD_DIR }} coverage + + - name: Install project + run: | + meson install -C ${{ env.M_BUILD_DIR }} --no-rebuild + echo "DFTD4_PREFIX=$PWD/_dist" >> $GITHUB_ENV + + - name: Upload coverage report + uses: codecov/codecov-action@v1 From 9ce9338becdde20b92bf669c68ffddca6f686fce Mon Sep 17 00:00:00 2001 From: marvinfriede <51965259+marvinfriede@users.noreply.github.com> Date: Fri, 13 Jan 2023 11:29:05 +0100 Subject: [PATCH 2/3] Remove `extern "C"` --- include/dftd_cblas.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/dftd_cblas.h b/include/dftd_cblas.h index 4cfb1d1..eb73982 100644 --- a/include/dftd_cblas.h +++ b/include/dftd_cblas.h @@ -19,10 +19,8 @@ #include "dftd_matrix.h" -extern "C" { #include "cblas.h" #include "lapacke.h" -} namespace dftd4 { From 22a6c64397774bae4bb6290258aa452ea6f59ad4 Mon Sep 17 00:00:00 2001 From: marvinfriede <51965259+marvinfriede@users.noreply.github.com> Date: Fri, 13 Jan 2023 12:51:25 +0100 Subject: [PATCH 3/3] Update versions --- .github/workflows/test.yml | 143 +++++++++++++++++++++---------------- 1 file changed, 81 insertions(+), 62 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 948504a..f3caa28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,27 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - master + paths-ignore: + - "docs/**" + - "*.md" + - "*.rst" + + pull_request: + paths-ignore: + - "docs/**" + - "*.md" + - "*.rst" + + workflow_dispatch: env: M_BUILD_DIR: _build_meson C_BUILD_DIR: _build_cmake PIP_PACKAGES: >- - meson==0.55.3 + meson>=0.45 ninja cmake gcovr @@ -17,7 +32,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - gcc_v: [9, 10] + gcc_v: [9, 10, 11, 12] env: FC: gfortran @@ -27,62 +42,66 @@ jobs: PYTHON_V: 3.8 steps: - - name: Checkout code - uses: actions/checkout@v2 - - - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_V }} - - - name: Install GCC (OSX) - if: contains(matrix.os, 'macos') - run: | - ln -s /usr/local/bin/gfortran-${{ env.GCC_V }} /usr/local/bin/gfortran - ln -s /usr/local/bin/gcc-${{ env.GCC_V }} /usr/local/bin/gcc - ln -s /usr/local/bin/g++-${{ env.GCC_V }} /usr/local/bin/g++ - - - name: Install GCC (Linux) - if: contains(matrix.os, 'ubuntu') - run: >- - sudo update-alternatives - --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} - --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }} - - - name: Install CBLAS and LAPACKE - if: contains(matrix.os, 'ubuntu') - run: sudo apt-get install libopenblas-dev liblapacke liblapacke-dev libatlas-base-dev - - - name: Install meson and test dependencies - run: pip3 install ${{ env.PIP_PACKAGES }} - - - name: Configure build - run: >- - meson setup ${{ env.M_BUILD_DIR }} - --buildtype=debug - --prefix=$PWD/_dist - --libdir=lib - --warnlevel=0 - -Db_coverage=${{ env.COVERAGE }} - env: - COVERAGE: ${{ contains(matrix.os, 'ubuntu') && 'true' || 'false' }} - - - name: Build library - run: meson compile -C ${{ env.M_BUILD_DIR }} - - - name: Run unit tests - run: | - meson test -C ${{ env.M_BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2 - - - name: Create coverage report - if: contains(matrix.os, 'ubuntu') - run: | - ninja -C ${{ env.M_BUILD_DIR }} coverage - - - name: Install project - run: | - meson install -C ${{ env.M_BUILD_DIR }} --no-rebuild - echo "DFTD4_PREFIX=$PWD/_dist" >> $GITHUB_ENV - - - name: Upload coverage report - uses: codecov/codecov-action@v1 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_V }} + + - name: Install GCC ${{ matrix.GCC_V }} (OSX) + if: contains(matrix.os, 'macos') + run: | + ln -s /usr/local/bin/gfortran-${{ env.GCC_V }} /usr/local/bin/gfortran + ln -s /usr/local/bin/gcc-${{ env.GCC_V }} /usr/local/bin/gcc + ln -s /usr/local/bin/g++-${{ env.GCC_V }} /usr/local/bin/g++ + + - name: Install GCC (Linux) + if: contains(matrix.os, 'ubuntu') + run: >- + sudo update-alternatives + --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_V }} 100 + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ env.GCC_V }} + --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_V }} + + - name: Install CBLAS and LAPACKE + if: contains(matrix.os, 'ubuntu') + run: sudo apt-get install libopenblas-dev liblapacke liblapacke-dev libatlas-base-dev + + - name: Install meson and test dependencies + run: pip3 install ${{ env.PIP_PACKAGES }} + + - name: Configure build + run: >- + meson setup ${{ env.M_BUILD_DIR }} + --buildtype=debug + --prefix=$PWD/_dist + --libdir=lib + --warnlevel=0 + -Db_coverage=${{ env.COVERAGE }} + env: + COVERAGE: ${{ contains(matrix.os, 'ubuntu') && 'true' || 'false' }} + + - name: Build library + run: meson compile -C ${{ env.M_BUILD_DIR }} + + - name: Run unit tests + run: | + meson test -C ${{ env.M_BUILD_DIR }} --print-errorlogs --no-rebuild --num-processes 2 -t 2 + + - name: Create coverage report + if: matrix.os == 'ubuntu-latest' && matrix.GCC_V == '11' + run: | + ninja -C ${{ env.M_BUILD_DIR }} coverage + + - name: Install project + run: | + meson install -C ${{ env.M_BUILD_DIR }} --no-rebuild + echo "DFTD4_PREFIX=$PWD/_dist" >> $GITHUB_ENV + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + if: matrix.os == 'ubuntu-latest' && matrix.GCC_V == '11' + with: + files: ./coverage.xml # optional