diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 000000000..a89dd356a --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,106 @@ +name: CI Tests + +on: + pull_request: + push: + branches: + - develop + +# Cancel previous jobs if an update has been made to the pull request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }} + +env: + CLANG_DOCKER_IMAGE: seracllnl/tpls:clang-14_08-15-24_21h-49m + CUDA_DOCKER_IMAGE: seracllnl/tpls:cuda-12_08-15-24_21h-49m + GCC_DOCKER_IMAGE: seracllnl/tpls:gcc-13_08-15-24_21h-49m + +jobs: + # Hacky solution to reference env variables outside of `run` steps https://stackoverflow.com/a/74217028 + set_image_vars: + runs-on: ubuntu-latest + steps: + - name: Do Nothing + run: echo + outputs: + clang_docker_image: ${{ env.CLANG_DOCKER_IMAGE }} + cuda_docker_image: ${{ env.CUDA_DOCKER_IMAGE }} + gcc_docker_image: ${{ env.GCC_DOCKER_IMAGE }} + build_and_test: + runs-on: ubuntu-22.04 + needs: + - set_image_vars + strategy: + matrix: + build_type: [ Debug, Release ] + config: + - host_config: clang@14.0.0.cmake + compiler_image: ${{ needs.set_image_vars.outputs.clang_docker_image }} + cmake_opts: "-DBUILD_SHARED_LIBS=ON" + - host_config: gcc@12.3.0_cuda.cmake + compiler_image: ${{ needs.set_image_vars.outputs.cuda_docker_image }} + cmake_opts: "-DBUILD_SHARED_LIBS=ON -DENABLE_WARNINGS_AS_ERRORS=OFF" + build_src_opts: "--skip-install --skip-tests" + - host_config: gcc@13.1.0.cmake + compiler_image: ${{ needs.set_image_vars.outputs.gcc_docker_image }} + cmake_opts: "-DBUILD_SHARED_LIBS=ON" + include: + - build_type: Debug + config: + host_config: clang@14.0.0.cmake + compiler_image: ${{ needs.set_image_vars.outputs.clang_docker_image }} + cmake_opts: "-DSERAC_ENABLE_CODEVELOP=ON" + build_src_opts: "--skip-install" + container: + image: ${{ matrix.config.compiler_image }} + volumes: + - /home/serac/serac + steps: + - name: Checkout Serac + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Print Matrix Variables + run: | + echo "build_src_opts ${{ matrix.config.build_src_opts }}" + echo "build_type ${{ matrix.build_type }}" + echo "cmake_opts ${{ matrix.config.cmake_opts }}" + echo "compiler_image ${{ matrix.config.compiler_image }}" + echo "host_config ${{ matrix.config.host_config }}" + - name: Build and Test ${{ matrix.config.host_config }} ${{ matrix.build_type }} + timeout-minutes: 30 + run: | + ./scripts/llnl/build_src.py ${{ matrix.config.build_src_opts }} \ + --verbose \ + --host-config ${{ matrix.config.host_config }} \ + --extra-cmake-options "${{ matrix.config.cmake_opts }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}" \ + --jobs 4 + - name: Upload Test Results + # CUDA containers do not run tests, because runners don't have GPUs, so skip upload in that case + if: ${{ matrix.config.compiler_image != needs.set_image_vars.outputs.cuda_docker_image }} + uses: actions/upload-artifact@v4 + with: + name: Test Results ${{ matrix.config.host_config }} ${{ matrix.build_type }} ${{ matrix.config.cmake_opts }} + path: "**/Test.xml" + check_code: + runs-on: ubuntu-22.04 + needs: + - set_image_vars + strategy: + matrix: + check_type: [coverage, docs, style, header] + container: + image: ${{ needs.set_image_vars.outputs.clang_docker_image }} + volumes: + - /home/serac/serac + env: + CHECK_TYPE: ${{ matrix.check_type }} + HOST_CONFIG: clang@14.0.0.cmake + steps: + - name: Checkout Serac + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Check ${{ matrix.check_type }} + run: ./scripts/github-actions/linux-check.sh diff --git a/README.md b/README.md index dbef0f11e..be027f6dd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Serac -[![Build -Status](https://dev.azure.com/llnl-serac/serac/_apis/build/status/LLNL.serac?branchName=develop)](https://dev.azure.com/llnl-serac/serac/_build/latest?definitionId=1&branchName=develop) +[![Build Status](https://github.com/LLNL/serac/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/LLNL/serac/actions/workflows/unit-tests.yml) [![Documentation Status](https://readthedocs.org/projects/serac/badge/?version=latest)](https://serac.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/LLNL/serac/branch/develop/graph/badge.svg?token=DO4KFMPNM0)](https://codecov.io/gh/LLNL/serac) [![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](./LICENSE) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 252e69776..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,133 +0,0 @@ -# -# Copyright (c) 2019-2024, Lawrence Livermore National Security, LLC and -# other Serac Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -# - -variables: - Clang_14_ImageName: 'seracllnl/tpls:clang-14_08-15-24_21h-49m' - GCC_13_ImageName: 'seracllnl/tpls:gcc-13_08-15-24_21h-49m' - CUDA_12_ImageName: 'seracllnl/tpls:cuda-12_08-15-24_21h-49m' - -jobs: -- job: Build_and_Test - strategy: - matrix: - # Skipping running unit tests on CUDA, since the Azure VMs we use do not contain GPUs - linux_cuda12_debug: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(CUDA_12_ImageName) - TEST_TARGET: 'linux_cuda12' - HOST_CONFIG: 'gcc@12.3.0_cuda.cmake' - BUILD_TYPE: 'Debug' - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON -DENABLE_WARNINGS_AS_ERRORS=OFF' - BUILD_SRC_OPTS: '--skip-install --skip-tests' - linux_cuda12_release: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(CUDA_12_ImageName) - TEST_TARGET: 'linux_cuda12' - HOST_CONFIG: 'gcc@12.3.0_cuda.cmake' - BUILD_TYPE: 'Release' - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON -DENABLE_WARNINGS_AS_ERRORS=OFF' - BUILD_SRC_OPTS: '--skip-install --skip-tests' - linux_gcc13_debug: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(GCC_13_ImageName) - TEST_TARGET: 'linux_gcc13' - HOST_CONFIG: 'gcc@13.1.0.cmake' - BUILD_TYPE: 'Debug' - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON' - linux_gcc13_release: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(GCC_13_ImageName) - TEST_TARGET: 'linux_gcc13' - HOST_CONFIG: 'gcc@13.1.0.cmake' - BUILD_TYPE: 'Release' - # gcc@13 + Release hangs in solid_mechanics when > -O2 - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS_RELEASE=-O2' - linux_clang14_debug: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(Clang_14_ImageName) - TEST_TARGET: 'linux_clang14' - HOST_CONFIG: 'clang@14.0.0.cmake' - BUILD_TYPE: 'Debug' - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON' - linux_clang14_release: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(Clang_14_ImageName) - TEST_TARGET: 'linux_clang14' - HOST_CONFIG: 'clang@14.0.0.cmake' - BUILD_TYPE: 'Release' - CMAKE_OPTS: '-DBUILD_SHARED_LIBS=ON' - linux_clang14_codevelop: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(Clang_14_ImageName) - TEST_TARGET: 'linux_clang14' - HOST_CONFIG: 'clang@14.0.0.cmake' - BUILD_TYPE: 'Debug' - CMAKE_OPTS: '-DSERAC_ENABLE_CODEVELOP=ON' - BUILD_SRC_OPTS: '--skip-install' - - pool: - vmImage: $(VM_ImageName) - - steps: - - checkout: self - clean: true - submodules: recursive - - script: | - echo " -e $TEST_TARGET -e HOST_CONFIG $(Compiler_ImageName) ./scripts/llnl/build_src.py $BUILD_SRC_OPTS -v --host-config $HOST_CONFIG --extra-cmake-options \"${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=$BUILD_TYPE\"" - docker run --rm -v `pwd`:/home/serac/serac -e TEST_TARGET -e HOST_CONFIG $(Compiler_ImageName) ./serac/scripts/llnl/build_src.py $BUILD_SRC_OPTS -v --host-config $HOST_CONFIG --extra-cmake-options "${CMAKE_OPTS} -DCMAKE_BUILD_TYPE=$BUILD_TYPE" --jobs 4 - - displayName: '$(TEST_TARGET) Build & Test' - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'cTest' - testResultsFiles: '**/Test.xml' - testRunTitle: '$(TEST_TARGET) Tests' - failTaskOnFailedTests: true - -- job: Check_Code - variables: - VM_ImageName: 'ubuntu-22.04' - Compiler_ImageName: $(Clang_14_ImageName) - TEST_TARGET: 'linux_clang14' - HOST_CONFIG: 'clang@14.0.0.cmake' - - strategy: - matrix: - coverage: - DO_COVERAGE_CHECK: 'yes' - DO_DOCS_CHECK: 'no' - DO_STYLE_CHECK: 'no' - DO_HEADER_CHECK: 'no' - docs: - DO_COVERAGE_CHECK: 'no' - DO_DOCS_CHECK: 'yes' - DO_STYLE_CHECK: 'no' - DO_HEADER_CHECK: 'no' - style: - DO_COVERAGE_CHECK: 'no' - DO_DOCS_CHECK: 'no' - DO_STYLE_CHECK: 'yes' - DO_HEADER_CHECK: 'no' - header: - DO_COVERAGE_CHECK: 'no' - DO_DOCS_CHECK: 'no' - DO_STYLE_CHECK: 'no' - DO_HEADER_CHECK: 'yes' - - pool: - vmImage: $(VM_ImageName) - - steps: - - checkout: self - clean: true - submodules: recursive - # https://docs.codecov.io/docs/testing-with-docker - - script: | - ci_env=`bash <(curl -s https://codecov.io/env)` - echo " -e DO_COVERAGE_CHECK -e DO_DOCS_CHECK -e DO_STYLE_CHECK -e DO_HEADER_CHECK -e HOST_CONFIG ./serac/scripts/azure-pipelines/linux-check.sh" - docker run --rm -v `pwd`:/home/serac/serac $ci_env -e DO_COVERAGE_CHECK -e DO_DOCS_CHECK -e DO_STYLE_CHECK -e DO_HEADER_CHECK -e HOST_CONFIG $(Compiler_ImageName) ./serac/scripts/azure-pipelines/linux-check.sh - displayName: '$(TEST_TARGET) Check' diff --git a/scripts/azure-pipelines/DummyTest.xml b/scripts/azure-pipelines/DummyTest.xml deleted file mode 100644 index d5d956820..000000000 --- a/scripts/azure-pipelines/DummyTest.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - -2023-11-07T12:34:56 - -TestExample - - -TestExample -./tests -./tests/TestExample -./tests/TestExample - -0.001 -0 -Completed - - -2023-11-07T12:34:57 -0.01 - - diff --git a/scripts/azure-pipelines/docs_ignore_regexs.txt b/scripts/github-actions/docs_ignore_regexs.txt similarity index 100% rename from scripts/azure-pipelines/docs_ignore_regexs.txt rename to scripts/github-actions/docs_ignore_regexs.txt diff --git a/scripts/azure-pipelines/linux-check.sh b/scripts/github-actions/linux-check.sh similarity index 85% rename from scripts/azure-pipelines/linux-check.sh rename to scripts/github-actions/linux-check.sh index 2f24c3f75..9c12e21f0 100755 --- a/scripts/azure-pipelines/linux-check.sh +++ b/scripts/github-actions/linux-check.sh @@ -17,23 +17,19 @@ function or_die () { fi } -or_die cd serac -git submodule init -git submodule update - echo HOST_CONFIG echo $HOST_CONFIG echo "~~~~~~ RUNNING CMAKE ~~~~~~~~" cmake_args="-DENABLE_CLANGTIDY=OFF -DSERAC_ENABLE_CODE_CHECKS=ON" -if [[ "$DO_COVERAGE_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "coverage" ]] ; then # Alias llvm-cov to gcov so it acts like gcov ln -s `which llvm-cov` /home/serac/gcov cmake_args="$cmake_args -DENABLE_COVERAGE=ON -DGCOV_EXECUTABLE=/home/serac/gcov" fi -if [[ "$DO_DOCS_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "docs" ]] ; then SPHINX_EXECUTABLE=/usr/bin/sphinx-build if [[ ! -f "$SPHINX_EXECUTABLE" ]]; then echo "sphinx not found: $SPHINX_EXECUTABLE" @@ -47,7 +43,7 @@ if [[ "$DO_DOCS_CHECK" == "yes" ]] ; then cmake_args="$cmake_args -DENABLE_DOCS=ON -DSPHINX_EXECUTABLE=$SPHINX_EXECUTABLE -DDOXYGEN_EXECUTABLE=$DOXYGEN_EXECUTABLE" fi -if [[ "$DO_STYLE_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "style" ]] ; then CLANGFORMAT_EXECUTABLE=/usr/bin/clang-format if [[ ! -f "$CLANGFORMAT_EXECUTABLE" ]]; then echo "clang-format not found: $CLANGFORMAT_EXECUTABLE" @@ -59,7 +55,7 @@ fi or_die ./config-build.py -hc host-configs/docker/${HOST_CONFIG} -bp build-check-debug -ip install-check-debug $cmake_args or_die cd build-check-debug -if [[ "$DO_COVERAGE_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "coverage" ]] ; then or_die make -j4 or_die make serac_coverage # Rename to file expected by codecov @@ -67,16 +63,16 @@ if [[ "$DO_COVERAGE_CHECK" == "yes" ]] ; then or_die curl -s https://codecov.io/bash | bash /dev/stdin -X gcov fi -if [[ "$DO_DOCS_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "docs" ]] ; then or_die make VERBOSE=1 docs 2>&1 | tee docs_output - or_die ../scripts/check_log.py -l docs_output -i ../scripts/azure-pipelines/docs_ignore_regexs.txt + or_die ../scripts/check_log.py -l docs_output -i ../scripts/github-actions/docs_ignore_regexs.txt fi -if [[ "$DO_STYLE_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "style" ]] ; then or_die make VERBOSE=1 clangformat_check fi -if [[ "$DO_HEADER_CHECK" == "yes" ]] ; then +if [[ "$CHECK_TYPE" == "header" ]] ; then or_die make -j4 or_die make install -j4 or_die ../scripts/check_for_missing_headers.py -i ../install-check-debug -s ../src diff --git a/scripts/llnl/build_src.py b/scripts/llnl/build_src.py index 6588cbcca..924a7bcd9 100755 --- a/scripts/llnl/build_src.py +++ b/scripts/llnl/build_src.py @@ -51,7 +51,7 @@ def parse_args(): action="store_true", dest="skip_tests", default=False, - help="Skip unit tests which will not work in some configurations (CUDA on Azure)") + help="Skip unit tests which will not work in some configurations (e.g. CUDA on GitHub Actions)") parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", diff --git a/scripts/llnl/common_build_functions.py b/scripts/llnl/common_build_functions.py index 92d840e4a..e8f283e23 100755 --- a/scripts/llnl/common_build_functions.py +++ b/scripts/llnl/common_build_functions.py @@ -327,10 +327,6 @@ def build_and_test_host_config(test_root, host_config, report_to_stdout=False, e print("[ERROR: Tests for host-config: %s failed]\n" % host_config) return res else: - # Copy dummy .xml file to avoid Azure CI warning when not running tests - dummy_ctest_src = pjoin(get_repo_dir(), "scripts/azure-pipelines/DummyTest.xml") - dummy_ctest_dst = pjoin(build_dir, "Test.xml") - shutil.copy(dummy_ctest_src, dummy_ctest_dst) print("[skipping unit tests]") # build the docs diff --git a/src/docs/sphinx/dev_guide/new_docker_image.rst b/src/docs/sphinx/dev_guide/new_docker_image.rst index e2e4ce64c..7ee88fca9 100644 --- a/src/docs/sphinx/dev_guide/new_docker_image.rst +++ b/src/docs/sphinx/dev_guide/new_docker_image.rst @@ -41,9 +41,9 @@ Update/Add Docker Image #. Once the "Docker TPL Build" action completes, it will produce artifacts for each of the generated host-configs. Download these artifacts and rename them to just the compiler spec. For example, ``buildkitsandbox-linux-clang@14.0.0.cmake`` to ``clang@14.0.0.cmake`` and commit them to your branch under ``host-configs/docker``. You will also have to update - ``azure-pipelines.yml`` if you added or change the existing compiler specs. These are all in variables called ``HOST_CONFIG``. + ``.github/workflows/build-and-test.yml`` if you added or change the existing compiler specs. These are all in variables called ``host_config``. #. Copy the new docker image names from each job under the ``Get dockerhub repo name`` step. For example, - ``seracllnl/tpls:clang-14_06-02-22_04h-11m``. This will replace the previous image name at the top of ``azure-pipelines.yml`` + ``seracllnl/tpls:clang-14_06-02-22_04h-11m``. This will replace the previous image name at the top of ``.github/workflows/build-and-test.yml`` under the ``matrix`` section or add a new entry if you are adding a new docker image. -#. To include the new image in CI jobs, add/update the ``matrix`` entry to ``azure-pipelines.yml``, modifying its +#. To include the new image in CI jobs, add/update the ``matrix`` entry to ``.github/workflows/build-and-test.yml``, modifying its attributes with the appropriate new image name (which is timestamped) and new host-config file. diff --git a/src/docs/sphinx/quickstart.rst b/src/docs/sphinx/quickstart.rst index 5cc629e2f..305fb71c3 100644 --- a/src/docs/sphinx/quickstart.rst +++ b/src/docs/sphinx/quickstart.rst @@ -131,7 +131,7 @@ can be found in the Spack compiler files in our repository: We currently regularly test the following Spack configuration files: -* Linux Ubuntu 22.04 (via Azure) +* Linux Ubuntu 22.04 (via Github Actions) * TOSS4 (On Ruby at LC) * BlueOS (On Lassen at LC)