Use Ninja when available to build CMake targets #1181
Workflow file for this run
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, pull_request] | |
jobs: | |
basicchecks: | |
name: Basic checks | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
outputs: | |
hassecrets: ${{ steps.checksecrets.outputs.hassecrets }} | |
steps: | |
- name: Checkout Colvars | |
uses: actions/checkout@v3 | |
- name: Load compiler cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.ccache | |
key: ${{ runner.os }}-build-basic-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-basic- | |
- name: Get small downloadable packages | |
uses: actions/checkout@v3 | |
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) | |
env: | |
CCACHE: ccache | |
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 | |
CCACHE: ccache | |
CXX: clang++ | |
CC: clang | |
run: cmake -P devel-tools/build_test_library.cmake | |
- name: Build library with debug flags enabled | |
env: | |
CCACHE: ccache | |
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 | |
build-doc: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Load containers cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.apptainer | |
key: Linux-x86_64-containers-build-doc-2023-07-19 | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
wget https://github.com/apptainer/apptainer/releases/download/v1.0.3/apptainer_1.0.3_amd64.deb | |
sudo apt-get -y install ./apptainer_1.0.3_amd64.deb | |
- name: Get container image | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer remote status SylabsCloud || apptainer remote add --no-login SylabsCloud cloud.sylabs.io | |
apptainer remote use SylabsCloud | |
apptainer pull texlive.sif library://giacomofiorin/default/colvars_development:texlive | |
- name: Checkout website repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'Colvars/colvars.github.io' | |
path: 'website' | |
- name: Build doc | |
working-directory: website | |
env: | |
COLVARSDIR: ${{ github.workspace }} | |
FORCE: 1 # Ignore error if branch isn't master | |
run: apptainer exec ${COLVARSDIR}/devel-tools/texlive.sif make | |
codeql: | |
name: CodeQL analysis | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
if: ${{ ! github.event.repository.private }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build dependencies for library | |
run: | | |
sudo apt-get -y install tcl8.6-dev | |
- name: Checkout OpenMM (for Lepton library) | |
uses: actions/checkout@v3 | |
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 | |
build-linux-x86_64-many: | |
name: Linux x86_64 (many compilers) | |
runs-on: ubuntu-latest | |
needs: basicchecks | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
env: | |
CCACHE: ccache | |
CMAKE_GENERATOR: Ninja | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Load compiler ccache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.ccache | |
key: ${{ runner.os }}-build-multiple-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-build-multiple- | |
# Using an exact key to forgo saving it in case of a match (tarring up | |
# is expensive); also including a date to allow a force-update. | |
- name: Load containers cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.apptainer | |
key: Linux-x86_64-containers-build-2023-09-05 | |
- name: Get small downloadable packages | |
uses: actions/checkout@v3 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
wget https://github.com/apptainer/apptainer/releases/download/v1.0.3/apptainer_1.0.3_amd64.deb | |
sudo apt-get -y install ./apptainer_1.0.3_amd64.deb | |
- name: Get container image | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer remote status SylabsCloud || apptainer remote add --no-login SylabsCloud cloud.sylabs.io | |
apptainer remote use SylabsCloud | |
apptainer pull CentOS7-devel.sif library://giacomofiorin/default/colvars_development:centos7 | |
apptainer pull CentOS9-devel.sif library://giacomofiorin/default/colvars_development:centos9 | |
- 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++14 (CentOS 7) | |
env: | |
CXX_STANDARD: 14 | |
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 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++14 (CentOS 9) | |
env: | |
CXX_STANDARD: 14 | |
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++17 (CentOS 9) | |
env: | |
CXX_STANDARD: 17 | |
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++11 (CentOS 9) | |
env: | |
CXX_STANDARD: 11 | |
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: 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++17 (CentOS 9) | |
env: | |
CXX_STANDARD: 17 | |
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 | |
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@v3 | |
- name: Load containers cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.apptainer | |
key: Linux-x86_64-containers-build-2023-09-05 | |
- name: Checkout Sun compiler (Oracle Developer Studio) | |
uses: actions/checkout@v3 | |
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@v3 | |
with: | |
repository: 'Colvars/build-tools-packages' | |
ref: 'master' | |
path: 'devel-tools/packages' | |
- name: Install Apptainer | |
shell: bash | |
run: | | |
wget https://github.com/apptainer/apptainer/releases/download/v1.0.3/apptainer_1.0.3_amd64.deb | |
sudo apt-get -y install ./apptainer_1.0.3_amd64.deb | |
- name: Get container image | |
shell: bash | |
working-directory: devel-tools | |
run: | | |
apptainer remote status SylabsCloud || apptainer remote add --no-login SylabsCloud cloud.sylabs.io | |
apptainer remote use SylabsCloud | |
apptainer pull CentOS7-devel.sif library://giacomofiorin/default/colvars_development:centos7 | |
apptainer pull CentOS9-devel.sif library://giacomofiorin/default/colvars_development:centos9 | |
- 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 | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get small downloadable packages | |
uses: actions/checkout@v3 | |
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-x86_64-clang: | |
name: macOS x86_64 (AppleClang) | |
runs-on: macos-latest | |
needs: basicchecks | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get small downloadable packages | |
uses: actions/checkout@v3 | |
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 |