diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index c1ae70435..29816e0a0 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,19 +1,164 @@ -name: build linux +name: build & test on: - workflow_run: - workflows: [ "generate build matrix" ] - types: - - completed - -jobs: - run-job: - runs-on: ubuntu-latest + push: + branches: [ main, development ] + pull_request: + branches: [ main, development ] + + jobs: + ############ + # + # Defines the compiler configurations for the other jobs. + # + ##### + generate-base-matrix: + runs-on: ubuntu-latest + + outputs: + config: ${{ steps.output-config.outputs.config }} + build_modes: ${{ steps.output-options.outputs.build_modes }} + cxx_versions: ${{ steps.output-options.outputs.cxx_versions }} + + steps: + # enables debug-mode and c++20 for all cases + - name: Enable base matrix + shell: bash + run: | + echo "BUILD_MODES=\"Debug\"" >> $GITHUB_ENV + echo "CXX_VERSIONS=20" >> $GITHUB_ENV + + # if its a PR from development or the main branch in general, add release-mode and c++23 + - name: Enable extended matrix + if: ${{ + (github.event_name == 'pull_request' && github.head_ref == 'development') + || github.ref_name == 'main' + }} + shell: bash + run: | + echo "BUILD_MODES=$(echo $BUILD_MODES, \"Release\")" >> $GITHUB_ENV + echo "CXX_VERSIONS=$(echo $CXX_VERSIONS, 23)" >> $GITHUB_ENV + + - name: Output build-modes and c++-versions + id: output-options + shell: bash + run: | + echo "build_modes=$(echo [ $BUILD_MODES ])" >> "$GITHUB_OUTPUT" + echo "cxx_versions=$(echo [ $CXX_VERSIONS ])" >> "$GITHUB_OUTPUT" + + build-and-test: + needs: define-matrix + runs-on: generate-base-matrix fail-fast: false strategy: - format_backend: [ std, fmt ] - str_matcher: [ char, unicode ] build_mode: ${{ fromJSON(needs.define-matrix.outputs.build_modes) }} cxx_standard: ${{ fromJSON(needs.define-matrix.outputs.cxx_versions) }} + config: + - prefix: "Linux" + suffix: "/libc++" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:18" + compiler_name: "clang" + compiler_version: 18 + architecture: "x64" + libcxx: true + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:18" + compiler_name: "clang" + compiler_version: 18 + architecture: "x64" + libcxx: false + asan: true + + - prefix: "Linux" + suffix: "/libc++" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:17" + compiler_name: "clang" + compiler_version: 17 + architecture: "x64" + libcxx: true + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:17" + compiler_name: "clang" + compiler_version: 17 + architecture: "x64" + libcxx: false + asan: true + + - prefix: "Linux" + suffix: "/libc++" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:16" + compiler_name: "clang" + compiler_version: 16 + only_fmt: true + architecture: "x64" + libcxx: true + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/clang:16" + compiler_name: "clang" + compiler_version: 16 + only_fmt: true + architecture: "x64" + libcxx: false + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:14" + compiler_name: "gcc" + compiler_version: 14 + architecture: "x64" + libcxx: false + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:14" + compiler_name: "gcc" + compiler_version: 14 + architecture: "32bit" + libcxx: false + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:13" + compiler_name: "gcc" + compiler_version: 13 + architecture: "x64" + libcxx: false + asan: true + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:12" + compiler_name: "gcc" + compiler_version: 12 + only_fmt: true + architecture: "x64" + libcxx: false + asan: true + steps: - name: Checkout code uses: actions/checkout@v4 @@ -24,12 +169,20 @@ jobs: run: | echo "CXXFLAGS=$(echo ${CXXFLAGS} -stdlib=libc++)" >> $GITHUB_ENV echo "LDFLAGS=$(echo ${LDFLAGS} -lc++abi)" >> $GITHUB_ENV - - # ASan has some serious trouble with libc++ exception mechanism - # see: https://github.com/llvm/llvm-project/issues/59432 + + # ASan has some serious trouble with libc++ exception mechanism + # see: https://github.com/llvm/llvm-project/issues/59432 + - name: Disable alloc_dealloc_mismatch detection with libc++ + if: ${{ matrix.config.asan == true && matrix.config.libcxx == true}} + shell: bash + run: | echo "ASAN_OPTIONS=$(echo ${ASAN_OPTIONS}:alloc_dealloc_mismatch=0)" >> $GITHUB_ENV + ################################# + # - name: Configure Basic Framework + id: config-basic + if: ${{ matrix.config.only_fmt != true }} shell: bash run: | cmake \ @@ -41,11 +194,13 @@ jobs: -D MIMICPP_FORCED_CXX_STANDARD="${{ matrix.cxx_standard }}" - name: Build Basic Framework + if: ${{ steps.config-basic.outcome == 'success' }} shell: bash run: | cmake --build build -j5 - name: Run Basic Framework tests + if: ${{ steps.config-basic.outcome == 'success' }} shell: bash env: CTEST_OUTPUT_ON_FAILURE: 1 @@ -53,3 +208,5 @@ jobs: ctest --test-dir build \ -C ${{ matrix.build_mode }} \ -j5 + # + #################################