Просмотр исходного кода

Github: wipe workspace before checkout (#2527)

* Github: wipe workspace before checkout

* Github: allow find to fail

* Github: limit maxdepth for find
あく 2 лет назад
Родитель
Сommit
973287b09b

+ 4 - 17
.github/workflows/build.yml

@@ -18,16 +18,8 @@ jobs:
   main:
     runs-on: [self-hosted,FlipperZeroShell]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout code'
         uses: actions/checkout@v3
@@ -171,13 +163,8 @@ jobs:
     if: ${{ !startsWith(github.ref, 'refs/tags') }}
     runs-on: [self-hosted,FlipperZeroShell]
     steps:
-      - 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)"
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout code'
         uses: actions/checkout@v3

+ 2 - 10
.github/workflows/lint_and_submodule_check.yml

@@ -18,16 +18,8 @@ jobs:
   lint_sources_check_submodules:
     runs-on: [self-hosted,FlipperZeroShell]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout code'
         uses: actions/checkout@v3

+ 2 - 10
.github/workflows/merge_report.yml

@@ -12,16 +12,8 @@ jobs:
   merge_report:
     runs-on: [self-hosted,FlipperZeroShell]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout code'
         uses: actions/checkout@v3

+ 2 - 10
.github/workflows/pvs_studio.yml

@@ -19,16 +19,8 @@ jobs:
     if: ${{ !github.event.pull_request.head.repo.fork }}
     runs-on: [self-hosted, FlipperZeroShell]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout code'
         uses: actions/checkout@v3

+ 2 - 10
.github/workflows/unit_tests.yml

@@ -12,16 +12,8 @@ jobs:
   run_units_on_bench:
     runs-on: [self-hosted, FlipperZeroUnitTest]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: Checkout code
         uses: actions/checkout@v3

+ 4 - 16
.github/workflows/updater_test.yml

@@ -12,16 +12,8 @@ jobs:
   test_updater_on_bench:
     runs-on: [self-hosted, FlipperZeroUpdaterTest]
     steps:
-      - name: 'Decontaminate previous build leftovers'
-        run: |
-          if [ -d .git ]; then
-            git submodule status || (
-              git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
-              do
-                git rm -rf "$submodule"
-              done
-            )
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: Checkout code
         uses: actions/checkout@v3
@@ -57,12 +49,8 @@ jobs:
         run: |
           echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT
 
-      - name: 'Decontaminate previous build leftovers'
-        if: failure()
-        run: |
-          if [ -d .git ]; then
-            git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
-          fi
+      - name: 'Wipe workspace'
+        run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; 
 
       - name: 'Checkout latest release'
         uses: actions/checkout@v3