diff --git a/.github/workflows/check-binaries.yml b/.github/workflows/check-binaries.yml new file mode 100644 index 00000000..c06b7fae --- /dev/null +++ b/.github/workflows/check-binaries.yml @@ -0,0 +1,39 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Check Binaries + +on: + pull_request: + branches: [ "main" ] + +jobs: + check-no-binaries: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check for binary files in PR + run: | + git fetch origin ${{ github.base_ref }} + BINARIES=$(git diff --numstat --diff-filter=ACM origin/${{ github.base_ref }}...HEAD | awk '$1 == "-" || $2 == "-" {print $3}') + + if [ -n "$BINARIES" ]; then + echo "::error::Binary files are not allowed to be committed in PRs. Found:" + echo "$BINARIES" + exit 1 + fi diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3fd354fc..9130a0d3 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -60,14 +60,3 @@ jobs: - name: Test run: go test -v ./... - - - name: Check for binary files in PR - run: | - # Get the list of files where Git shows no line count (binary) - BINARIES=$(git diff --numstat origin/${{ github.base_ref }}...HEAD | grep "^-" | cut -f3) - - if [ -n "$BINARIES" ]; then - echo "Binary files detected in diff:" - echo "$BINARIES" - exit 1 # Fail the check if binaries are found - fi diff --git a/.gitignore b/.gitignore index 727d1a2e..fa40af35 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ ax-bin python/__pycache__ python/proto/__pycache__ __pycache__/ +e2e diff --git a/e2e b/e2e deleted file mode 100755 index c1226113..00000000 Binary files a/e2e and /dev/null differ