From fd8607398dbdb986888ee0b7517d9ef5c79e06e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Tue, 21 Mar 2023 18:55:20 +0900 Subject: [PATCH] Github: unshallow on decontamination (#2521) * Github: unshallow on decontamination * Github: fix syntax * Github: decontaminate without full tree * Github: update decontaminate action in all workflows --- .github/workflows/build.yml | 7 ++++++- .github/workflows/lint_and_submodule_check.yml | 7 ++++++- .github/workflows/merge_report.yml | 7 ++++++- .github/workflows/pvs_studio.yml | 7 ++++++- .github/workflows/unit_tests.yml | 9 +++++++-- .github/workflows/updater_test.yml | 7 ++++++- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79535c93..6ab2490c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: 'Checkout code' diff --git a/.github/workflows/lint_and_submodule_check.yml b/.github/workflows/lint_and_submodule_check.yml index ede35793..46cca5c0 100644 --- a/.github/workflows/lint_and_submodule_check.yml +++ b/.github/workflows/lint_and_submodule_check.yml @@ -21,7 +21,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: 'Checkout code' diff --git a/.github/workflows/merge_report.yml b/.github/workflows/merge_report.yml index 3b7cd234..e88346ed 100644 --- a/.github/workflows/merge_report.yml +++ b/.github/workflows/merge_report.yml @@ -15,7 +15,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: 'Checkout code' diff --git a/.github/workflows/pvs_studio.yml b/.github/workflows/pvs_studio.yml index 9105a0fd..65ffd195 100644 --- a/.github/workflows/pvs_studio.yml +++ b/.github/workflows/pvs_studio.yml @@ -22,7 +22,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: 'Checkout code' diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index bed5a470..6f044ebc 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -15,7 +15,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: Checkout code @@ -32,7 +37,7 @@ jobs: - name: 'Flash unit tests firmware' id: flashing if: success() - run: | + run: | ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1 - name: 'Wait for flipper and format ext' diff --git a/.github/workflows/updater_test.yml b/.github/workflows/updater_test.yml index eba34e98..c04d526f 100644 --- a/.github/workflows/updater_test.yml +++ b/.github/workflows/updater_test.yml @@ -15,7 +15,12 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" + git submodule status || ( + git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule + do + git rm -rf --cached "$submodule" + done + ) fi - name: Checkout code