From 6b4431461db30f6d713e7a84d996ade49f487c05 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Mon, 30 Jun 2025 08:48:17 +0200 Subject: [PATCH 1/2] [CI] Add pre-commit job --- .github/workflows/ubuntu.yml | 19 +++++++++++++++++++ requirements.txt | 1 + 2 files changed, 20 insertions(+) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c0ba92605..e6c23cde2 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -2,7 +2,24 @@ on: workflow_call: jobs: + pre-commit: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup environment + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + gcc-14 g++-14 ninja-build python3-pip clang-format-16 + python3 -m pip install -r requirements.txt + - name: Run pre-commit checks + run: | + pre-commit run --from-ref origin/master --to-ref HEAD gcc-build: + needs: + - pre-commit runs-on: ${{ matrix.os }} strategy: matrix: @@ -110,6 +127,8 @@ jobs: env: PPC_NUM_PROC: 1 clang-build: + needs: + - pre-commit runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/requirements.txt b/requirements.txt index cc7c6965f..9be8cde1f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ numpy==2.2.3 XlsxWriter==3.2.5 PyYAML==6.0.2 +pre-commit==3.4.0 From 4ae89501dd33ce41ec784990dc0b6f73ffc29c4d Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy Date: Mon, 30 Jun 2025 09:11:18 +0200 Subject: [PATCH 2/2] fix --- .github/workflows/ubuntu.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e6c23cde2..9bb41cf48 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -8,6 +8,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 - name: Setup environment run: | sudo apt-get update @@ -16,7 +17,14 @@ jobs: python3 -m pip install -r requirements.txt - name: Run pre-commit checks run: | - pre-commit run --from-ref origin/master --to-ref HEAD + # For push events, compare with previous commit + if [ "${{ github.event_name }}" = "push" ]; then + pre-commit run --from-ref HEAD~1 --to-ref HEAD + else + # For PRs, compare with base branch + git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} + pre-commit run --from-ref ${{ github.base_ref }} --to-ref HEAD + fi gcc-build: needs: - pre-commit