From 8c7326099f165ff9fb3394804a51ca7dd97dff99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 17 Sep 2024 09:39:16 +0200 Subject: [PATCH] ci: github: git clean after rebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After rebasing the PR on main, the local copy of the repository may still contain untracked directories and files (for example, the commits from the pull request are "git mv"ing files out of directories that are then left empty). Add a git clean so that we run CI in conditions that are as close as possible to a fresh clone. Signed-off-by: Benjamin Cabé --- .github/workflows/bsim-tests.yaml | 1 + .github/workflows/clang.yaml | 1 + .github/workflows/coding_guidelines.yml | 1 + .github/workflows/compliance.yml | 1 + .github/workflows/doc-build.yml | 1 + .github/workflows/hello_world_multiplatform.yaml | 1 + .github/workflows/scripts_tests.yml | 1 + .github/workflows/twister.yaml | 2 ++ 8 files changed, 9 insertions(+) diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index 0c50ca5d6fd450..c879623d13d732 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -77,6 +77,7 @@ jobs: git config --global user.name "Zephyr Bot" rm -fr ".git/rebase-apply" git rebase origin/${BASE_REF} + git clean -f -d git log --pretty=oneline | head -n 10 west init -l . || true west config manifest.group-filter -- +ci diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index e88141a9e2315c..ac1c26f552fd44 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -62,6 +62,7 @@ jobs: git config --global user.name "Zephyr Bot" rm -fr ".git/rebase-apply" git rebase origin/${BASE_REF} + git clean -f -d git log --pretty=oneline | head -n 10 west init -l . || true west config --global update.narrow true diff --git a/.github/workflows/coding_guidelines.yml b/.github/workflows/coding_guidelines.yml index 1bc6ee2e666732..97d2301a9e3c91 100644 --- a/.github/workflows/coding_guidelines.yml +++ b/.github/workflows/coding_guidelines.yml @@ -41,6 +41,7 @@ jobs: git config --global user.name "Github Actions" git remote -v git rebase origin/${BASE_REF} + git clean -f -d source zephyr-env.sh # debug ls -la diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 39815d8baa36b7..48dfa237aca944 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -52,6 +52,7 @@ jobs: [[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \ (echo "::error ::Merge commits not allowed, rebase instead";false) git rebase origin/${BASE_REF} + git clean -f -d # debug git log --pretty=oneline | head -n 10 west init -l . || true diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 34e3557b048265..8423cdd0360134 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -101,6 +101,7 @@ jobs: git config --global user.email "actions@zephyrproject.org" git config --global user.name "Github Actions" git rebase origin/${BASE_REF} + git clean -f -d git log --graph --oneline HEAD...${PR_HEAD} - name: cache-pip diff --git a/.github/workflows/hello_world_multiplatform.yaml b/.github/workflows/hello_world_multiplatform.yaml index 08fd42d786602d..3543fb3fd540f2 100644 --- a/.github/workflows/hello_world_multiplatform.yaml +++ b/.github/workflows/hello_world_multiplatform.yaml @@ -46,6 +46,7 @@ jobs: git config --global user.email "actions@zephyrproject.org" git config --global user.name "Github Actions" git rebase origin/${BASE_REF} + git clean -f -d git log --graph --oneline HEAD...${PR_HEAD} - name: Set up Python diff --git a/.github/workflows/scripts_tests.yml b/.github/workflows/scripts_tests.yml index 86db35ae02e0eb..20d116bcff59ed 100644 --- a/.github/workflows/scripts_tests.yml +++ b/.github/workflows/scripts_tests.yml @@ -43,6 +43,7 @@ jobs: git config --global user.email "actions@zephyrproject.org" git config --global user.name "Github Actions" git rebase origin/${BASE_REF} + git clean -f -d git log --graph --oneline HEAD...${PR_HEAD} - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index cc3c9e3ffdfc54..a4bc219f36dcd6 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -77,6 +77,7 @@ jobs: git config --global user.name "Zephyr Bot" rm -fr ".git/rebase-apply" git rebase origin/${BASE_REF} + git clean -f -d git log --pretty=oneline | head -n 10 west init -l . || true west config manifest.group-filter -- +ci,+optional @@ -185,6 +186,7 @@ jobs: git config --global user.name "Zephyr Builder" rm -fr ".git/rebase-apply" git rebase origin/${BASE_REF} + git clean -f -d git log --pretty=oneline | head -n 10 fi echo "$HOME/.local/bin" >> $GITHUB_PATH