Ver Fonte

CI: Update Ubuntu runners to 24.04, but keep 22.04 for Linux builds

Pin clang-format to version 16, and black to 24.10.0.
Keep using Ubuntu 22.04 for Linux builds for portability.

(cherry picked from commit fd9bd108af6388ecc6b1668a98612b75fc0d3bad)
Rémi Verschelde há 8 meses atrás
pai
commit
292b2dbce7

+ 3 - 10
.github/workflows/android_builds.yml

@@ -14,24 +14,17 @@ concurrency:
 
 
 jobs:
 jobs:
   android-template:
   android-template:
-    runs-on: "ubuntu-20.04"
+    runs-on: "ubuntu-24.04"
     name: Template (target=release, tools=no)
     name: Template (target=release, tools=no)
 
 
     steps:
     steps:
       - uses: actions/checkout@v4
       - uses: actions/checkout@v4
 
 
-      # Azure repositories are not reliable, we need to prevent azure giving us packages.
-      - name: Make apt sources.list use the default Ubuntu repositories
-        run: |
-          sudo rm -f /etc/apt/sources.list.d/*
-          sudo cp -f misc/ci/sources.list /etc/apt/sources.list
-          sudo apt-get update
-
-      - name: Set up Java 11
+      - name: Set up Java 17
         uses: actions/setup-java@v4
         uses: actions/setup-java@v4
         with:
         with:
           distribution: temurin
           distribution: temurin
-          java-version: 11
+          java-version: 17
 
 
       - name: Setup Godot build cache
       - name: Setup Godot build cache
         uses: ./.github/actions/godot-cache
         uses: ./.github/actions/godot-cache

+ 1 - 1
.github/workflows/javascript_builds.yml

@@ -16,7 +16,7 @@ concurrency:
 
 
 jobs:
 jobs:
   javascript-template:
   javascript-template:
-    runs-on: "ubuntu-20.04"
+    runs-on: "ubuntu-24.04"
     name: Template (target=release, tools=no)
     name: Template (target=release, tools=no)
 
 
     steps:
     steps:

+ 4 - 4
.github/workflows/linux_builds.yml

@@ -14,7 +14,8 @@ concurrency:
 
 
 jobs:
 jobs:
   build-linux:
   build-linux:
-    runs-on: "ubuntu-20.04"
+    # Stay one LTS before latest to increase portability of Linux artifacts.
+    runs-on: "ubuntu-22.04"
     name: ${{ matrix.name }}
     name: ${{ matrix.name }}
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
@@ -54,9 +55,8 @@ jobs:
       - name: Linux dependencies
       - name: Linux dependencies
         shell: bash
         shell: bash
         run: |
         run: |
-          # Azure repositories are not reliable, we need to prevent azure giving us packages.
-          sudo rm -f /etc/apt/sources.list.d/*
-          sudo cp -f misc/ci/sources.list /etc/apt/sources.list
+          # Azure repositories are flaky, remove them.
+          sudo rm -f /etc/apt/sources.list.d/{azure,microsoft}*
           sudo apt-get update
           sudo apt-get update
           # The actual dependencies
           # The actual dependencies
           sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
           sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \

+ 8 - 8
.github/workflows/server_builds.yml

@@ -14,7 +14,8 @@ concurrency:
 
 
 jobs:
 jobs:
   build-server:
   build-server:
-    runs-on: "ubuntu-20.04"
+    # Stay one LTS before latest to increase portability of Linux artifacts.
+    runs-on: "ubuntu-22.04"
     name: ${{ matrix.name }}
     name: ${{ matrix.name }}
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
@@ -36,14 +37,13 @@ jobs:
       - name: Linux dependencies
       - name: Linux dependencies
         shell: bash
         shell: bash
         run: |
         run: |
-          # Azure repositories are not reliable, we need to prevent azure giving us packages.
-          sudo rm -f /etc/apt/sources.list.d/*
-          sudo cp -f misc/ci/sources.list /etc/apt/sources.list
+          # Azure repositories are flaky, remove them.
+          sudo rm -f /etc/apt/sources.list.d/{azure,microsoft}*
           sudo apt-get update
           sudo apt-get update
-          # The actual dependencies
-          sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
-              libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
-              libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip
+          # The actual dependencies.
+          sudo apt-get install --no-install-recommends build-essential pkg-config libx11-dev \
+              libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev \
+              libpulse-dev libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip
 
 
       - name: Setup Godot build cache
       - name: Setup Godot build cache
         uses: ./.github/actions/godot-cache
         uses: ./.github/actions/godot-cache

+ 7 - 13
.github/workflows/static_checks.yml

@@ -9,26 +9,20 @@ concurrency:
 jobs:
 jobs:
   static-checks:
   static-checks:
     name: Static Checks (clang-format, black format, file format, documentation checks)
     name: Static Checks (clang-format, black format, file format, documentation checks)
-    runs-on: ubuntu-20.04
+    runs-on: "ubuntu-24.04"
     steps:
     steps:
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@v4
         uses: actions/checkout@v4
 
 
-      # Azure repositories are not reliable, we need to prevent Azure giving us packages.
-      - name: Make apt sources.list use the default Ubuntu repositories
-        run: |
-          sudo rm -f /etc/apt/sources.list.d/*
-          sudo cp -f misc/ci/sources.list /etc/apt/sources.list
-          wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
-          sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main"
-          sudo apt-get update
-
       - name: Install dependencies
       - name: Install dependencies
         run: |
         run: |
-          sudo apt-get install -qq dos2unix clang-format-15 libxml2-utils python3-pip moreutils
+          # Azure repositories are flaky, remove them.
+          sudo rm -f /etc/apt/sources.list.d/{azure,microsoft}*
+          sudo apt-get update
+          sudo apt-get install -qq dos2unix libxml2-utils python3-pip moreutils
           sudo update-alternatives --remove-all clang-format || true
           sudo update-alternatives --remove-all clang-format || true
-          sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
-          sudo pip3 install black==22.3.0 pygments
+          sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-16 100
+          sudo pip3 install black==24.10.0 pygments
 
 
       - name: File formatting checks (file_format.sh)
       - name: File formatting checks (file_format.sh)
         run: |
         run: |

+ 4 - 3
core/io/http_client.cpp

@@ -713,15 +713,16 @@ PoolByteArray HTTPClient::read_response_body_chunk() {
 				chunk_left -= rec;
 				chunk_left -= rec;
 
 
 				if (chunk_left == 0) {
 				if (chunk_left == 0) {
-					if (chunk[chunk.size() - 2] != '\r' || chunk[chunk.size() - 1] != '\n') {
+					const int chunk_size = chunk.size();
+					if (chunk[chunk_size - 2] != '\r' || chunk[chunk_size - 1] != '\n') {
 						ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
 						ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
 						status = STATUS_CONNECTION_ERROR;
 						status = STATUS_CONNECTION_ERROR;
 						break;
 						break;
 					}
 					}
 
 
-					ret.resize(chunk.size() - 2);
+					ret.resize(chunk_size - 2);
 					PoolByteArray::Write w = ret.write();
 					PoolByteArray::Write w = ret.write();
-					memcpy(w.ptr(), chunk.ptr(), chunk.size() - 2);
+					memcpy(w.ptr(), chunk.ptr(), chunk_size - 2);
 					chunk.clear();
 					chunk.clear();
 				}
 				}
 
 

+ 19 - 1
core/io/packet_peer_udp.cpp

@@ -105,8 +105,21 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
 		return ERR_UNAVAILABLE;
 		return ERR_UNAVAILABLE;
 	}
 	}
 
 
+/* Bogus GCC warning here:
+ * In member function 'int RingBuffer<T>::read(T*, int, bool) [with T = unsigned char]',
+ *     inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:112:9,
+ *     inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:99:7:
+ * Error: ./core/ring_buffer.h:68:46: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ *   68 |                                 p_buf[dst++] = read[pos + i];
+ *      |                                 ~~~~~~~~~~~~~^~~~~~~
+ */
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wstringop-overflow=0"
+#endif
+
 	uint32_t size = 0;
 	uint32_t size = 0;
-	uint8_t ipv6[16];
+	uint8_t ipv6[16] = {};
 	rb.read(ipv6, 16, true);
 	rb.read(ipv6, 16, true);
 	packet_ip.set_ipv6(ipv6);
 	packet_ip.set_ipv6(ipv6);
 	rb.read((uint8_t *)&packet_port, 4, true);
 	rb.read((uint8_t *)&packet_port, 4, true);
@@ -115,6 +128,11 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
 	--queue_count;
 	--queue_count;
 	*r_buffer = packet_buffer;
 	*r_buffer = packet_buffer;
 	r_buffer_size = size;
 	r_buffer_size = size;
+
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
 	return OK;
 	return OK;
 }
 }
 
 

+ 2 - 2
core/io/stream_peer.cpp

@@ -213,12 +213,12 @@ void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) {
 }
 }
 
 
 uint8_t StreamPeer::get_u8() {
 uint8_t StreamPeer::get_u8() {
-	uint8_t buf[1];
+	uint8_t buf[1] = {};
 	get_data(buf, 1);
 	get_data(buf, 1);
 	return buf[0];
 	return buf[0];
 }
 }
 int8_t StreamPeer::get_8() {
 int8_t StreamPeer::get_8() {
-	uint8_t buf[1];
+	uint8_t buf[1] = {};
 	get_data(buf, 1);
 	get_data(buf, 1);
 	return buf[0];
 	return buf[0];
 }
 }

+ 1 - 0
doc/translations/extract.py

@@ -59,6 +59,7 @@ import sys
 sys.modules["_elementtree"] = None
 sys.modules["_elementtree"] = None
 import xml.etree.ElementTree as ET
 import xml.etree.ElementTree as ET
 
 
+
 ## override the parser to get the line number
 ## override the parser to get the line number
 class LineNumberingParser(ET.XMLParser):
 class LineNumberingParser(ET.XMLParser):
     def _start(self, *args, **kwargs):
     def _start(self, *args, **kwargs):

+ 1 - 0
editor/editor_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import os
 import os
 import os.path
 import os.path
 import shutil
 import shutil

+ 1 - 0
editor/icons/editor_icons_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import os
 import os
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 from compat import StringIO
 from compat import StringIO

+ 1 - 0
gles_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 import re
 import re
 
 

+ 1 - 0
main/main_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 from compat import byte_to_str
 from compat import byte_to_str
 from collections import OrderedDict
 from collections import OrderedDict

+ 1 - 0
modules/denoise/resource_to_cpp.py

@@ -19,6 +19,7 @@
 import os
 import os
 from array import array
 from array import array
 
 
+
 # Generates a C++ file from the specified binary resource file
 # Generates a C++ file from the specified binary resource file
 def generate(in_path, out_path):
 def generate(in_path, out_path):
 
 

+ 1 - 0
modules/gdnative/gdnative_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import json
 import json
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 
 

+ 1 - 0
platform/osx/platform_osx_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import os
 import os
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 
 

+ 1 - 0
platform/windows/platform_windows_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import os
 import os
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 
 

+ 1 - 0
platform/x11/platform_x11_builders.py

@@ -3,6 +3,7 @@
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 All such functions are invoked in a subprocess on Windows to prevent build flakiness.
 
 
 """
 """
+
 import os
 import os
 from platform_methods import subprocess_main
 from platform_methods import subprocess_main
 
 

+ 2 - 1
scene/2d/tile_map.cpp

@@ -1226,7 +1226,8 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) {
 	for (int i = 0; i < c; i += offset) {
 	for (int i = 0; i < c; i += offset) {
 		const uint8_t *ptr = (const uint8_t *)&r[i];
 		const uint8_t *ptr = (const uint8_t *)&r[i];
 		uint8_t local[12];
 		uint8_t local[12];
-		for (int j = 0; j < ((format == FORMAT_2) ? 12 : 8); j++) {
+		const int buffer_size = (format == FORMAT_2) ? 12 : 8;
+		for (int j = 0; j < buffer_size; j++) {
 			local[j] = ptr[j];
 			local[j] = ptr[j];
 		}
 		}
 
 

+ 2 - 2
servers/audio_server.h

@@ -208,9 +208,9 @@ private:
 
 
 		struct Effect {
 		struct Effect {
 			Ref<AudioEffect> effect;
 			Ref<AudioEffect> effect;
-			bool enabled;
+			bool enabled = false;
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
-			uint64_t prof_time;
+			uint64_t prof_time = 0;
 #endif
 #endif
 		};
 		};