Skip to content

Commit c06812c

Browse files
antonbaliasnikovakiramenai
authored andcommitted
ci: use per-commit difference for formatting and clang-tidy
[skip ci]
1 parent 10a60db commit c06812c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/regression-tests.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,17 @@ jobs:
6868
fetch-depth: ${{ needs.prepare-test-matrix.outputs.fetch_depth }}
6969
repository: ${{ github.event.pull_request.head.repo.full_name }}
7070

71+
- name: Define previous commit
72+
id: previous-commit
73+
run: echo "sha=$(git show --quiet --pretty='%H' ${{ matrix.commit }}^1)" | tee -a "${GITHUB_OUTPUT}"
74+
7175
- name: Get changed files
7276
id: changed-files
7377
uses: tj-actions/changed-files@v39
7478
with:
7579
separator: ","
7680
sha: ${{ matrix.commit }}
77-
base_sha: ${{ github.event.pull_request.base.sha }}
81+
base_sha: ${{ steps.previous-commit.outputs.sha }}
7882

7983
- name: Install formatting requirements
8084
run: python3 -m pip install -r ./llvm/utils/git/requirements_formatting_era_llvm.txt
@@ -89,7 +93,7 @@ jobs:
8993
fi
9094
python3 ./llvm/utils/git/code-format-helper-era-llvm.py ${TOKEN_PARAM} \
9195
--issue-number ${{ github.event.pull_request.number }} \
92-
--start-rev ${{ github.event.pull_request.base.sha }} \
96+
--start-rev ${{ steps.previous-commit.outputs.sha }} \
9397
--end-rev ${{ matrix.commit }} \
9498
--changed-files ${{ steps.changed-files.outputs.all_changed_files }}
9599
@@ -108,9 +112,16 @@ jobs:
108112
- uses: actions/checkout@v4
109113
with:
110114
ref: ${{ matrix.commit }}
115+
fetch-depth: ${{ needs.prepare-test-matrix.outputs.fetch_depth }}
111116
path: "llvm"
112117
repository: ${{ github.event.pull_request.head.repo.full_name }}
113118

119+
- name: Define previous commit
120+
if: github.event_name == 'pull_request'
121+
working-directory: llvm
122+
id: previous-commit
123+
run: echo "sha=$(git show --quiet --pretty='%H' ${{ matrix.commit }}^1)" | tee -a "${GITHUB_OUTPUT}"
124+
114125
- name: Build LLVM
115126
uses: matter-labs/era-compiler-ci/.github/actions/build-llvm@v1
116127
with:
@@ -130,9 +141,7 @@ jobs:
130141
if: github.event_name == 'pull_request'
131142
working-directory: llvm
132143
run: |
133-
git fetch --progress --depth=1 origin \
134-
"+refs/heads/${{ github.event.pull_request.base.ref }}:refs/heads/${{ github.event.pull_request.base.ref }}"
135-
CHANGES=$(git diff -U0 ${{ github.event.pull_request.base.sha }})
144+
CHANGES=$(git diff -U0 ${{ steps.previous-commit.outputs.sha }})
136145
echo "Running clang-tidy on the following changes: ${CHANGES}"
137146
echo "${CHANGES}" | \
138147
./clang-tools-extra/clang-tidy/tool/clang-tidy-diff_Zegar.py \

0 commit comments

Comments
 (0)