From bb057cb2449848df207fd3a0e53ba0bc536a970b Mon Sep 17 00:00:00 2001 From: Nikita Astafyev Date: Tue, 30 Dec 2025 22:44:09 +0700 Subject: [PATCH] ci: added build workflow --- .github/workflows/linux.yaml | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/linux.yaml diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml new file mode 100644 index 0000000..7a6e49e --- /dev/null +++ b/.github/workflows/linux.yaml @@ -0,0 +1,64 @@ +name: Linux (Ubuntu-24.04) CI + +on: [push] + +jobs: + build: + runs-on: ubuntu-24.04 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + config: + - { compiler: gcc, version: 14, std: 23, build_type: Release } + - { compiler: clang, version: 20, std: 23, build_type: Release } + + name: "${{matrix.config.compiler}} ${{matrix.config.version}} (C++${{matrix.config.std}}, ${{matrix.config.build_type}})" + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup compiler and build system + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.config.compiler }}-${{ matrix.config.version }} + ninja: true + + - name: Setup vcpkg + run: | + git clone --branch 2025.10.17 --depth 1 https://github.com/microsoft/vcpkg.git && \ + ./vcpkg/bootstrap-vcpkg.sh && \ + echo 'VCPKG_BINARY_SOURCES=files,${{ github.workspace }}/vcpkg_cache,readwrite' >> $GITHUB_ENV + + - name: Cache vcpkg binaries + id: vcpkg-bin-cache + uses: actions/cache@v4 + with: + path: vcpkg_cache + key: vcpkg-bin-${{ runner.os }}-${{ matrix.config.compiler }}-${{ matrix.config.version }}-${{ matrix.config.build_type }}-${{ hashFiles('**/vcpkg.json') }} + + # Only free up space on dry run + # If cache is present (<= 1gb) there is no need to free up space + - name: Free Disk Space (Ubuntu) + if: steps.vcpkg-bin-cache.outputs.cache-hit != 'true' + uses: jlumbroso/free-disk-space@v1.3.1 + with: + tool-cache: false + + - name: Configure and install dependencies and + run: | + cmake -S . -B build \ + -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ + -DCMAKE_CXX_STANDARD=${{ matrix.config.std }} \ + -G Ninja + + - name: Build + run: | + cmake --build build -j $(nproc) + + - name: Test + run: | + ctest --exclude-regex static --test-dir build -j $(nproc) --output-on-failure