min_image fix; Saves long simulations from crashing; Addresses https:… #2312
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: "Library" | |
on: | |
push: | |
jobs: | |
basicchecks: | |
name: Basic checks | |
runs-on: ubuntu-latest | |
outputs: | |
hassecrets: ${{ steps.checksecrets.outputs.hassecrets }} | |
env: | |
CCACHE: ccache | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- name: Checkout Colvars | |
uses: actions/checkout@v4 | |
- name: Load compiler cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/ccache | |
key: ${{ runner.os }}-build-basic-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-basic- | |
- name: Get small downloadable packages | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Install build dependencies for library | |
run: | | |
sudo apt -y install ccache tcl8.6-dev clang | |
- name: Test build recipes | |
run: bash devel-tools/check_build_recipes | |
- name: Convert BibTeX references to code | |
shell: bash | |
working-directory: doc | |
run: | | |
make update-code-refs | |
if [ -n "$(git status --porcelain ../src/colvarmodule_refs.h)" ] ; then | |
echo "Code citations out of date; please run make update-code-refs in the doc folder" >& 2 | |
exit 1 | |
fi | |
- name: Build and test library (GCC) | |
run: cmake -P devel-tools/build_test_library.cmake | |
- name: Check documentation of command-line scripting interface | |
shell: bash | |
working-directory: doc | |
run: | | |
make update-cvscript-cmdline-doc | |
if [ -n "$(git status --porcelain cvscript-tcl.tex)" ] ; then | |
echo "Command-line scripting doc out of date; please run make update-cvscript-cmdline-doc and commit changes" >& 2 | |
exit 1 | |
fi | |
- name: Build and test library (Clang) | |
env: | |
CMAKE_BUILD_DIR: build-clang | |
CXX: clang++ | |
CC: clang | |
run: cmake -P devel-tools/build_test_library.cmake | |
- name: Build library with debug code enabled (GCC) | |
run: cmake -D COLVARS_DEBUG=ON -P devel-tools/build_test_library.cmake | |
- name: Check whether secrets are available | |
id: checksecrets | |
env: | |
PULL_ORACLE_DEVELOPER_STUDIO: ${{ secrets.PULL_ORACLE_DEVELOPER_STUDIO }} | |
run: | | |
echo "hassecrets=${{ env.PULL_ORACLE_DEVELOPER_STUDIO != '' }}" >> $GITHUB_OUTPUT | |
- name: Print ccache stats | |
run: ccache -s -v | |
- name: Keep only one cache besides the one from this job | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-basic- | |
build-doc: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
sudo add-apt-repository -y ppa:apptainer/ppa | |
sudo apt update | |
sudo apt install -y apptainer-suid | |
- name: Get container image | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer pull texlive.sif oras://ghcr.io/colvars/devel-containers:texlive | |
- name: Checkout website repository | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.PULL_PUSH_COLVARS_GITHUB_IO }} | |
repository: 'Colvars/colvars.github.io' | |
path: 'website' | |
- name: Build doc for current branch | |
working-directory: doc | |
run: | | |
make clean-all | |
apptainer exec ${{ github.workspace }}/devel-tools/texlive.sif make | |
- name: Install SSH key for access to website repository | |
if: contains(github.event.head_commit.message, '[update-doc]') | |
env: | |
WEBSITE_SSH_KEY: ${{ secrets.PULL_PUSH_COLVARS_GITHUB_IO }} | |
run: | | |
mkdir -p -m 700 ~/.ssh | |
echo "${WEBSITE_SSH_KEY}" > ~/.ssh/website | |
chmod 600 ~/.ssh/website | |
- name: Push updated doc to website repository | |
working-directory: doc | |
if: contains(github.event.head_commit.message, '[update-doc]') | |
env: | |
COLVARS_WEBSITE_TREE: ${{ github.workspace }}/website | |
run: | | |
apptainer exec ${{ github.workspace }}/devel-tools/texlive.sif make install | |
export GIT_SSH="ssh -i ~/.ssh/website" | |
git config --global user.email "noreply@github.com" | |
git config --global user.name "CI runner" | |
bash update_website.sh ${{ github.workspace }}/website | |
codeql: | |
name: CodeQL analysis | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
if: ${{ ! github.event.repository.private }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install build dependencies for library | |
run: | | |
sudo apt-get -y install tcl8.6-dev | |
- name: Checkout OpenMM (for Lepton library) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'openmm/openmm' | |
ref: 'master' | |
path: 'openmm-source' | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: cpp | |
- name: Build Colvars library with CMake | |
run: cmake -P devel-tools/build_test_library.cmake | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
static-analyser: | |
name: Clang 14 Static Analyser | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install build dependencies for library | |
run: | | |
sudo apt -y install tcl8.6-dev clang-14 clang-tools-14 | |
- name: Checkout OpenMM (for Lepton library) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'openmm/openmm' | |
ref: 'master' | |
path: 'openmm-source' | |
- name: Perform Clang Static Analyser | |
env: | |
CXX: clang++-14 | |
CC: clang-14 | |
run: | | |
scan-build-14 --use-cc=clang-14 --use-c++=clang++-14 cmake -P devel-tools/build_test_library.cmake 2>&1 | tee build_analyser.log | |
grep "CMake Error" build_analyser.log > build_errors.log || true | |
if [ -s build_errors.log ] ; then | |
echo "Found compiler errors during build" | |
cat build_analyser.log | |
exit 1 | |
fi | |
- name: Analyze logs | |
run: | # Retrieve warnings generated but not the ones of OpenMM | |
awk '/colvars\/colvars\/[^openmm].*warning:/,/warning.*generated|^$/' build_analyser.log | tee warnings_analyser.log || true | |
if [ -s warnings_analyser.log ] ; then | |
echo "Found compiler warning during build" | |
exit 1 | |
fi | |
- name: Archive warnings artifacts | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: warnings_clang_static_analyser | |
path: warnings_analyser.log | |
address-sanitizer: | |
name: Clang 16 address sanitizer | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
env: | |
CCACHE: ccache | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load compiler ccache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/ccache | |
key: ${{ runner.os }}-build-asan-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-asan- | |
- name: Checkout OpenMM (for Lepton library) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'openmm/openmm' | |
ref: 'master' | |
path: 'openmm-source' | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
sudo add-apt-repository -y ppa:apptainer/ppa | |
sudo apt update | |
sudo apt install -y apptainer-suid | |
- name: Get container images for build dependencies | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer pull CentOS9-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS9-devel | |
- name: Build with Clang 16 and address sanitizer | |
env: | |
CXX: clang++ | |
CC: clang | |
CMAKE_ADDRESS_SANITIZER: ON | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
cmake -P devel-tools/build_test_library.cmake | |
- name: Archive warnings artifacts | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: Clang_address_sanitizer_output | |
path: ${{github.workspace}}/build/Testing/Temporary/LastTest.log | |
- name: Keep only one cache besides the one from this job | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-asan- | |
build-linux-x86_64-many: | |
name: Linux x86_64 (GCC, Clang) | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
env: | |
CCACHE: ccache | |
CMAKE_GENERATOR: Ninja | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load compiler ccache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/ccache | |
key: ${{ runner.os }}-build-multiple-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-multiple- | |
- name: Get small downloadable packages | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
sudo add-apt-repository -y ppa:apptainer/ppa | |
sudo apt update | |
sudo apt install -y apptainer-suid | |
- name: Get container images for build dependencies | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer pull CentOS7-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS7-devel | |
apptainer pull CentOS9-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS9-devel | |
- name: GCC 4.8, C++11 (CentOS 7) | |
env: | |
CXX_STANDARD: 11 | |
CXX: g++ | |
CXX_VERSION: 4.8 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: Clang 3.4, C++11 (CentOS 7) | |
env: | |
CXX_STANDARD: 11 | |
CXX: clang++ | |
CXX_VERSION: 11 | |
CC: clang | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: Clang 7, C++17 (CentOS 7) | |
env: | |
CXX_STANDARD: 17 | |
CXX: clang++ | |
CXX_VERSION: 7 | |
CC: clang | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
scl enable llvm-toolset-${CXX_VERSION} -- \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 8, C++17 (CentOS 7) | |
env: | |
CXX_STANDARD: 17 | |
CXX: g++ | |
CXX_VERSION: 8 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
scl enable devtoolset-${CXX_VERSION} -- \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 9, C++14 (CentOS 7) | |
env: | |
CXX_STANDARD: 14 | |
CXX: g++ | |
CXX_VERSION: 9 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
scl enable devtoolset-${CXX_VERSION} -- \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 10, C++17 (CentOS 7) | |
env: | |
CXX_STANDARD: 17 | |
CXX: g++ | |
CXX_VERSION: 10 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
scl enable devtoolset-${CXX_VERSION} -- \ | |
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 11, C++11 (CentOS 9) | |
env: | |
CXX_STANDARD: 11 | |
CXX: g++ | |
CXX_VERSION: 11 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 11, C++20 (CentOS 9) | |
env: | |
CXX_STANDARD: 20 | |
CXX: g++ | |
CXX_VERSION: 11 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: GCC 12, C++20 (CentOS 9) | |
env: | |
CXX_STANDARD: 20 | |
CXX: g++ | |
CXX_VERSION: 12 | |
CC: gcc | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
scl enable gcc-toolset-12 -- \ | |
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: Clang 16, C++11 (CentOS 9) | |
env: | |
CXX_STANDARD: 11 | |
CXX: clang++ | |
CXX_VERSION: 16 | |
CC: clang | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: Clang 16, C++20 (CentOS 9) | |
env: | |
CXX_STANDARD: 20 | |
CXX: clang++ | |
CXX_VERSION: 16 | |
CC: clang | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \ | |
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake | |
- name: Keep only one cache besides the one from this job | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh Linux-build-multiple- | |
build-linux-x86_64-sun: | |
name: Linux x86_64 (Sun compiler) | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
if: needs.basicchecks.outputs.hassecrets == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout Sun compiler (Oracle Developer Studio) | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/oracle' | |
ssh-key: ${{ secrets.PULL_ORACLE_DEVELOPER_STUDIO }} | |
ref: 'master' | |
path: ${{github.workspace}}/oracle | |
- name: Get small downloadable packages | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
sudo add-apt-repository -y ppa:apptainer/ppa | |
sudo apt update | |
sudo apt install -y apptainer-suid | |
- name: Get container images for build dependencies | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer pull CentOS7-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS7-devel | |
- name: Build library with Sun compiler (Oracle Developer Studio) | |
shell: bash | |
env: | |
CC: ${{github.workspace}}/oracle/developerstudio12.6/bin/cc | |
CXX: ${{github.workspace}}/oracle/developerstudio12.6/bin/CC | |
run: | | |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \ | |
cmake3 -D CMAKE_CXX_STANDARD=11 -P devel-tools/build_test_library.cmake | |
build-windows-x86_64-msvc: | |
name: Windows x86_64 (MSVC) | |
runs-on: windows-latest | |
needs: basicchecks | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get small downloadable packages | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Build and test library with CMake | |
# We need to set CMAKE_SYSTEM_NAME manually in script mode | |
run: cmake -D CMAKE_SYSTEM_NAME=Windows -P devel-tools/build_test_library.cmake | |
build-macos-ARM64-clang: | |
name: macOS ARM64 (AppleClang) | |
runs-on: macos-latest | |
needs: basicchecks | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get small downloadable packages | |
uses: actions/checkout@v4 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Build and test library with CMake | |
# We need to set CMAKE_SYSTEM_NAME manually in script mode | |
run: cmake -D CMAKE_SYSTEM_NAME=Darwin -P devel-tools/build_test_library.cmake |