From f9f89ea39eb1008010d7e187daa597a822df7806 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Thu, 12 Oct 2023 14:10:30 -0500 Subject: [PATCH] organizing actions --- .github/workflows/docker_and_coverage.yml | 50 +++++++ .github/workflows/mac.yml | 54 ++++++++ .github/workflows/test.yml | 154 ---------------------- .github/workflows/ubuntu.yml | 48 +++++++ .github/workflows/windows.yml | 133 +++++++++++++++++++ 5 files changed, 285 insertions(+), 154 deletions(-) create mode 100644 .github/workflows/docker_and_coverage.yml create mode 100644 .github/workflows/mac.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/ubuntu.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/docker_and_coverage.yml b/.github/workflows/docker_and_coverage.yml new file mode 100644 index 000000000..3fd2768e2 --- /dev/null +++ b/.github/workflows/docker_and_coverage.yml @@ -0,0 +1,50 @@ +name: Docker and Coverage + +on: [push, pull_request] + +jobs: + docker-build-and-test: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + name: Build and Test - ${{ matrix.dockerfile }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + dockerfile: + - Dockerfile + - Dockerfile.coverage + - Dockerfile.llvm + - Dockerfile.memcheck + - Dockerfile.no_json + - Dockerfile.nvhpc + - Dockerfile.openmp + # - Dockerfile.intel # intel image is too large for GH action + # - Dockerfile.mpi + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build Docker image + run: docker build -t micm -f docker/${{ matrix.dockerfile }} . + + - name: Run tests in container + if: matrix.dockerfile != 'Dockerfile.coverage' + run: docker run --name test-container -t micm bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"' + + - name: Run coverage tests in container + if: matrix.dockerfile == 'Dockerfile.coverage' + run: docker run --name test-container -t micm bash -c 'make coverage ARGS="--rerun-failed --output-on-failure -j8"' + + - name: Copy coverage from container + if: matrix.dockerfile == 'Dockerfile.coverage' + run: docker cp test-container:build/coverage.info . + + - name: Upload coverage report + if: matrix.dockerfile == 'Dockerfile.coverage' + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.info \ No newline at end of file diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 000000000..b6396e34b --- /dev/null +++ b/.github/workflows/mac.yml @@ -0,0 +1,54 @@ +name: Mac + +on: [push, pull_request] + +jobs: + xcode_macos_12: + if: github.event_name == 'pull_request' + runs-on: macos-12 + strategy: + matrix: + xcode: ['13.1', '14.1'] + # all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + + steps: + - uses: actions/checkout@v3 + + - name: Configure and build + run: | + mkdir build + cd build + cmake .. + cmake --build . --parallel 10 + + - name: Run tests + run: | + cd build + ctest --rerun-failed --output-on-failure . --verbose -j 10 + + xcode_macos_13: + if: github.event_name == 'pull_request' + runs-on: macos-13 + strategy: + matrix: + # all available versions of xcode: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode + xcode: ['14.1', '15.0'] + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + + steps: + - uses: actions/checkout@v3 + + - name: Configure and build + run: | + mkdir build + cd build + cmake .. + cmake --build . --parallel 10 + + - name: Run tests + run: | + cd build + ctest --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 6196422ef..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: build - -on: [push, pull_request] - -jobs: - docker-build-and-test: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - name: Build and Test - ${{ matrix.dockerfile }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - dockerfile: - - Dockerfile - - Dockerfile.coverage - - Dockerfile.llvm - - Dockerfile.memcheck - - Dockerfile.no_json - - Dockerfile.nvhpc - - Dockerfile.openmp - # - Dockerfile.intel # intel image is too large for GH action - # - Dockerfile.mpi - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Build Docker image - run: docker build -t micm -f docker/${{ matrix.dockerfile }} . - - - name: Run tests in container - if: matrix.dockerfile != 'Dockerfile.coverage' - run: docker run --name test-container -t micm bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"' - - - name: Run coverage tests in container - if: matrix.dockerfile == 'Dockerfile.coverage' - run: docker run --name test-container -t micm bash -c 'make coverage ARGS="--rerun-failed --output-on-failure -j8"' - - - name: Copy coverage from container - if: matrix.dockerfile == 'Dockerfile.coverage' - run: docker cp test-container:build/coverage.info . - - - name: Upload coverage report - if: matrix.dockerfile == 'Dockerfile.coverage' - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.info - - multiplatform: - if: github.event_name == 'pull_request' - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - macos-latest - - ubuntu-latest - - windows-latest - compiler: - - { cpp: g++, c: gcc} - - { cpp: clang++, c: clang} - - { cpp: cl, c: cl } - exclude: - - os: windows-latest - compiler: { cpp: clang++, c: clang } - - os: windows-latest - compiler: { cpp: g++, c: gcc } - - os: ubuntu-latest - compiler: { cpp: cl, c: cl } - - os: macos-latest - compiler: { cpp: cl, c: cl } - env: - CC: ${{ matrix.compiler.c }} - CXX: ${{ matrix.compiler.cpp }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install CMake - if: matrix.os == 'windows-latest' - run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' - - - name: Install CMake - if: matrix.os != 'windows-latest' - run: | - if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then - sudo apt-get update - sudo apt-get install -y cmake - elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then - brew install cmake - fi - - - name: Configure and build - run: | - mkdir build - cd build - cmake .. - cmake --build . --parallel 10 - - - name: Run tests - run: | - cd build - ctest -C Debug --rerun-failed --output-on-failure . --verbose - - xcode_1: - if: github.event_name == 'pull_request' - runs-on: macos-12 - strategy: - matrix: - xcode: ['13.1', '13.2.1', '13.3.1', '13.4.1', '14.0', '14.0.1', '14.1'] - env: - DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer - - steps: - - uses: actions/checkout@v3 - - - name: Configure and build - run: | - mkdir build - cd build - cmake .. - cmake --build . --parallel 10 - - - name: Run tests - run: | - cd build - ctest --rerun-failed --output-on-failure . --verbose -j 10 - - xcode_2: - if: github.event_name == 'pull_request' - runs-on: macos-13 - strategy: - matrix: - xcode: ['14.1', '14.2', '14.3.1', '15.0'] - env: - DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer - - steps: - - uses: actions/checkout@v3 - - - name: Configure and build - run: | - mkdir build - cd build - cmake .. - cmake --build . --parallel 10 - - - name: Run tests - run: | - cd build - ctest --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 000000000..56a59bffb --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,48 @@ +name: Ubuntu + +on: [push, pull_request] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + gcc: + env: + CC: gcc + CXX: g++ + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C Debug --rerun-failed --output-on-failure . --verbose + clang: + env: + CC: clang + CXX: clang++ + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Cmake + run: cmake -S . -B build + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C Debug --rerun-failed --output-on-failure . --verbose \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 000000000..9fb5efdfd --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,133 @@ +name: Windows + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + mingw: + runs-on: windows-2019 + strategy: + matrix: + architecture: [x64, x86] + + steps: + - uses: actions/checkout@v3 + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + with: + platform: ${{ matrix.architecture }} + version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14 + + - name: Run Cmake + run: cmake -S . -B build -G "MinGW Makefiles" + + - name: Build + run: cmake --build build --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C Debug --rerun-failed --output-on-failure . --verbose + + msvc2019: + runs-on: windows-2019 + strategy: + matrix: + build_type: [Debug, Release] + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v3 + + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} + if: matrix.build_type == 'Release' + + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} + if: matrix.build_type == 'Debug' + + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 + + - name: Test + run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure + + msvc2019_latest: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v3 + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 16 2019" + - name: Build + run: cmake --build build --config Release --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C Release --output-on-failure + + msvc2022: + runs-on: windows-2022 + strategy: + matrix: + build_type: [Debug, Release] + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v3 + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} + if: matrix.build_type == 'Release' + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} + if: matrix.build_type == 'Debug' + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure + + msvc2022_latest: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v3 + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 17 2022" + - name: Build + run: cmake --build build --config Release --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C Release --output-on-failure + + clang: + runs-on: windows-2019 + strategy: + matrix: + version: [11, 12, 13, 14, 15] + + steps: + - uses: actions/checkout@v3 + - name: Install Clang + run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM" + - name: Run CMake + run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On + - name: Build + run: cmake --build build --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure + + clang-cl-11: + runs-on: windows-2019 + strategy: + matrix: + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v3 + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL + - name: Build + run: cmake --build build --config Debug --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure \ No newline at end of file