From a3359a9af5224eb139b4811991da9b9933c156bf Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 15:40:59 -0500 Subject: [PATCH 01/17] New docker-image-based CI --- .github/Dockerfile/base-catch2.Dockerfile | 28 ++++ .github/Dockerfile/base-libboost.Dockerfile | 11 ++ .github/Dockerfile/base-libfort.Dockerfile | 19 +++ .../container-build_test_release/Dockerfile | 24 +++ .../container-build_test_release/action.yaml | 86 ++++++++++ .../docker-action/Dockerfile | 54 +++++++ .../docker-action/build_test.sh | 130 ++++++++++++++++ .../entrypoint.sh | 53 +++++++ .github/workflows/build_base.yaml | 96 ++++++++++++ .github/workflows/build_test_release.yaml | 147 ++++++++++++++++++ .github/workflows/c-cpp.yaml | 25 --- CMakeLists.txt | 9 +- tests/cxx/integration_tests/blank_test.cpp | 13 ++ 13 files changed, 668 insertions(+), 27 deletions(-) create mode 100644 .github/Dockerfile/base-catch2.Dockerfile create mode 100644 .github/Dockerfile/base-libboost.Dockerfile create mode 100644 .github/Dockerfile/base-libfort.Dockerfile create mode 100644 .github/actions/container-build_test_release/Dockerfile create mode 100644 .github/actions/container-build_test_release/action.yaml create mode 100644 .github/actions/container-build_test_release/docker-action/Dockerfile create mode 100644 .github/actions/container-build_test_release/docker-action/build_test.sh create mode 100644 .github/actions/container-build_test_release/entrypoint.sh create mode 100644 .github/workflows/build_base.yaml create mode 100644 .github/workflows/build_test_release.yaml delete mode 100644 .github/workflows/c-cpp.yaml create mode 100644 tests/cxx/integration_tests/blank_test.cpp diff --git a/.github/Dockerfile/base-catch2.Dockerfile b/.github/Dockerfile/base-catch2.Dockerfile new file mode 100644 index 000000000..8a10b0479 --- /dev/null +++ b/.github/Dockerfile/base-catch2.Dockerfile @@ -0,0 +1,28 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG PARENT_IMAGE_NAME + +FROM ${PARENT_IMAGE_NAME}:latest + +ARG CATCH2_VERSION + +# Install catch2 ## +RUN cd /tmp \ + && git clone -b v${CATCH2_VERSION} https://github.com/catchorg/Catch2.git \ + && cd Catch2 \ + && cmake -Bbuild -H. -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/install \ + && cmake --build build \ + && cmake --build build --target install \ + && rm -rf /tmp/Catch2 diff --git a/.github/Dockerfile/base-libboost.Dockerfile b/.github/Dockerfile/base-libboost.Dockerfile new file mode 100644 index 000000000..7a4782a4b --- /dev/null +++ b/.github/Dockerfile/base-libboost.Dockerfile @@ -0,0 +1,11 @@ +ARG PARENT_IMAGE_NAME + +FROM ${PARENT_IMAGE_NAME}:latest + +ARG LIBBOOST_VERSION + +# Install libboost ## +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y libboost-all-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* diff --git a/.github/Dockerfile/base-libfort.Dockerfile b/.github/Dockerfile/base-libfort.Dockerfile new file mode 100644 index 000000000..0e2a632fe --- /dev/null +++ b/.github/Dockerfile/base-libfort.Dockerfile @@ -0,0 +1,19 @@ +ARG PARENT_IMAGE_NAME + +FROM ${PARENT_IMAGE_NAME}:latest + +ARG LIBFORT_VERSION + +# Install libfort# +ENV INSTALL_PATH=../install + +RUN wget --no-check-certificate --content-disposition https://codeload.github.com/seleznevae/libfort/tar.gz/refs/tags/v${LIBFORT_VERSION} \ + && tar -zxf libfort-${LIBFORT_VERSION}.tar.gz \ + && cd libfort-${LIBFORT_VERSION} \ + && cmake -GNinja -H. -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \ + && cmake --build build \ + && cmake --build build --target install \ + && cd .. \ + && rm -rf libfort-${LIBFORT_VERSION} libfort-${LIBFORT_VERSION}.tar.gz + +ENV PATH="`pwd`/install:${PATH}" diff --git a/.github/actions/container-build_test_release/Dockerfile b/.github/actions/container-build_test_release/Dockerfile new file mode 100644 index 000000000..eec40bc1c --- /dev/null +++ b/.github/actions/container-build_test_release/Dockerfile @@ -0,0 +1,24 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM alpine:latest + +COPY docker-action /docker-action +COPY entrypoint.sh /entrypoint.sh + +RUN apk add --update --no-cache docker +RUN ["chmod", "+x", "/entrypoint.sh"] + +# Code file to execute when the docker container starts up (`entrypoint.sh`) +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/container-build_test_release/action.yaml b/.github/actions/container-build_test_release/action.yaml new file mode 100644 index 000000000..10703a3dd --- /dev/null +++ b/.github/actions/container-build_test_release/action.yaml @@ -0,0 +1,86 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: container action to build ParallelZone + +description: container action from the base image to build ParallelZone + +inputs: + base_tag: + description: 'tag of the base image' + type: string + required: false + default: 'stable' + dep_repo_tag: + description: 'tag of the dependent repo images' + type: string + required: false + default: '' + token: + type: string + required: true + user: + type: string + required: true + cmake_version: + type: string + required: false + default: '' + gcc_version: + type: string + required: false + default: '' + clang_version: + type: string + required: false + default: '' + ninja_build: + type: boolean + required: true + use_clang: + type: boolean + required: true + CMAIZE_GITHUB_TOKEN: + type: string + required: true + INSTALL: + type: boolean + required: true + test: + type: boolean + required: true + integration_test: + type: boolean + required: true + branch_name: + type: string + required: true +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.token }} # 1 + - ${{ inputs.user }} # 2 + - ${{ inputs.base_tag }} # 3 + - ${{ inputs.cmake_version }} # 4 + - ${{ inputs.gcc_version }} # 5 + - ${{ inputs.clang_version }} # 6 + - ${{ inputs.ninja_build }} # 7 + - ${{ inputs.use_clang }} # 8 + - ${{ inputs.CMAIZE_GITHUB_TOKEN }} # 9 + - ${{ inputs.INSTALL }} # 10 + - ${{ inputs.test }} # 11 + - ${{ inputs.integration_test }} # 12 + - ${{ inputs.branch_name }} # 13 + - ${{ inputs.dep_repo_tag }} # 14 diff --git a/.github/actions/container-build_test_release/docker-action/Dockerfile b/.github/actions/container-build_test_release/docker-action/Dockerfile new file mode 100644 index 000000000..dad04304c --- /dev/null +++ b/.github/actions/container-build_test_release/docker-action/Dockerfile @@ -0,0 +1,54 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +ARG dep_repo_tag + +FROM ghcr.io/nwchemex-project/release_parallelzone:$dep_repo_tag +FROM ghcr.io/nwchemex-project/release_utilities:$dep_repo_tag + +ARG base_tag + +FROM ghcr.io/nwchemex-project/base_parallelzone:$base_tag + +COPY --from=0 /install /install + +COPY --from=1 /install /install + +COPY build_test.sh /build_test.sh + +RUN ["chmod", "+x", "/build_test.sh"] + +ARG cmake_version +ARG gcc_version +ARG clang_version +ARG ninja_build +ARG use_clang +ARG cmaize_github_token +ARG install +ARG unit_test +ARG int_test +ARG branch_name + + +ENV env_cmake_version=$cmake_version +ENV env_gcc_version=$gcc_version +ENV env_clang_version=$clang_version +ENV env_ninja_build=$ninja_build +ENV env_use_clang=$use_clang +ENV env_cmaize_github_token=$cmaize_github_token +ENV env_install=$install +ENV env_unit_test=$unit_test +ENV env_int_test=$int_test +ENV env_branch_name=$branch_name + +ENTRYPOINT ["/build_test.sh"] diff --git a/.github/actions/container-build_test_release/docker-action/build_test.sh b/.github/actions/container-build_test_release/docker-action/build_test.sh new file mode 100644 index 000000000..91e4b5d69 --- /dev/null +++ b/.github/actions/container-build_test_release/docker-action/build_test.sh @@ -0,0 +1,130 @@ +#!/bin/sh +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Wraps the process for configuring, building, and testing an NWX repo +# +# Usage: +# build_test.sh +# +# Other variables: +# cmake_version: the version of cmake being used in the format x.y.z +# + +set -e # Exit with error if any command fails + +# checkout repo with the current branch (not master!) + +git clone -b ${env_branch_name} https://github.com/NWChemEx-Project/PluginPlay.git +cd PluginPlay + +cmake_command=cmake +ctest_command=ctest +toolchain_file=$(pwd)/toolchain.cmake + + +echo "set(BUILD_TESTING ON)" > "${toolchain_file}" +{ + echo "set(CMAKE_CXX_STANDARD 17)" + echo 'set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)' + echo "set(BUILD_SHARED_LIBS ON)" + echo "set(CATCH_ENABLE_COVERAGE ON)" + echo "set(CMAKE_PREFIX_PATH /install)" + echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -std=c++17")' + echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMPI_SKIP_MPICXX")' + echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")' + echo 'set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs")' + echo 'set(CMAIZE_GITHUB_TOKEN '${env_cmaize_github_token}')' + echo 'set(CMAKE_BUILD_TYPE Release)' + echo 'set(ENABLE_SCALAPACK ON)' + echo 'set(LIBDIR "/usr/lib/x86_64-linux-gnu")' + echo 'set(BLAS_LIBRARIES "-L${LIBDIR} -lopenblas")' + echo 'set(LAPACK_LIBRARIES "-L${LIBDIR} -llapack ${BLAS_LIBRARIES}")' + echo 'set(ScaLAPACK_LIBRARIES "-L${LIBDIR} -lscalapack-openmpi ${LAPACK_LIBRARIES}")' + echo 'set(NWX_MODULE_DIRECTORY "./NWX_PyModules")' +} >> "${toolchain_file}" + + +# if clang_build is true set clang and +# clang++ as default c and cxx compiler +# otherwise set gcc as default +# clang and gcc version controlled by defaults +# or inputs +if [ "${env_use_clang}" = true ] +then + { + echo "set(CMAKE_C_COMPILER /usr/bin/clang-${env_clang_version})" + echo "set(CMAKE_CXX_COMPILER /usr/bin/clang++-${env_clang_version})" + echo 'set(gpu_backend "none" CACHE STRING "" FORCE)' + } >> "${toolchain_file}" +else + { + echo "set(CMAKE_C_COMPILER /usr/bin/gcc-${env_gcc_version})" + echo "set(CMAKE_CXX_COMPILER /usr/bin/g++-${env_gcc_version})" + } >> "${toolchain_file}" +fi + +#Step 2: Configure +if [ "${env_install}" = true ]; then + export INSTALL_PATH=/install + if [ "${env_ninja_build}" = true ] ; then + ${cmake_command} -GNinja -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} + else + ${cmake_command} -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} + fi +else + if [ "${env_ninja_build}" = true ] ; then + ${cmake_command} -GNinja -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" + else + ${cmake_command} -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" + fi +fi + +#Step 3: Compile +${cmake_command} --build build + +# Step 4: test + +# set up the envs for running mpiexec in a container +# otherwise tests would fail +export OMPI_ALLOW_RUN_AS_ROOT=1 +export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + +cd build +# unit testing +if [ "${env_unit_test}" = true ]; then + echo "Running unit tests..." + ${ctest_command} -VV -R test_unit* +fi +# integration testing +if [ "${env_int_test}" = true ]; then + echo "Running integration tests..." + ${ctest_command} -VV -R test_integration* +fi +# test docs +echo "Running doc tests..." +${ctest_command} -VV -R *docs + +# python testing +echo "Running python tests..." +${ctest_command} -VV -R py +cd .. + +#Step 5: Install +if [ "${env_install}" = true ]; then + echo "Installing package..." + ${cmake_command} --build build --target install +fi + diff --git a/.github/actions/container-build_test_release/entrypoint.sh b/.github/actions/container-build_test_release/entrypoint.sh new file mode 100644 index 000000000..ae10a8a31 --- /dev/null +++ b/.github/actions/container-build_test_release/entrypoint.sh @@ -0,0 +1,53 @@ +#!/bin/sh -l +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +CR_PAT=$1 +USER=$2 +BASE_TAG=$3 +CMAKE_VERSION=$4 +GCC_VRESION=$5 +CLANG_VERSION=$6 +NINJA_BUILD=$7 +USE_CLANG=$8 +CMAIZE_GITHUB_TOKEN=$9 +INSTALL=${10} +TEST=${11} +INTEGRATION_TEST=${12} +BRANCH_NAME=${13} +DEP_REPO_TAG=${14} + +cd /docker-action + +echo $CR_PAT | docker login ghcr.io -u $USER --password-stdin + +docker build -t docker-action --build-arg base_tag=$BASE_TAG --build-arg gcc_version=$GCC_VRESION --build-arg clang_version=$CLANG_VERSION --build-arg ninja_build=$NINJA_BUILD --build-arg use_clang=$USE_CLANG --build-arg cmaize_github_token=$CMAIZE_GITHUB_TOKEN --build-arg install=$INSTALL --build-arg unit_test=$TEST --build-arg int_test=$INTEGRATION_TEST --build-arg branch_name=$BRANCH_NAME --build-arg dep_repo_tag=${DEP_REPO_TAG} . && docker run docker-action + +container_id="$(docker ps -a | grep 'docker-action')" +container_id="${container_id%% *}" +docker cp ${container_id}:/install ./install + +cat <> release.Dockerfile +FROM scratch +ADD install /install +EOF + +if [ "${USE_CLANG}" = true ]; then + docker build -t ghcr.io/nwchemex-project/release_pluginplay:clang-latest -f release.Dockerfile . + docker push ghcr.io/nwchemex-project/release_pluginplay:clang-latest +else + docker build -t ghcr.io/nwchemex-project/release_pluginplay:gcc-latest -f release.Dockerfile . + docker push ghcr.io/nwchemex-project/release_pluginplay:gcc-latest +fi diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml new file mode 100644 index 000000000..af205f71a --- /dev/null +++ b/.github/workflows/build_base.yaml @@ -0,0 +1,96 @@ +# manually input version no.s here +# will check in workflows to obtain +# this info from other files +# + +name: Build base image + +on: + workflow_call: + inputs: + cmake_version: + type: string + required: false + default: 3.17.0 + gcc_version: + type: string + required: false + default: 9 + clang_version: + type: string + required: false + default: 11 + ubuntu_version: + type: string + required: false + default: 20.04 + libfort_version: + type: string + required: false + default: 0.4.2 + libboost_version: + type: string + required: false + default: 1.71.0 + +jobs: + build-image-gcc-clang-cmake: + uses: NWChemEx-Project/.github/.github/workflows/base_image_gcc-clang-cmake.yaml@master + with: + cmake_version: ${{ inputs.cmake_version }} + gcc_version: ${{ inputs.gcc_version }} + clang_version: ${{ inputs.clang_version }} + ubuntu_version: ${{ inputs.ubuntu_version }} + secrets: inherit + + build-base-image: + runs-on: ubuntu-latest + needs: build-image-gcc-clang-cmake + steps: + - uses: actions/checkout@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_REPO_TOKEN }} + - name: Install libboost + uses: NWChemEx-Project/.github/actions/install_package@master + with: + madness_version: ${{ inputs.libboost_version }} + package_name: libboost + parent_image_name: ghcr.io/nwchemex-project/base-cmake + path_to_dockerfile: .github/Dockerfile/base-libboost.Dockerfile + - name: Install libfort + uses: NWChemEx-Project/.github/actions/install_package@master + with: + libfort_version: ${{ inputs.libfort_version }} + package_name: libfort + parent_image_name: base-libboost + path_to_dockerfile: .github/Dockerfile/base-libfort.Dockerfile + - name: Install catch2 + uses: NWChemEx-Project/.github/actions/install_package@master + with: + catch2_version: ${{ inputs.catch2_version }} + package_name: catch2 + parent_image_name: base-libfort + path_to_dockerfile: .github/Dockerfile/base-catch2.Dockerfile + - name: Push the base image + uses: NWChemEx-Project/.github/actions/push_image@master + with: + tmp_image_name: base-catch2 + tmp_image_tag: latest + image_name: ghcr.io/nwchemex-project/base_parallelzone + image_tag: latest + - name: Check stable base image + id: image_exists + shell: /usr/bin/bash {0} + run: | + docker manifest inspect ghcr.io/nwchemex-project/base_parallelzone:stable > /dev/null + echo "conclusion=$?" >> "$GITHUB_OUTPUT" + - name: Push stable base image if not exist + if: ${{ steps.image_exists.outputs.conclusion != 0 }} + run: | + docker pull ghcr.io/nwchemex-project/base_parallelzone:latest + docker tag ghcr.io/nwchemex-project/base_parallelzone:latest ghcr.io/nwchemex-project/base_parallelzone:stable + docker push ghcr.io/nwchemex-project/base_parallelzone:stable diff --git a/.github/workflows/build_test_release.yaml b/.github/workflows/build_test_release.yaml new file mode 100644 index 000000000..ae42ceada --- /dev/null +++ b/.github/workflows/build_test_release.yaml @@ -0,0 +1,147 @@ +# The building/testing/releasing process happens +# in a container created from the base image (container action). +# In the end two new release images +# ghcr.io/nwchemex-project/release_pluginplay:gcc(clang)-latest +# are generated. Whether these images are stable +# (do not break any downstream repos) or not is still +# to be tested. +# This workflow should run in the branch which opens a +# PR to dev (dev/master model to be developed). + +name: Build test release + +on: + pull_request: + branches: + - master + +jobs: + # TODO: obtain package version info + # general packages for all repos: from NWXCmake + # specific packages for a repo: from dependency_versions.txt in + # the repo + # + # A job to retrieve all package versions and output + ### + docker-file-changes: + runs-on: ubuntu-latest + outputs: + build_dockfile: ${{ steps.changes.outputs.bdfile }} + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + bdfile: + - '.github/Dockerfile/**' + + update-base-image: + needs: docker-file-changes + if: ${{ needs.docker-file-changes.outputs.build_dockfile == 'true' }} + uses: NWChemEx-Project/PluginPlay/.github/workflows/build_base.yaml@image-build_test_release + secrets: inherit + + build_update_check: + runs-on: ubuntu-latest + needs: docker-file-changes + outputs: + bi_check: ${{ steps.building-image-update.outputs.tag }} + steps: + - name: Check if the building image has been updated + id: building-image-update + run: | + if [ ${{ needs.docker-file-changes.outputs.build_dockfile == 'true' }} ]; then + tag="latest" + else + tag="stable" + fi + echo "tag=$tag" >> $GITHUB_OUTPUT + + build_test_release-gcc: + runs-on: ubuntu-latest + needs: [update-base-image, build_update_check] + if: always() && (needs.update-base-image.result == 'success' || needs.update-base-image.result == 'skipped') + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_REPO_TOKEN }} + - uses: actions/checkout@v3 + - name: Get current branch name + id: branch-name + uses: tj-actions/branch-names@v7 + - name: build test release in a container + uses: ./.github/actions/container-build_test_release + with: + ninja_build: true + test: true + integration_test: false + INSTALL: true + base_tag: ${{needs.build_update_check.outputs.bi_check}} + dep_repo_tag: gcc-stable + token: ${{ secrets.CONTAINER_REPO_TOKEN }} + user: ${{ github.actor }} + cmake_version: 3.17.0 + gcc_version: 9 + use_clang: false + CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} + branch_name: ${{ steps.branch-name.outputs.current_branch }} + - name: Check stable release image + id: image_exists + shell: /usr/bin/bash {0} + run: | + docker manifest inspect ghcr.io/nwchemex-project/release_pluginplay:gcc-stable > /dev/null + echo "conclusion=$?" >> "$GITHUB_OUTPUT" + - name: Push stable release image if not exist + if: ${{ steps.image_exists.outputs.conclusion != 0 }} + run: | + docker pull ghcr.io/nwchemex-project/release_pluginplay:gcc-latest + docker tag ghcr.io/nwchemex-project/release_pluginplay:gcc-latest ghcr.io/nwchemex-project/release_pluginplay:gcc-stable + docker push ghcr.io/nwchemex-project/release_pluginplay:gcc-stable + + build_test_release-clang: + runs-on: ubuntu-latest + needs: [update-base-image, build_update_check] + if: always() && (needs.update-base-image.result == 'success' || needs.update-base-image.result == 'skipped') + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_REPO_TOKEN }} + - uses: actions/checkout@v3 + - name: Get current branch name + id: branch-name + uses: tj-actions/branch-names@v7 + - name: build test release in a container + uses: ./.github/actions/container-build_test_release + with: + ninja_build: true + test: true + integration_test: false + INSTALL: true + base_tag: ${{needs.build_update_check.outputs.bi_check}} + dep_repo_tag: clang-stable + token: ${{ secrets.CONTAINER_REPO_TOKEN }} + user: ${{ github.actor }} + cmake_version: 3.17.0 + clang_version: 11 + use_clang: true + CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} + branch_name: ${{ steps.branch-name.outputs.current_branch }} + - name: Check stable release image + id: image_exists + shell: /usr/bin/bash {0} + run: | + docker manifest inspect ghcr.io/nwchemex-project/release_pluginplay:clang-stable > /dev/null + echo "conclusion=$?" >> "$GITHUB_OUTPUT" + - name: Push stable release image if not exist + if: ${{ steps.image_exists.outputs.conclusion != 0 }} + run: | + docker pull ghcr.io/nwchemex-project/release_pluginplay:clang-latest + docker tag ghcr.io/nwchemex-project/release_pluginplay:clang-latest ghcr.io/nwchemex-project/release_pluginplay:clang-stable + docker push ghcr.io/nwchemex-project/release_pluginplay:clang-stable diff --git a/.github/workflows/c-cpp.yaml b/.github/workflows/c-cpp.yaml deleted file mode 100644 index 0834d3143..000000000 --- a/.github/workflows/c-cpp.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: C_C++_CI - -on: - pull_request: - branches: - - master - -jobs: - build-with-gcc: - uses: NWChemEx-Project/.github/.github/workflows/c-cpp_tmpl.yaml@master - with: - dependencies: 'ninja gcc gcovr cmake openmpi boost libfort' - clang-build: false - gcc-build: true - ninja_build: true - secrets: - CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} - # build-with-clang: - # uses: NWChemEx-Project/.github/.github/workflows/c-cpp_tmpl.yaml@master - # with: - # dependencies: 'clang gcovr cmake openmpi boost' - # clang-build: true - # gcc-build: false - # secrets: - # CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index d136cb170..9c75994e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,12 +161,17 @@ if("${BUILD_TESTING}") DEPPACKAGES pluginplay ) cmaize_add_tests( - test_${PROJECT_NAME} + test_unit_${PROJECT_NAME} SOURCE_DIR ${tests_src_dir} INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/src/${PROJECT_NAME}" DEPENDS Catch2::Catch2 ${PROJECT_NAME} ${PROJECT_NAME}_examples ) - + cmaize_add_tests( + test_integration_${PROJECT_NAME} + SOURCE_DIR "${cxx_test_dir}/integration_tests" + INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/src/${PROJECT_NAME}" + DEPENDS Catch2::Catch2 ${PROJECT_NAME} ${PROJECT_NAME}_examples + ) cmaize_add_tests( test_${PROJECT_NAME}_docs SOURCE_DIR "${cxx_test_dir}/doc_snippets" diff --git a/tests/cxx/integration_tests/blank_test.cpp b/tests/cxx/integration_tests/blank_test.cpp new file mode 100644 index 000000000..6bca1d828 --- /dev/null +++ b/tests/cxx/integration_tests/blank_test.cpp @@ -0,0 +1,13 @@ +#define CATCH_CONFIG_MAIN +#include +#include + +int print_and_return(int ii) { + std::cout<<"This is only a blank model for an integration test."< Date: Mon, 28 Aug 2023 20:42:38 +0000 Subject: [PATCH 02/17] Committing clang-format changes --- tests/cxx/integration_tests/blank_test.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/cxx/integration_tests/blank_test.cpp b/tests/cxx/integration_tests/blank_test.cpp index 6bca1d828..2dd179aa4 100644 --- a/tests/cxx/integration_tests/blank_test.cpp +++ b/tests/cxx/integration_tests/blank_test.cpp @@ -1,13 +1,11 @@ #define CATCH_CONFIG_MAIN -#include #include +#include int print_and_return(int ii) { - std::cout<<"This is only a blank model for an integration test."< Date: Mon, 28 Aug 2023 20:45:01 +0000 Subject: [PATCH 03/17] Committing license headers --- tests/cxx/integration_tests/blank_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/cxx/integration_tests/blank_test.cpp b/tests/cxx/integration_tests/blank_test.cpp index 2dd179aa4..f0e48aacb 100644 --- a/tests/cxx/integration_tests/blank_test.cpp +++ b/tests/cxx/integration_tests/blank_test.cpp @@ -1,3 +1,19 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #define CATCH_CONFIG_MAIN #include #include From 249081e1134d2c5924a892afaae2b0aac7fc2b4e Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 16:12:55 -0500 Subject: [PATCH 04/17] New docker-image-based CI --- .github/Dockerfile/base-libfort.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/Dockerfile/base-libfort.Dockerfile b/.github/Dockerfile/base-libfort.Dockerfile index 0e2a632fe..da01d09a9 100644 --- a/.github/Dockerfile/base-libfort.Dockerfile +++ b/.github/Dockerfile/base-libfort.Dockerfile @@ -7,7 +7,7 @@ ARG LIBFORT_VERSION # Install libfort# ENV INSTALL_PATH=../install -RUN wget --no-check-certificate --content-disposition https://codeload.github.com/seleznevae/libfort/tar.gz/refs/tags/v${LIBFORT_VERSION} \ +RUN curl -L -o libfort-${LIBFORT_VERSION}.tar.gz https://codeload.github.com/seleznevae/libfort/tar.gz/refs/tags/v${LIBFORT_VERSION} \ && tar -zxf libfort-${LIBFORT_VERSION}.tar.gz \ && cd libfort-${LIBFORT_VERSION} \ && cmake -GNinja -H. -Bbuild -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \ From e052e5d17f6cd1697414b5f485cd9ab264dc5b12 Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 16:25:25 -0500 Subject: [PATCH 05/17] New docker-image-based CI --- .github/Dockerfile/base-libfort.Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/Dockerfile/base-libfort.Dockerfile b/.github/Dockerfile/base-libfort.Dockerfile index da01d09a9..af93edb7c 100644 --- a/.github/Dockerfile/base-libfort.Dockerfile +++ b/.github/Dockerfile/base-libfort.Dockerfile @@ -4,6 +4,12 @@ FROM ${PARENT_IMAGE_NAME}:latest ARG LIBFORT_VERSION +# Install curl to download libfort +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + # Install libfort# ENV INSTALL_PATH=../install From 3ea6d261e36271cfd22f37544c7f5aeb6ed6d91c Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 16:34:00 -0500 Subject: [PATCH 06/17] New docker-image-based CI --- .github/workflows/build_base.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml index af205f71a..376e95c3d 100644 --- a/.github/workflows/build_base.yaml +++ b/.github/workflows/build_base.yaml @@ -24,6 +24,10 @@ on: type: string required: false default: 20.04 + catch2_version: + type: string + required: false + default: 2.13.8 libfort_version: type: string required: false From c0cee1588ba5037bde10fdd458cf4268312df440 Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 16:48:35 -0500 Subject: [PATCH 07/17] New docker-image-based CI --- .../docker-action/Dockerfile | 2 +- .github/workflows/build_base.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/container-build_test_release/docker-action/Dockerfile b/.github/actions/container-build_test_release/docker-action/Dockerfile index dad04304c..5bd474a66 100644 --- a/.github/actions/container-build_test_release/docker-action/Dockerfile +++ b/.github/actions/container-build_test_release/docker-action/Dockerfile @@ -18,7 +18,7 @@ FROM ghcr.io/nwchemex-project/release_utilities:$dep_repo_tag ARG base_tag -FROM ghcr.io/nwchemex-project/base_parallelzone:$base_tag +FROM ghcr.io/nwchemex-project/base_pluginplay:$base_tag COPY --from=0 /install /install diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml index 376e95c3d..a63f42deb 100644 --- a/.github/workflows/build_base.yaml +++ b/.github/workflows/build_base.yaml @@ -84,17 +84,17 @@ jobs: with: tmp_image_name: base-catch2 tmp_image_tag: latest - image_name: ghcr.io/nwchemex-project/base_parallelzone + image_name: ghcr.io/nwchemex-project/base_pluginplay image_tag: latest - name: Check stable base image id: image_exists shell: /usr/bin/bash {0} run: | - docker manifest inspect ghcr.io/nwchemex-project/base_parallelzone:stable > /dev/null + docker manifest inspect ghcr.io/nwchemex-project/base_pluginplay:stable > /dev/null echo "conclusion=$?" >> "$GITHUB_OUTPUT" - name: Push stable base image if not exist if: ${{ steps.image_exists.outputs.conclusion != 0 }} run: | - docker pull ghcr.io/nwchemex-project/base_parallelzone:latest - docker tag ghcr.io/nwchemex-project/base_parallelzone:latest ghcr.io/nwchemex-project/base_parallelzone:stable - docker push ghcr.io/nwchemex-project/base_parallelzone:stable + docker pull ghcr.io/nwchemex-project/base_pluginplay:latest + docker tag ghcr.io/nwchemex-project/base_pluginplay:latest ghcr.io/nwchemex-project/base_pluginplay:stable + docker push ghcr.io/nwchemex-project/base_pluginplay:stable From 6895db955ffe0f39ecdf79cfaade0b65a9d85826 Mon Sep 17 00:00:00 2001 From: yzhang Date: Mon, 28 Aug 2023 17:00:12 -0500 Subject: [PATCH 08/17] New docker-image-based CI --- .../container-build_test_release/docker-action/Dockerfile | 3 +-- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/container-build_test_release/docker-action/Dockerfile b/.github/actions/container-build_test_release/docker-action/Dockerfile index 5bd474a66..1dc1cd096 100644 --- a/.github/actions/container-build_test_release/docker-action/Dockerfile +++ b/.github/actions/container-build_test_release/docker-action/Dockerfile @@ -12,12 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. ARG dep_repo_tag +ARG base_tag FROM ghcr.io/nwchemex-project/release_parallelzone:$dep_repo_tag FROM ghcr.io/nwchemex-project/release_utilities:$dep_repo_tag -ARG base_tag - FROM ghcr.io/nwchemex-project/base_pluginplay:$base_tag COPY --from=0 /install /install diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c75994e7..fa82a962d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ include(nwx_versions) ### Options ### option(BUILD_TESTING "Should we build the tests?" OFF) -option(BUILD_PYBIND11_PYBINDINGS "Use pybind11 to build Python3 bindings?" OFF) +option(BUILD_PYBIND11_PYBINDINGS "Use pybind11 to build Python3 bindings?" ON) option(BUILD_CPPYY_PYBINDINGS "Use Cppyy to build Python3 bindings?" OFF) option(BUILD_ROCKSDB "Should we build the RocksDB backend?" OFF) From a06edf3a44ae474456db45cfe97d9abceb6f9af9 Mon Sep 17 00:00:00 2001 From: yzhang Date: Tue, 29 Aug 2023 10:02:07 -0500 Subject: [PATCH 09/17] New docker-image-based CI --- .github/Dockerfile/base-pybind11.Dockerfile | 9 +++++++++ .github/workflows/build_base.yaml | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .github/Dockerfile/base-pybind11.Dockerfile diff --git a/.github/Dockerfile/base-pybind11.Dockerfile b/.github/Dockerfile/base-pybind11.Dockerfile new file mode 100644 index 000000000..e3b8ee1bd --- /dev/null +++ b/.github/Dockerfile/base-pybind11.Dockerfile @@ -0,0 +1,9 @@ +ARG PARENT_IMAGE_NAME + +FROM ${PARENT_IMAGE_NAME}:latest + +# Install pybind11 ## +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y python-pybind11 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml index a63f42deb..6825b2d6c 100644 --- a/.github/workflows/build_base.yaml +++ b/.github/workflows/build_base.yaml @@ -65,12 +65,18 @@ jobs: package_name: libboost parent_image_name: ghcr.io/nwchemex-project/base-cmake path_to_dockerfile: .github/Dockerfile/base-libboost.Dockerfile + - name: Install pybind11 + uses: NWChemEx-Project/.github/actions/install_package@master + with: + package_name: pybind11 + parent_image_name: base-libboost + path_to_dockerfile: .github/Dockerfile/base-pybind11.Dockerfile - name: Install libfort uses: NWChemEx-Project/.github/actions/install_package@master with: libfort_version: ${{ inputs.libfort_version }} package_name: libfort - parent_image_name: base-libboost + parent_image_name: base-pybind11 path_to_dockerfile: .github/Dockerfile/base-libfort.Dockerfile - name: Install catch2 uses: NWChemEx-Project/.github/actions/install_package@master From dd1a21fadf75478b66d8b4f3d233603521837c0b Mon Sep 17 00:00:00 2001 From: yzhang Date: Tue, 29 Aug 2023 10:11:16 -0500 Subject: [PATCH 10/17] New docker-image-based CI --- .github/Dockerfile/base-pybind11.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/Dockerfile/base-pybind11.Dockerfile b/.github/Dockerfile/base-pybind11.Dockerfile index e3b8ee1bd..dfe20d516 100644 --- a/.github/Dockerfile/base-pybind11.Dockerfile +++ b/.github/Dockerfile/base-pybind11.Dockerfile @@ -4,6 +4,6 @@ FROM ${PARENT_IMAGE_NAME}:latest # Install pybind11 ## RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y python-pybind11 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y pybind11-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* From e6960a809f1ca9bc6501cbde7e392d76599e160f Mon Sep 17 00:00:00 2001 From: yzhang Date: Tue, 29 Aug 2023 10:48:51 -0500 Subject: [PATCH 11/17] New docker-image-based CI --- .github/Dockerfile/base-pybind11.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/Dockerfile/base-pybind11.Dockerfile b/.github/Dockerfile/base-pybind11.Dockerfile index dfe20d516..37ddda2da 100644 --- a/.github/Dockerfile/base-pybind11.Dockerfile +++ b/.github/Dockerfile/base-pybind11.Dockerfile @@ -5,5 +5,6 @@ FROM ${PARENT_IMAGE_NAME}:latest # Install pybind11 ## RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y pybind11-dev \ + python3-pybind11 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* From 80e2c4c13fc69e2263f27fe6cbd84d59e13df87e Mon Sep 17 00:00:00 2001 From: yzhang Date: Tue, 29 Aug 2023 16:42:27 -0500 Subject: [PATCH 12/17] New docker-image-based CI --- .github/Dockerfile/base-pybind11.Dockerfile | 10 ---------- .../docker-action/build_test.sh | 3 +++ .github/workflows/build_base.yaml | 10 ++-------- 3 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 .github/Dockerfile/base-pybind11.Dockerfile diff --git a/.github/Dockerfile/base-pybind11.Dockerfile b/.github/Dockerfile/base-pybind11.Dockerfile deleted file mode 100644 index 37ddda2da..000000000 --- a/.github/Dockerfile/base-pybind11.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -ARG PARENT_IMAGE_NAME - -FROM ${PARENT_IMAGE_NAME}:latest - -# Install pybind11 ## -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y pybind11-dev \ - python3-pybind11 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* diff --git a/.github/actions/container-build_test_release/docker-action/build_test.sh b/.github/actions/container-build_test_release/docker-action/build_test.sh index 91e4b5d69..2827824a4 100644 --- a/.github/actions/container-build_test_release/docker-action/build_test.sh +++ b/.github/actions/container-build_test_release/docker-action/build_test.sh @@ -34,6 +34,7 @@ cmake_command=cmake ctest_command=ctest toolchain_file=$(pwd)/toolchain.cmake +pybind11_path=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') echo "set(BUILD_TESTING ON)" > "${toolchain_file}" { @@ -42,6 +43,7 @@ echo "set(BUILD_TESTING ON)" > "${toolchain_file}" echo "set(BUILD_SHARED_LIBS ON)" echo "set(CATCH_ENABLE_COVERAGE ON)" echo "set(CMAKE_PREFIX_PATH /install)" + echo "set(CMAKE_PREFIX_PATH ${pybind11_path})" echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -std=c++17")' echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMPI_SKIP_MPICXX")' echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")' @@ -118,6 +120,7 @@ echo "Running doc tests..." ${ctest_command} -VV -R *docs # python testing +export PYTHONPATH="$PYTHONPATH:/install" echo "Running python tests..." ${ctest_command} -VV -R py cd .. diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml index 6825b2d6c..a658f10a7 100644 --- a/.github/workflows/build_base.yaml +++ b/.github/workflows/build_base.yaml @@ -61,22 +61,16 @@ jobs: - name: Install libboost uses: NWChemEx-Project/.github/actions/install_package@master with: - madness_version: ${{ inputs.libboost_version }} + libboost_version: ${{ inputs.libboost_version }} package_name: libboost parent_image_name: ghcr.io/nwchemex-project/base-cmake path_to_dockerfile: .github/Dockerfile/base-libboost.Dockerfile - - name: Install pybind11 - uses: NWChemEx-Project/.github/actions/install_package@master - with: - package_name: pybind11 - parent_image_name: base-libboost - path_to_dockerfile: .github/Dockerfile/base-pybind11.Dockerfile - name: Install libfort uses: NWChemEx-Project/.github/actions/install_package@master with: libfort_version: ${{ inputs.libfort_version }} package_name: libfort - parent_image_name: base-pybind11 + parent_image_name: base-libboost path_to_dockerfile: .github/Dockerfile/base-libfort.Dockerfile - name: Install catch2 uses: NWChemEx-Project/.github/actions/install_package@master From e0df6e61a01bf2b86d89c55383dcbece16f5f8dc Mon Sep 17 00:00:00 2001 From: yzhang Date: Tue, 29 Aug 2023 17:15:38 -0500 Subject: [PATCH 13/17] New docker-image-based CI --- .../docker-action/build_test.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/container-build_test_release/docker-action/build_test.sh b/.github/actions/container-build_test_release/docker-action/build_test.sh index 2827824a4..47f4e9e7b 100644 --- a/.github/actions/container-build_test_release/docker-action/build_test.sh +++ b/.github/actions/container-build_test_release/docker-action/build_test.sh @@ -36,14 +36,16 @@ toolchain_file=$(pwd)/toolchain.cmake pybind11_path=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') +echo "pybind11_path = " ${pybind11_path} + echo "set(BUILD_TESTING ON)" > "${toolchain_file}" { echo "set(CMAKE_CXX_STANDARD 17)" echo 'set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)' echo "set(BUILD_SHARED_LIBS ON)" echo "set(CATCH_ENABLE_COVERAGE ON)" - echo "set(CMAKE_PREFIX_PATH /install)" - echo "set(CMAKE_PREFIX_PATH ${pybind11_path})" + #echo "set(CMAKE_PREFIX_PATH /install)" + echo 'set(CMAKE_PREFIX_PATH "${pybind11_path};/install")' echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -std=c++17")' echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMPI_SKIP_MPICXX")' echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")' @@ -120,7 +122,7 @@ echo "Running doc tests..." ${ctest_command} -VV -R *docs # python testing -export PYTHONPATH="$PYTHONPATH:/install" +export PYTHONPATH=$PYTHONPATH:/install echo "Running python tests..." ${ctest_command} -VV -R py cd .. From 5012ed3d49db50ba324d793592e9d18d5c30f02d Mon Sep 17 00:00:00 2001 From: yzhang Date: Wed, 30 Aug 2023 08:35:20 -0500 Subject: [PATCH 14/17] New docker-image-based CI --- .../container-build_test_release/docker-action/build_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/container-build_test_release/docker-action/build_test.sh b/.github/actions/container-build_test_release/docker-action/build_test.sh index 47f4e9e7b..f4088fb6e 100644 --- a/.github/actions/container-build_test_release/docker-action/build_test.sh +++ b/.github/actions/container-build_test_release/docker-action/build_test.sh @@ -36,8 +36,6 @@ toolchain_file=$(pwd)/toolchain.cmake pybind11_path=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') -echo "pybind11_path = " ${pybind11_path} - echo "set(BUILD_TESTING ON)" > "${toolchain_file}" { echo "set(CMAKE_CXX_STANDARD 17)" @@ -60,6 +58,7 @@ echo "set(BUILD_TESTING ON)" > "${toolchain_file}" echo 'set(NWX_MODULE_DIRECTORY "./NWX_PyModules")' } >> "${toolchain_file}" +cat ${toolchain_file} # if clang_build is true set clang and # clang++ as default c and cxx compiler @@ -123,6 +122,7 @@ ${ctest_command} -VV -R *docs # python testing export PYTHONPATH=$PYTHONPATH:/install +echo "PYTHONPATH = " $PYTHONPATH echo "Running python tests..." ${ctest_command} -VV -R py cd .. From 00c68d1b5ec815cffa5ded9dfee88da349dc4d02 Mon Sep 17 00:00:00 2001 From: yzhang Date: Wed, 30 Aug 2023 15:35:13 -0500 Subject: [PATCH 15/17] New docker-image-based CI --- .../docker-action/build_test.sh | 16 +++++++--------- CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/actions/container-build_test_release/docker-action/build_test.sh b/.github/actions/container-build_test_release/docker-action/build_test.sh index f4088fb6e..d2f429ae2 100644 --- a/.github/actions/container-build_test_release/docker-action/build_test.sh +++ b/.github/actions/container-build_test_release/docker-action/build_test.sh @@ -34,7 +34,7 @@ cmake_command=cmake ctest_command=ctest toolchain_file=$(pwd)/toolchain.cmake -pybind11_path=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') +#pybind11_path=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') echo "set(BUILD_TESTING ON)" > "${toolchain_file}" { @@ -42,8 +42,8 @@ echo "set(BUILD_TESTING ON)" > "${toolchain_file}" echo 'set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)' echo "set(BUILD_SHARED_LIBS ON)" echo "set(CATCH_ENABLE_COVERAGE ON)" - #echo "set(CMAKE_PREFIX_PATH /install)" - echo 'set(CMAKE_PREFIX_PATH "${pybind11_path};/install")' + echo "set(CMAKE_PREFIX_PATH /install)" + #echo 'set(CMAKE_PREFIX_PATH "${pybind11_path};/install")' echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -std=c++17")' echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMPI_SKIP_MPICXX")' echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")' @@ -58,8 +58,6 @@ echo "set(BUILD_TESTING ON)" > "${toolchain_file}" echo 'set(NWX_MODULE_DIRECTORY "./NWX_PyModules")' } >> "${toolchain_file}" -cat ${toolchain_file} - # if clang_build is true set clang and # clang++ as default c and cxx compiler # otherwise set gcc as default @@ -121,10 +119,10 @@ echo "Running doc tests..." ${ctest_command} -VV -R *docs # python testing -export PYTHONPATH=$PYTHONPATH:/install -echo "PYTHONPATH = " $PYTHONPATH -echo "Running python tests..." -${ctest_command} -VV -R py +#export PYTHONPATH=$PYTHONPATH:/install +#echo "PYTHONPATH = " $PYTHONPATH +#echo "Running python tests..." +#${ctest_command} -VV -R py cd .. #Step 5: Install diff --git a/CMakeLists.txt b/CMakeLists.txt index fa82a962d..9c75994e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ include(nwx_versions) ### Options ### option(BUILD_TESTING "Should we build the tests?" OFF) -option(BUILD_PYBIND11_PYBINDINGS "Use pybind11 to build Python3 bindings?" ON) +option(BUILD_PYBIND11_PYBINDINGS "Use pybind11 to build Python3 bindings?" OFF) option(BUILD_CPPYY_PYBINDINGS "Use Cppyy to build Python3 bindings?" OFF) option(BUILD_ROCKSDB "Should we build the RocksDB backend?" OFF) From 4b8dfe7071220ffec0a82ca7ec57e681bc519ef4 Mon Sep 17 00:00:00 2001 From: yzhang Date: Thu, 31 Aug 2023 10:23:16 -0500 Subject: [PATCH 16/17] New docker-image-based CI --- .github/workflows/build_base.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_base.yaml b/.github/workflows/build_base.yaml index a658f10a7..1b6c86829 100644 --- a/.github/workflows/build_base.yaml +++ b/.github/workflows/build_base.yaml @@ -59,21 +59,21 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.CONTAINER_REPO_TOKEN }} - name: Install libboost - uses: NWChemEx-Project/.github/actions/install_package@master + uses: NWChemEx-Project/.github/actions/image-install_package@master with: libboost_version: ${{ inputs.libboost_version }} package_name: libboost parent_image_name: ghcr.io/nwchemex-project/base-cmake path_to_dockerfile: .github/Dockerfile/base-libboost.Dockerfile - name: Install libfort - uses: NWChemEx-Project/.github/actions/install_package@master + uses: NWChemEx-Project/.github/actions/image-install_package@master with: libfort_version: ${{ inputs.libfort_version }} package_name: libfort parent_image_name: base-libboost path_to_dockerfile: .github/Dockerfile/base-libfort.Dockerfile - name: Install catch2 - uses: NWChemEx-Project/.github/actions/install_package@master + uses: NWChemEx-Project/.github/actions/image-install_package@master with: catch2_version: ${{ inputs.catch2_version }} package_name: catch2 From d5c3198720bd3ae08becfca11748bc7540ce92b8 Mon Sep 17 00:00:00 2001 From: yzhang Date: Fri, 1 Sep 2023 11:57:38 -0500 Subject: [PATCH 17/17] Add manual workflow to build/test/release --- .../workflows/build_test_release-manual.yaml | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/build_test_release-manual.yaml diff --git a/.github/workflows/build_test_release-manual.yaml b/.github/workflows/build_test_release-manual.yaml new file mode 100644 index 000000000..6decaa9f1 --- /dev/null +++ b/.github/workflows/build_test_release-manual.yaml @@ -0,0 +1,112 @@ +# The building/testing/releasing process happens +# in a container created from the base image (container action). +# In the end two new release images +# ghcr.io/nwchemex-project/release_pluginplay:gcc(clang)-latest +# are generated. Whether these images are stable +# (do not break any downstream repos) or not is still +# to be tested. +# This workflow should run in the branch which opens a +# PR to dev (dev/master model to be developed). + +name: Build test release + +on: + workflow_dispatch: + +jobs: + # TODO: obtain package version info + # general packages for all repos: from NWXCmake + # specific packages for a repo: from dependency_versions.txt in + # the repo + # + # A job to retrieve all package versions and output + ### + update-base-image: + uses: NWChemEx-Project/PluginPlay/.github/workflows/build_base.yaml@master + secrets: inherit + + build_test_release-gcc: + runs-on: ubuntu-latest + needs: update-base-image + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_REPO_TOKEN }} + - uses: actions/checkout@v3 + - name: Get current branch name + id: branch-name + uses: tj-actions/branch-names@v7 + - name: build test release in a container + uses: ./.github/actions/container-build_test_release + with: + ninja_build: true + test: true + integration_test: false + INSTALL: true + base_tag: latest + dep_repo_tag: gcc-stable + token: ${{ secrets.CONTAINER_REPO_TOKEN }} + user: ${{ github.actor }} + cmake_version: 3.17.0 + gcc_version: 9 + use_clang: false + CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} + branch_name: ${{ steps.branch-name.outputs.current_branch }} + - name: Check stable release image + id: image_exists + shell: /usr/bin/bash {0} + run: | + docker manifest inspect ghcr.io/nwchemex-project/release_pluginplay:gcc-stable > /dev/null + echo "conclusion=$?" >> "$GITHUB_OUTPUT" + - name: Push stable release image if not exist + if: ${{ steps.image_exists.outputs.conclusion != 0 }} + run: | + docker pull ghcr.io/nwchemex-project/release_pluginplay:gcc-latest + docker tag ghcr.io/nwchemex-project/release_pluginplay:gcc-latest ghcr.io/nwchemex-project/release_pluginplay:gcc-stable + docker push ghcr.io/nwchemex-project/release_pluginplay:gcc-stable + + build_test_release-clang: + runs-on: ubuntu-latest + needs: update-base-image + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.CONTAINER_REPO_TOKEN }} + - uses: actions/checkout@v3 + - name: Get current branch name + id: branch-name + uses: tj-actions/branch-names@v7 + - name: build test release in a container + uses: ./.github/actions/container-build_test_release + with: + ninja_build: true + test: true + integration_test: false + INSTALL: true + base_tag: latest + dep_repo_tag: clang-stable + token: ${{ secrets.CONTAINER_REPO_TOKEN }} + user: ${{ github.actor }} + cmake_version: 3.17.0 + clang_version: 11 + use_clang: true + CMAIZE_GITHUB_TOKEN: ${{ secrets.CMAIZE_GITHUB_TOKEN }} + branch_name: ${{ steps.branch-name.outputs.current_branch }} + - name: Check stable release image + id: image_exists + shell: /usr/bin/bash {0} + run: | + docker manifest inspect ghcr.io/nwchemex-project/release_pluginplay:clang-stable > /dev/null + echo "conclusion=$?" >> "$GITHUB_OUTPUT" + - name: Push stable release image if not exist + if: ${{ steps.image_exists.outputs.conclusion != 0 }} + run: | + docker pull ghcr.io/nwchemex-project/release_pluginplay:clang-latest + docker tag ghcr.io/nwchemex-project/release_pluginplay:clang-latest ghcr.io/nwchemex-project/release_pluginplay:clang-stable + docker push ghcr.io/nwchemex-project/release_pluginplay:clang-stable