From c4fa301b6b3b8faa3f14558e5207263b5490213b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Tue, 21 Sep 2021 21:54:55 +0200
Subject: [PATCH] CI: Build test binaries with debug symbols, then strip

This allows having good stacktraces when the tests crash.
---
 .github/workflows/linux_builds.yml   | 10 +++++++---
 .github/workflows/macos_builds.yml   |  7 ++++++-
 .github/workflows/windows_builds.yml |  9 +++++++--
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index 54e9ef4c66d..8a49959a307 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
 # Global Settings
 env:
   GODOT_BASE_BRANCH: master
-  SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
+  SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
 
 concurrency:
   group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
@@ -23,7 +23,6 @@ jobs:
             target: release_debug
             tools: true
             tests: true
-            sconsflags: ""
             doc-test: true
             bin: "./bin/godot.linuxbsd.opt.tools.64"
             artifact: true
@@ -44,7 +43,7 @@ jobs:
             target: release
             tools: false
             tests: false
-            sconsflags: module_mono_enabled=yes mono_glue=no
+            sconsflags: module_mono_enabled=yes mono_glue=no debug_symbols=no
             artifact: true
 
     steps:
@@ -127,6 +126,11 @@ jobs:
           VK_ICD_FILENAMES=$(pwd)/vk_swiftshader_icd.json DRI_PRIME=0 xvfb-run ${{ matrix.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
           misc/scripts/check_ci_log.py sanitizers_log.txt
 
+      - name: Prepare artifact
+        if: ${{ matrix.artifact }}
+        run: |
+          strip bin/godot.*
+
       - name: Upload artifact
         uses: ./.github/actions/upload-artifact
         if: ${{ matrix.artifact }}
diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml
index 38d43a4b94d..dec3abe52b7 100644
--- a/.github/workflows/macos_builds.yml
+++ b/.github/workflows/macos_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
 # Global Settings
 env:
   GODOT_BASE_BRANCH: master
-  SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
+  SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
 
 concurrency:
   group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-macos
@@ -30,6 +30,7 @@ jobs:
             target: release
             tools: false
             tests: false
+            sconsflags: debug_symbols=no
 
     steps:
       - uses: actions/checkout@v2
@@ -58,6 +59,10 @@ jobs:
         run: |
           ${{ matrix.bin }} --test
 
+      - name: Prepare artifact
+        run: |
+          strip bin/godot.*
+
       - name: Upload artifact
         uses: ./.github/actions/upload-artifact
         with:
diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml
index ee689612f57..ad870ae58ff 100644
--- a/.github/workflows/windows_builds.yml
+++ b/.github/workflows/windows_builds.yml
@@ -5,7 +5,7 @@ on: [push, pull_request]
 # SCONS_CACHE for windows must be set in the build environment
 env:
   GODOT_BASE_BRANCH: master
-  SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no module_text_server_fb_enabled=yes
+  SCONSFLAGS: verbose=yes warnings=all werror=yes module_text_server_fb_enabled=yes
   SCONS_CACHE_MSVC_CONFIG: true
 
 concurrency:
@@ -33,6 +33,7 @@ jobs:
             target: release
             tools: false
             tests: false
+            sconsflags: debug_symbols=no
 
     steps:
       - uses: actions/checkout@v2
@@ -50,7 +51,7 @@ jobs:
       - name: Compilation
         uses: ./.github/actions/godot-build
         with:
-          sconsflags: ${{ env.SCONSFLAGS }}
+          sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
           platform: windows
           target: ${{ matrix.target }}
           tools: ${{ matrix.tools }}
@@ -63,6 +64,10 @@ jobs:
         run: |
           ${{ matrix.bin }} --test
 
+      - name: Prepare artifact
+        run: |
+          Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
+
       - name: Upload artifact
         uses: ./.github/actions/upload-artifact
         with: