chore: import codebase from Gerrit #4
Workflow file for this run
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
| # Copyright 2025 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: Build and Test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Clean up apt cache to save space | |
| apt-get clean | |
| rm -rf /var/lib/apt/lists/* | |
| df -h | |
| # Install python dependencies (with coverage enabled) | |
| echo -e "\n##### Running pip install #####" | |
| pip install -e '.[dev]' --config-settings=cmake.args="-DENABLE_COVERAGE=ON" | |
| - name: Lint with ruff | |
| run: | | |
| pip install ruff | |
| ruff check . | |
| ruff format --check . | |
| - name: Lint with clang-format | |
| run: | | |
| # Install and run C++ linter | |
| echo -e "\n##### Installing and running clang-format linter #####" | |
| apt-get update && apt-get install -y clang-format | |
| find src -name '*.cpp' -o -name '*.h' | xargs clang-format --dry-run --Werror | |
| - name: Test with pytest with coverage check | |
| run: | | |
| # Run Python tests with coverage | |
| echo -e "\n##### Running Python tests with coverage #####" | |
| coverage run --source=src/ml_flashpoint --branch -m pytest -v -s | ts '[%F %T%z]' | |
| # Verify python coverage thresholds | |
| echo -e "\n##### Verifying Python coverage thresholds #####" | |
| coverage report | |
| - name: Check C++ test coverage | |
| run: | | |
| # Run C++ coverage check | |
| echo -e "\n##### Running C++ coverage check #####" | |
| mkdir -p htmlcov/cpp | |
| gcovr --root=. \ | |
| --filter=src/ml_flashpoint \ | |
| --exclude=".*/_deps/.*" \ | |
| --gcov-executable=gcov \ | |
| --txt-metric branch \ | |
| --html-details htmlcov/cpp/index.html \ | |
| --xml-pretty -o cxx-coverage.xml \ | |
| --sort uncovered-number \ | |
| --gcov-ignore-parse-errors negative_hits.warn \ | |
| --gcov-ignore-parse-errors suspicious_hits.warn |