some visual stuff so it looks better #123
This file contains hidden or 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: C++ CI | |
| on: | |
| push: | |
| branches: ['**'] # NOTE: replace/update with appropriate branch name(s) | |
| tags: ['**'] | |
| # FIXME: automatic rebase to also trigger checks; TBD how to solve this | |
| # https://github.com/orgs/community/discussions/25702 | |
| # repository_dispatch: | |
| # types: [publish-trigger] | |
| # pull_request: | |
| # branches: ['**'] # NOTE: replace/update with appropriate branch name(s) | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: Build type | |
| required: false | |
| default: 'Debug' | |
| type: choice | |
| options: | |
| - Debug | |
| - Release | |
| - RelWithDebInfo | |
| - MinSizeRel | |
| env: | |
| BUILD_TYPE: ${{ inputs.build_type || 'Debug' }} | |
| # NOTE: update executable name if it is changed in CMakeLists.txt | |
| EXECUTABLE_NAME: "oop" | |
| INPUT_FILENAME: "tastatura.txt" | |
| BIN_DIR: "bin" # update in cmake/Options.cmake:6 if changing name here | |
| BUILD_DIR: "build" | |
| EXT_DIR: "ext" | |
| APP_WINDOW: "Find Rakis" | |
| # NOTE: also update in CMakeLists FetchContent | |
| # renovate: datasource=github-tags depName=SFML/SFML versioning=loose | |
| SFML_VERSION: "3.0.2" | |
| defaults: | |
| run: | |
| # Use a bash shell, so we can use the same syntax for environment variable | |
| # access regardless of the host operating system | |
| # https://github.com/saxbophone/CPP20-Cross-Platform-Template | |
| shell: bash | |
| jobs: | |
| cppcheck: | |
| name: "Cppcheck" | |
| # concurrency: | |
| # group: "Cppcheck" | |
| # renovate: depName=ubuntu | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 5 | |
| env: | |
| # check https://github.com/danmar/cppcheck/releases for latest version | |
| # NOTE: consider updating this value in scripts/build_cppcheck.sh:4 when changing this value | |
| # renovate: datasource=github-tags depName=danmar/cppcheck versioning=loose | |
| CPPCHECK_VER: "2.18.3" | |
| steps: | |
| - name: Checkout repo | |
| # renovate: datasource=github-tags depName=actions/checkout versioning=loose | |
| uses: actions/checkout@v5.0.0 | |
| - name: Run cppcheck | |
| uses: ./.github/actions/cppcheck | |
| clang-tidy: | |
| name: "Clang-Tidy" | |
| # concurrency: | |
| # group: "Clang-Tidy" | |
| # renovate: depName=ubuntu | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 15 | |
| env: | |
| CLANG_VER: 18 | |
| steps: | |
| - name: Checkout repo | |
| # renovate: datasource=github-tags depName=actions/checkout versioning=loose | |
| uses: actions/checkout@v5.0.0 | |
| - name: Run clang-tidy | |
| uses: ./.github/actions/clang-tidy | |
| build: | |
| name: ${{ matrix.name }} | |
| # concurrency: | |
| # group: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 8 | |
| permissions: | |
| attestations: write | |
| contents: write | |
| id-token: write | |
| env: | |
| CC: ${{ matrix.c }} | |
| CXX: ${{ matrix.cxx }} | |
| VSCMD_SKIP_SENDTELEMETRY: 1 | |
| # NOTE: replace with another version if this one does not work | |
| # For more versions, see https://winlibs.com or | |
| # https://github.com/brechtsanders/winlibs_mingw/releases/ | |
| MINGW_VER: "13.3.0posix-11.0.1-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-13.3.0-mingw-w64msvcrt-11.0.1-r1.7z" | |
| # Example: | |
| # MINGW_VER: "13.3.0posix-11.0.1-ucrt-r1/winlibs-x86_64-posix-seh-gcc-13.3.0-mingw-w64ucrt-11.0.1-r1.7z" | |
| # MINGW_VER: "14.1.0posix-18.1.7-12.0.0-ucrt-r2/winlibs-x86_64-posix-seh-gcc-14.1.0-mingw-w64ucrt-12.0.0-r2.7z" | |
| # MINGW_VER: "14.1.0posix-18.1.7-12.0.0-msvcrt-r2/winlibs-x86_64-posix-seh-gcc-14.1.0-mingw-w64msvcrt-12.0.0-r2.7z" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # # renovate: depName=ubuntu | |
| # - os: ubuntu-22.04 | |
| # c: clang-18 | |
| # cxx: clang++-18 | |
| # clang_ver: "18" | |
| # clang_ver_full: "18.1.8" | |
| # name: "MSan: Ubuntu 22.04 Clang 18" | |
| # cmake_flags: "-DUSE_MSAN=ON -DBUILD_SHARED_LIBS=FALSE" | |
| # cmake_generator: Ninja | |
| # # This env runs memory sanitizers | |
| # runs_msan: true | |
| # renovate: depName=ubuntu | |
| - os: ubuntu-22.04 | |
| c: gcc-12 | |
| cxx: g++-12 | |
| # renovate: depName=ubuntu | |
| name: "ASan: Ubuntu 22.04 GCC 12" | |
| cmake_flags: "-DUSE_ASAN=ON -DBUILD_SHARED_LIBS=FALSE" | |
| cmake_generator: Ninja | |
| # This env runs address sanitizers | |
| runs_asan: true | |
| # this is used to add a suffix to the archive name since we use the same compiler version | |
| asan_name: "-asan" | |
| # renovate: depName=ubuntu | |
| - os: ubuntu-22.04 | |
| c: gcc-12 | |
| cxx: g++-12 | |
| # renovate: depName=ubuntu | |
| name: "Valgrind: Ubuntu 22.04 GCC 12" | |
| cmake_flags: -DBUILD_SHARED_LIBS=FALSE | |
| cmake_generator: Ninja | |
| # This env runs valgrind | |
| runs_valgrind: true | |
| # renovate: depName=macos | |
| - os: macos-14 | |
| c: clang | |
| cxx: clang++ | |
| # renovate: depName=macos | |
| name: "macOS 14 Apple Clang 15" | |
| cmake_flags: "-DUSE_ASAN=OFF -DSFML_BUILD_FRAMEWORKS=FALSE -DSFML_DEPENDENCIES_INSTALL_PREFIX=$GITHUB_WORKSPACE/artifacts -DBUILD_SHARED_LIBS=FALSE" | |
| # cmake_generator: | |
| # This env runs address sanitizers | |
| # runs_asan: false | |
| # # renovate: depName=macos | |
| # - os: macos-14 | |
| # c: gcc-13 | |
| # cxx: g++-13 | |
| # name: "macOS 14 GCC 13" | |
| # cmake_flags: | |
| # cmake_generator: Ninja | |
| # renovate: depName=windows | |
| - os: windows-2022 | |
| c: cl | |
| cxx: cl | |
| # renovate: depName=windows | |
| name: "ASan: Windows 2022 MSVC 19.44" | |
| cmake_flags: "-DUSE_ASAN=ON -DBUILD_SHARED_LIBS=TRUE" | |
| # Ninja is not faster on MSVC because... MSVC | |
| # cmake_generator: "Ninja" | |
| # cmake_generator: "Ninja Multi-Config" | |
| # This env runs address sanitizers | |
| # runs_asan: true | |
| # renovate: depName=windows | |
| - os: windows-2022 | |
| c: gcc | |
| cxx: g++ | |
| # renovate: depName=windows | |
| name: "Windows 2022 MinGW GCC 13" | |
| cmake_flags: -DBUILD_SHARED_LIBS=TRUE | |
| cmake_generator: Ninja | |
| steps: | |
| - name: Checkout repo | |
| # renovate: datasource=github-tags depName=actions/checkout versioning=loose | |
| uses: actions/checkout@v5.0.0 | |
| - name: Set timestamp, zip name, repo visibility | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| echo "TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S)" >> ${GITHUB_ENV} | |
| # use the full name as prefix: {user_name}_{repo_name} (replace / with _) | |
| echo "ZIP_NAME=$(echo "${GITHUB_REPOSITORY}_${{ env.BUILD_TYPE }}_${{ matrix.os }}_${{ matrix.cxx }}${{ matrix.asan_name }}" | sed 's|/|_|')" >> ${GITHUB_ENV} | |
| # or use only the repo name (github does not have a predefined environment variable for this) | |
| # the regex splits by / and keeps everything after / without the / character | |
| # echo "ZIP_NAME=$(echo "${GITHUB_REPOSITORY}_${{ env.BUILD_TYPE }}_${{ matrix.os }}_${{ matrix.cxx }}${{ matrix.asan_name }}" | sed -E 's|.+/(.+)|\1|')" >> ${GITHUB_ENV} | |
| if [[ $(gh repo view "${{ github.repository }}" --json isPrivate -q ".isPrivate") == "true" ]]; then | |
| echo "PRIVATE_REPO=true" >> ${GITHUB_ENV} | |
| else | |
| echo "Public repo" | |
| fi | |
| - name: Install packages | |
| uses: ./.github/actions/install-packages | |
| - name: Configure CMake | |
| uses: ./.github/actions/configure-cmake | |
| with: | |
| custom_flags: ${{ matrix.cmake_flags }} | |
| warnings_as_errors: 'ON' | |
| - name: Build | |
| run: | | |
| bash ./scripts/cmake.sh build -c ${{ env.BUILD_TYPE }} | |
| - name: Install | |
| # Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory | |
| run: | | |
| bash ./scripts/cmake.sh install -c ${{ env.BUILD_TYPE }} -i artifacts | |
| - name: Move artifacts | |
| run: | | |
| mkdir ${{ env.ZIP_NAME }} | |
| shopt -s dotglob | |
| mv artifacts/${{ env.BIN_DIR }}/* ${{ env.ZIP_NAME }} | |
| ls -la ${{ env.ZIP_NAME }} | |
| - name: Process artifacts | |
| uses: ./.github/actions/process-artifacts | |
| - name: Upload Artifacts | |
| # renovate: datasource=github-tags depName=actions/upload-artifact versioning=loose | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: ${{ env.ZIP_NAME }}_${{ env.TIMESTAMP }} | |
| include-hidden-files: true | |
| path: ${{ env.ZIP_NAME }} | |
| retention-days: 30 | |
| - name: Runtime checks | |
| uses: ./.github/actions/runtime-checks | |
| - name: Create release | |
| uses: ./.github/actions/create-release | |
| if: startsWith(github.ref, 'refs/tags/') |