Skip to content

resolve alignment undefined behavior by enabling C++11 #308

resolve alignment undefined behavior by enabling C++11

resolve alignment undefined behavior by enabling C++11 #308

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build-cmake:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
cmake-args: -G Ninja
package-file: "*-linux_x86_64.tar.xz"
archtitecture: "x86_64"
shell: "bash"
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
- os: windows-latest
cmake-args: -G Ninja
package-file: "*-win64.7z"
archtitecture: "x86_64"
shell: "msys2"
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
LDFLAGS: -Werror
- os: macOS-latest
cmake-args: -G Ninja
package-file: "*-macos.dmg"
archtitecture: "arm64"
shell: "bash"
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
defaults:
run:
shell: ${{ matrix.shell }} {0}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Prepare MSYS2 (Windows)
if: contains(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
pacboy: >-
toolchain:p
cmake:p
ninja:p
zlib:p
sdl3:p
freetype:p
opus:p
opusfile:p
openssl:p
curl:p
- name: Checkout SDL3
if: contains(matrix.os, 'ubuntu')
uses: actions/checkout@v4
with:
repository: libsdl-org/SDL
ref: release-3.2.28
path: ./SDL
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install pkg-config ninja-build libfreetype6-dev libopus-dev libopusfile-dev libcurl4-openssl-dev libgl1-mesa-dev -y
sudo apt-get install build-essential git cmake libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev libdbus-1-dev libudev-dev libinput-dev libts-dev libjpeg-dev libwebp-dev -y
cd SDL
cmake . -DCMAKE_BUILD_TYPE=Release -DSDL_TEST=OFF -DSDL_STATIC=OFF
sudo make install
sudo ldconfig
- name: Prepare MacOS
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config sdl3 python3 ninja opus opusfile openssl curl || true
brew upgrade freetype
sudo rm -rf /Library/Developer/CommandLineTools
- name: Build in debug mode
env: ${{ matrix.env }}
run: |
mkdir debug
cd debug
cmake --version
cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
cmake --build . --config Debug --target everything
- name: Test debug
run: |
cd debug
cmake --build . --config Debug --target run_tests
- name: Run debug server
env: ${{ matrix.env }}
run: |
cd debug
./ArchiveServer shutdown
- name: Build in release mode
env: ${{ matrix.env }}
run: |
mkdir release
cd release
cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -Werror=dev -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
cmake --build . --config Release --target everything
- name: Test release
run: |
cd release
cmake --build . --config Release --target run_tests
- name: Run release server
env: ${{ matrix.env }}
run: |
cd release
./ArchiveServer shutdown
- name: Package
run: |
cd release
cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Releas -DMACOS_DO_INSTALL=ON -Werror=dev -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
cmake --build . --config Release --target everything
cpack -V
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: teeworlds-archive-${{ matrix.os }}
path: release/artifacts
- name: Download artifact for Release
uses: softprops/action-gh-release@v2
if: github.ref_type != 'tag' && github.event_name != 'pull_request' && github.ref_name == 'mods'
with:
tag_name: nightly
name: Nightly Build
files: release/artifacts/*
prerelease: true
build-bam:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
archtitecture: "x86_64"
shell: "bash"
- os: windows-latest
archtitecture: "x86_64"
shell: "msys2"
- os: macOS-latest
archtitecture: "arm64"
shell: "bash"
defaults:
run:
shell: ${{ matrix.shell }} {0}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Checkout bam
uses: actions/checkout@v4
with:
repository: matricks/bam
ref: a44a2c7dc16caae7ac457f17dfd14a87e7059c57
path: ./bam
- name: Checkout SDL3
if: contains(matrix.os, 'ubuntu')
uses: actions/checkout@v4
with:
repository: libsdl-org/SDL
ref: release-3.2.28
path: ./SDL
- name: Prepare MSYS2 (Windows)
if: contains(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
pacboy: >-
toolchain:p
cmake:p
ninja:p
zlib:p
sdl3:p
freetype:p
opus:p
opusfile:p
openssl:p
curl:p
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install libfreetype6-dev libopus-dev libopusfile-dev libcurl4-openssl-dev libgl1-mesa-dev -y
sudo apt-get install build-essential git cmake libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev libdbus-1-dev libudev-dev libinput-dev libts-dev libjpeg-dev libwebp-dev -y
cd bam
./make_unix.sh
cd ../SDL
cmake . -DCMAKE_BUILD_TYPE=Release
sudo make install
- name: Prepare Windows
if: contains(matrix.os, 'windows')
run: |
cd bam
./make_win64_msvc.bat
- name: Prepare MacOS
if: contains(matrix.os, 'macOS')
run: |
brew update
brew install sdl3 opus opusfile openssl curl || true
cd bam
./make_unix.sh
- name: Build in debug mode
run: ./bam/bam conf=debug all
- name: Test debug
run: ./build/${{ matrix.archtitecture }}/debug/ArchiveServer shutdown
- name: Build in release mode
run: ./bam/bam conf=release all
- name: Test release
run: ./build/${{ matrix.archtitecture }}/release/ArchiveServer shutdown