name: Shardok Build

on:
  push:
    branches: [ "main" ]
    paths:
      - 'src/main/cpp/**'
      - 'src/main/proto/net/eagle0/shardok/**'
      - 'src/main/proto/net/eagle0/common/**'
      - 'src/main/go/net/eagle0/build/**'
      - 'WORKSPACE'
      - 'MODULE.bazel'
      - 'BUILD.bazel'
      - '.bazelrc'
      - '.github/workflows/shardok_build.yml'
  pull_request:
    paths:
      - 'src/main/cpp/**'
      - 'src/main/proto/net/eagle0/shardok/**'
      - 'src/main/proto/net/eagle0/common/**'
      - 'src/main/go/net/eagle0/build/**'
      - 'WORKSPACE'
      - 'MODULE.bazel'
      - 'BUILD.bazel'
      - '.bazelrc'
      - '.github/workflows/shardok_build.yml'

permissions:
  contents: read

jobs:
  build:
    runs-on: [self-hosted, bazel]

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          lfs: false
      - name: Build Shardok server
        run: bazel build -c opt //src/main/cpp/net/eagle0/shardok:shardok-server
