name: build on: push: pull_request: types: [opened, reopened, labeled, unlabeled, synchronize] workflow_dispatch: jobs: build: runs-on: ${{ matrix.os }} name: ${{ matrix.name }} timeout-minutes: 30 strategy: fail-fast: false matrix: include: - name: ubuntu-latest (make) Release os: ubuntu-latest preset: make build_type: Release cc: gcc-13 cxx: g++-13 - name: ubuntu-latest (gcc-15) Release os: ubuntu-latest preset: make build_type: Release cc: gcc-15 cxx: g++-15 - name: macos-latest (make) Release os: macos-latest preset: make build_type: Release cc: clang cxx: clang++ - name: windows-latest (windows) Release os: windows-latest preset: windows build_type: Release concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.name }} cancel-in-progress: true steps: - uses: actions/checkout@v6 - name: Install Linux toolchain if: runner.os == 'Linux' run: | if [[ "${{ matrix.cc }}" == "gcc-15" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test fi sudo apt-get update sudo apt-get install -y ${{ matrix.cc }} ${{ matrix.cxx }} - name: ccache uses: hendrikmuhs/ccache-action@v1.2 - name: Configure CMake run: > cmake --preset ${{ matrix.preset }} -S ${{ github.workspace }} -B ${{ github.workspace }}/build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D CMAKE_C_COMPILER=${{ matrix.cc || '' }} -D CMAKE_CXX_COMPILER=${{ matrix.cxx || '' }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ${{ matrix.cc == 'gcc-15' && '-DCMAKE_CXX_FLAGS=-Wno-error=missing-declarations -Wno-error=missing-field-initializers' || '' }} - name: Build run: cmake --build ${{ github.workspace }}/build --preset ${{ matrix.preset }} --config ${{ matrix.build_type }} -j 4 - name: Archive production artifacts uses: actions/upload-artifact@v6 with: name: gemma-${{ matrix.os }}-${{ matrix.preset }}-${{ matrix.build_type }}-${{ matrix.cc || 'default' }} path: | ${{ github.workspace }}/build/${{ matrix.build_type }}/gemma.exe ${{ github.workspace }}/build/${{ matrix.build_type }}/libgemma.lib ${{ github.workspace }}/build/gemma ${{ github.workspace }}/build/libgemma.a bazel: runs-on: ubuntu-latest steps: - name: Harden Runner uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 with: egress-policy: audit # cannot be block - runner does git checkout - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.0.0 - uses: bazelbuild/setup-bazelisk@b39c379c82683a5f25d34f0d062761f62693e0b2 # v3.0.0 - uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 with: path: ~/.cache/bazel key: bazel-${{ runner.os }} - run: bazel build --cxxopt=-std=c++20 //:gemma --jobs=10 --show_progress_rate_limit=1