Skip to content

Commit

Permalink
Create fast-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jan 24, 2025
1 parent 0d606b5 commit 8385424
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 1 deletion.
93 changes: 93 additions & 0 deletions .github/workflows/fast-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Fast-Build

on:
push:
branches-ignore:
- gh-readonly-queue/**

jobs:
build-cmake:
runs-on: ${{ matrix.os }}
env:
CARGO_HTTP_MULTIPLEXING: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
include:
- os: ubuntu-latest
cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DDISCORD_DYNAMIC=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON
cmake-init-env: CXXFLAGS=
package-file: "*-linux_x86_64.tar.xz"
fancy: true
- os: macOS-latest
cmake-args: -G Ninja -DCMAKE_BUILD_TYPE=Release -DDISCORD=ON -DWEBSOCKETS=OFF -DPREFER_BUNDLED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_FIND_FRAMEWORK=NEVER
cmake-init-env: CXXFLAGS=
package-file: "*-macos.dmg"
fancy: false
- os: windows-latest
cmake-args: -A x64 -DDISCORD=ON
cmake-init-env: CXXFLAGS= LDFLAGS=
package-file: "*-win64.zip"
fancy: false
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
# mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-... does not exist.
# sudo apt-get upgrade -y
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr libglew-dev -y
- name: Prepare macOS
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config ninja molten-vk vulkan-headers glslang spirv-tools glew googletest molten-vk opusfile wavpack x264 || true
brew upgrade freetype
pip3 install --break-system-packages dmgbuild
echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH
- name: Add rust macOS
if: contains(matrix.os, 'macOS')
run: |
rustup default stable
rustup update
rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Build in release mode
env:
VERSION: ${{ secrets.VERSION }}
shell: bash
run: |
VERSION_FILE="$GITHUB_WORKSPACE/versioninfo.h"
printf '%s' "$VERSION" | base64 -d > "$VERSION_FILE"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
export MSYS_ARG_CONV_EXCL="/FI"
POST_FLAGS="-DCMAKE_CXX_FLAGS=\"/FI$VERSION_FILE\""
ENVFLAGS=""
else
ENVFLAGS="CXXFLAGS=-include$VERSION_FILE"
POST_FLAGS=""
fi
mkdir release
cd release
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} $ENVFLAGS ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} $POST_FLAGS -DCMAKE_BUILD_TYPE=Release -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }}
- name: Package
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }}
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ddnet-${{ matrix.os }}
path: release/artifacts
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ set(EXPECTED_DATA
skins7/xmas_hat.png
strong_weak.png
tclient/fonts/Cabin-Regular.ttf
tclient/fonts/FreeSansBold.ttf
tclient/fonts/GoogleSans-Regular.ttf
tclient/fonts/Inter_24pt-Regular.ttf
tclient/fonts/Inter_24pt-SemiBold.ttf
Expand Down
26 changes: 25 additions & 1 deletion src/engine/gfx/image_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,36 @@ static int PngliteIncompatibility(png_structp pPngStruct, png_infop pPngInfo)

return Result;
}
static void PngErrorHandler(png_structp png, png_const_charp msg);
static void PngWarningHandler(png_structp png, png_const_charp msg);
const char *pngCategory = "png"; // Category for logging
// Custom error handler (called on fatal errors)
static void PngErrorHandler(png_structp png, png_const_charp msg)
{
const char *category = static_cast<const char *>(png_get_error_ptr(png));
log_error(category, "libpng error: %s", msg);

// Jump back to the setjmp point - essential for libpng error handling
longjmp(png_jmpbuf(png), 1); // Changed from png_longjmp
}

// Custom warning handler (called on non-fatal warnings)
static void PngWarningHandler(png_structp png, png_const_charp msg)
{
const char *category = static_cast<const char *>(png_get_error_ptr(png));
log_error(category, "libpng warning: %s", msg);
}
bool CImageLoader::LoadPng(CByteBufferReader &Reader, const char *pContextName, CImageInfo &Image, int &PngliteIncompatible)
{
CUserErrorStruct UserErrorStruct = {&Reader, pContextName, {}};

png_structp pPngStruct = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
// Initialize structures with custom error handlers
png_structp pPngStruct = png_create_read_struct(
PNG_LIBPNG_VER_STRING,
(void *)pngCategory, // Pass category as error_ptr
PngErrorHandler,
PngWarningHandler);

if(pPngStruct == nullptr)
{
log_error("png", "libpng internal failure: png_create_read_struct failed.");
Expand Down
3 changes: 3 additions & 0 deletions src/game/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
extern const char *GIT_SHORTREV_HASH;
#define GAME_NAME "DDNet"
#define CLIENT_NAME "TClient"
#ifndef TCLIENT_VERSION
#define TCLIENT_VERSION "10.0.4"
#endif

#endif

0 comments on commit 8385424

Please sign in to comment.