|
| 1 | +name: BuildCM |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_repo: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + build_type : [ Release, Debug ] |
| 15 | + os : [ macos-latest, ubuntu-20.04 ] |
| 16 | + include: |
| 17 | + - os: ubuntu-20.04 |
| 18 | + cxx: g++-10 |
| 19 | + cc: gcc-10 |
| 20 | + - os: macos-latest |
| 21 | + cxx: clang++ |
| 22 | + cc: clang |
| 23 | + |
| 24 | + name: "Repo • ${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + env: |
| 27 | + CC: ${{ matrix.cc }} |
| 28 | + CXX : ${{ matrix.cxx }} |
| 29 | + CCACHE_DIR : ${{github.workspace}}/build/.ccache |
| 30 | + CCACHE_COMPRESS : true |
| 31 | + CCACHE_COMPRESSLEVEL : 6 |
| 32 | + BUILD_CONFIG : > |
| 33 | + -G Ninja |
| 34 | + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
| 35 | + -DBUILD_SHARED_LIBS=OFF |
| 36 | + -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' |
| 37 | + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/library |
| 38 | + -DWITH_MAX_AM=2;2 |
| 39 | + -DWITH_ERI_MAX_AM=2;2 |
| 40 | + -DWITH_ERI3_MAX_AM=3;2 |
| 41 | + -DENABLE_ERI=1 |
| 42 | + -DENABLE_ERI3=1 |
| 43 | + -DENABLE_ONEBODY=1 |
| 44 | + -DDISABLE_ONEBODY_PROPERTY_DERIVS=ON |
| 45 | + -DMULTIPOLE_MAX_ORDER=2 |
| 46 | + -DLIBINT2_ENABLE_PYTHON=ON |
| 47 | +
|
| 48 | + outputs: |
| 49 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + with: |
| 54 | + fetch-depth: 0 |
| 55 | + # fetch-depth: 0 for git history to compute version |
| 56 | + |
| 57 | + - id: skip_check |
| 58 | + name: Check if can skip |
| 59 | + uses: fkirc/skip-duplicate-actions@v5 |
| 60 | + with: |
| 61 | + cancel_others: 'true' |
| 62 | + |
| 63 | + - name: Create Build Environment |
| 64 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
| 65 | + # Some projects don't allow in-source building, so create a separate build directory |
| 66 | + # We'll use this as our working directory for all subsequent commands |
| 67 | + run: | |
| 68 | + cmake -E make_directory ${{github.workspace}}/build/compiler |
| 69 | + cmake -E make_directory ${{github.workspace}}/build/library |
| 70 | + cmake -E make_directory ${{github.workspace}}/build/library_test |
| 71 | +
|
| 72 | + - name: Install prerequisite MacOS packages |
| 73 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'macos-latest' }} |
| 74 | + run: | |
| 75 | + brew install ninja gcc@10 boost eigen ccache [email protected] numpy scipy |
| 76 | + echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV |
| 77 | + echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV |
| 78 | +
|
| 79 | + - name: Install prerequisite Ubuntu packages |
| 80 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'ubuntu-20.04' }} |
| 81 | + run: | |
| 82 | + sudo apt-get update |
| 83 | + sudo apt-get install ninja-build g++-10 gfortran-10 liblapack-dev libboost-dev libeigen3-dev ccache python3-numpy python3-scipy |
| 84 | + echo "FC=/usr/bin/gfortran-10" >> $GITHUB_ENV |
| 85 | + echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV |
| 86 | +
|
| 87 | + - name: Prepare ccache timestamp |
| 88 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
| 89 | + id: ccache_cache_timestamp |
| 90 | + shell: cmake -P {0} |
| 91 | + run: | |
| 92 | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) |
| 93 | + message("\"timestamp=${current_date}\" >> $GITHUB_OUTPUT") |
| 94 | +
|
| 95 | + - name: Setup ccache cache files |
| 96 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
| 97 | + uses: actions/cache@v3 |
| 98 | + with: |
| 99 | + path: ${{github.workspace}}/build/.ccache |
| 100 | + key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} |
| 101 | + restore-keys: | |
| 102 | + ${{ matrix.config.name }}-ccache- |
| 103 | +
|
| 104 | + - name: Generate Libint generator |
| 105 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
| 106 | + # Use a bash shell so we can use the same syntax for environment variable |
| 107 | + # access regardless of the host operating system |
| 108 | + shell: bash |
| 109 | + working-directory: ${{github.workspace}}/build/compiler |
| 110 | + run: | |
| 111 | + git describe --tags |
| 112 | + cmake -S ../.. -B build $BUILD_CONFIG --log-level=DEBUG |
| 113 | + cmake --build build --target check-libint2compiler |
| 114 | +
|
| 115 | + - name: Generate Libint library |
| 116 | + if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
| 117 | + shell: bash |
| 118 | + working-directory: ${{github.workspace}}/build/compiler |
| 119 | + run: | |
| 120 | + cmake --build build --target libint-library-generate |
| 121 | +
|
0 commit comments