2020-01-23 15:01:52 +00:00
|
|
|
name: Build
|
|
|
|
|
2020-06-30 23:50:40 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
2023-07-14 10:54:16 +00:00
|
|
|
- gh-readonly-queue/**
|
2020-06-30 23:50:40 +00:00
|
|
|
pull_request:
|
2023-07-14 09:46:22 +00:00
|
|
|
merge_group:
|
2020-01-23 15:01:52 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-cmake:
|
|
|
|
runs-on: ${{ matrix.os }}
|
2023-09-12 19:22:17 +00:00
|
|
|
env:
|
|
|
|
CARGO_HTTP_MULTIPLEXING: false
|
2020-01-23 15:01:52 +00:00
|
|
|
strategy:
|
2020-04-10 19:01:39 +00:00
|
|
|
fail-fast: false
|
2020-01-23 15:01:52 +00:00
|
|
|
matrix:
|
2022-03-20 17:04:00 +00:00
|
|
|
os: [ubuntu-latest, macOS-latest, windows-latest, ubuntu-20.04]
|
2020-01-23 15:01:52 +00:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
2022-02-14 21:34:43 +00:00
|
|
|
cmake-args: -G Ninja
|
2022-07-11 18:16:42 +00:00
|
|
|
cmake-init-env: CXXFLAGS=-Werror
|
2021-12-12 10:40:39 +00:00
|
|
|
package-file: "*-linux_x86_64.tar.xz"
|
2020-05-16 23:04:49 +00:00
|
|
|
fancy: true
|
2022-03-20 17:04:00 +00:00
|
|
|
- os: ubuntu-20.04
|
2020-01-23 15:01:52 +00:00
|
|
|
cmake-path: /usr/bin/
|
2022-03-23 22:20:56 +00:00
|
|
|
cmake-args: -G Ninja -DTEST_MYSQL=ON
|
2022-07-11 18:16:42 +00:00
|
|
|
cmake-init-env: CXXFLAGS=-Werror
|
2022-10-19 21:46:06 +00:00
|
|
|
gtest-env: GTEST_FILTER=-*SQLite*
|
2021-12-12 10:40:39 +00:00
|
|
|
package-file: "*-linux_x86_64.tar.xz"
|
2020-05-16 23:04:49 +00:00
|
|
|
fancy: false
|
2020-01-23 15:01:52 +00:00
|
|
|
- os: macOS-latest
|
2022-02-14 21:34:43 +00:00
|
|
|
cmake-args: -G Ninja
|
2022-07-11 18:16:42 +00:00
|
|
|
cmake-init-env: CXXFLAGS=-Werror
|
2021-12-12 10:40:39 +00:00
|
|
|
package-file: "*-macos.dmg"
|
2020-05-16 23:04:49 +00:00
|
|
|
fancy: false
|
2020-01-23 15:01:52 +00:00
|
|
|
- os: windows-latest
|
2022-02-06 12:29:06 +00:00
|
|
|
cmake-args: -A x64
|
2022-07-11 18:16:42 +00:00
|
|
|
cmake-init-env: CXXFLAGS=/WX LDFLAGS=/WX
|
2021-12-12 10:40:39 +00:00
|
|
|
package-file: "*-win64.zip"
|
2020-05-16 23:04:49 +00:00
|
|
|
fancy: false
|
2020-01-23 15:01:52 +00:00
|
|
|
|
|
|
|
steps:
|
2022-10-25 11:50:49 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-09-19 19:16:10 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
2020-01-23 15:01:52 +00:00
|
|
|
|
|
|
|
- name: Prepare Linux
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -y
|
2023-02-17 21:58:22 +00:00
|
|
|
# mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-... does not exist.
|
|
|
|
# sudo apt-get upgrade -y
|
2022-09-25 10:17:44 +00:00
|
|
|
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 -y
|
2020-01-23 15:01:52 +00:00
|
|
|
|
2022-03-23 22:20:56 +00:00
|
|
|
- name: Prepare Linux (non-fancy)
|
|
|
|
if: ${{ contains(matrix.os, 'ubuntu') && !matrix.fancy }}
|
|
|
|
run: |
|
2023-12-01 16:15:27 +00:00
|
|
|
# Our minimum supported Rust version (MSRV)
|
|
|
|
rustup default 1.63.0
|
2022-03-23 22:20:56 +00:00
|
|
|
sudo rm -rf /var/lib/mysql/ /var/run/mysqld
|
|
|
|
sudo mkdir /var/lib/mysql/ /var/run/mysqld/
|
|
|
|
sudo chown mysql:mysql /var/lib/mysql/ /var/run/mysqld/
|
|
|
|
sudo mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir=/var/lib/mysql/
|
|
|
|
sudo /usr/bin/mysqld_safe --basedir=/usr --datadir='/var/lib/mysql/' &
|
|
|
|
sleep 10
|
|
|
|
sudo mysql <<EOF
|
|
|
|
CREATE DATABASE ddnet;
|
|
|
|
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
|
|
|
|
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
EOF
|
|
|
|
|
2020-05-16 23:04:49 +00:00
|
|
|
- name: Prepare Linux (fancy)
|
|
|
|
if: contains(matrix.os, 'ubuntu') && matrix.fancy
|
|
|
|
run: |
|
2022-12-01 21:40:29 +00:00
|
|
|
sudo apt-get install libmariadb-dev libwebsockets-dev mariadb-server -y
|
|
|
|
sudo systemctl stop mysql
|
2021-11-28 00:41:10 +00:00
|
|
|
sudo rm -rf /var/lib/mysql/
|
|
|
|
sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql/
|
2022-03-23 22:20:56 +00:00
|
|
|
cd /usr; sudo mysqld_safe --datadir='/var/lib/mysql/' --no-watch
|
2021-11-28 00:41:10 +00:00
|
|
|
sleep 10
|
2022-03-23 22:20:56 +00:00
|
|
|
sudo mysql <<EOF
|
2021-11-28 00:41:10 +00:00
|
|
|
CREATE DATABASE ddnet;
|
|
|
|
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
|
|
|
|
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
EOF
|
2020-05-16 23:04:49 +00:00
|
|
|
|
2021-07-08 07:08:08 +00:00
|
|
|
- name: Prepare macOS
|
2020-01-23 15:01:52 +00:00
|
|
|
if: contains(matrix.os, 'macOS')
|
|
|
|
run: |
|
2020-09-29 17:16:23 +00:00
|
|
|
brew update || true
|
2022-12-24 23:44:21 +00:00
|
|
|
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools || true
|
2022-12-16 15:38:14 +00:00
|
|
|
# --overwrite for: Target /usr/local/bin/2to3 already exists.
|
2023-11-23 12:20:28 +00:00
|
|
|
brew link --overwrite python@3.11
|
2020-06-24 09:51:32 +00:00
|
|
|
brew upgrade freetype
|
2021-12-25 21:37:11 +00:00
|
|
|
pip3 install dmgbuild
|
2022-11-03 21:53:23 +00:00
|
|
|
echo /Library/Frameworks/Python.framework/Versions/3.11/bin >> $GITHUB_PATH
|
2020-05-01 08:31:30 +00:00
|
|
|
sudo rm -rf /Library/Developer/CommandLineTools
|
2020-01-23 15:01:52 +00:00
|
|
|
|
2023-08-23 15:35:28 +00:00
|
|
|
- name: Cache Rust dependencies
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
|
2020-01-23 15:01:52 +00:00
|
|
|
- name: Build in debug mode
|
|
|
|
run: |
|
|
|
|
mkdir debug
|
|
|
|
cd debug
|
2022-07-11 18:16:42 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
|
2021-04-07 16:07:44 +00:00
|
|
|
${{ matrix.cmake-path }}cmake --build . --config Debug --target everything ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2020-01-23 15:01:52 +00:00
|
|
|
- name: Test debug
|
|
|
|
run: |
|
|
|
|
cd debug
|
2022-10-19 21:46:06 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.gtest-env }} ${{ matrix.cmake-path }}cmake --build . --config Debug --target run_tests ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2022-01-30 23:07:48 +00:00
|
|
|
- name: Run debug server
|
|
|
|
run: |
|
|
|
|
cd debug
|
2020-01-23 15:01:52 +00:00
|
|
|
./DDNet-Server shutdown
|
|
|
|
|
|
|
|
- name: Build in release mode
|
|
|
|
run: |
|
|
|
|
mkdir release
|
|
|
|
cd release
|
2022-07-11 18:16:42 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -Werror=dev -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
|
2021-04-07 16:07:44 +00:00
|
|
|
${{ matrix.cmake-path }}cmake --build . --config Release --target everything ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2020-01-23 15:01:52 +00:00
|
|
|
- name: Test release
|
|
|
|
run: |
|
|
|
|
cd release
|
2022-10-19 21:46:06 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.gtest-env }} ${{ matrix.cmake-path }}cmake --build . --config Release --target run_tests ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2022-01-30 23:07:48 +00:00
|
|
|
- name: Run release server
|
|
|
|
run: |
|
|
|
|
cd release
|
2020-01-23 15:01:52 +00:00
|
|
|
./DDNet-Server shutdown
|
|
|
|
|
2021-09-30 09:48:44 +00:00
|
|
|
- name: Build headless client
|
2022-09-25 10:17:44 +00:00
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
2021-09-30 09:48:44 +00:00
|
|
|
run: |
|
|
|
|
mkdir headless
|
|
|
|
cd headless
|
|
|
|
${{ matrix.cmake-path }}cmake --version
|
2023-01-13 16:19:13 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env CXXFLAGS="--coverage -Werror" ${{ matrix.cmake-path }}cmake -E env LDFLAGS="--coverage -Werror" ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DHEADLESS_CLIENT=ON -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
|
|
|
|
${{ matrix.cmake-path }}cmake -E env RUSTFLAGS="-Clink-arg=--coverage" ${{ matrix.cmake-path }}cmake --build . --config Debug ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
|
|
|
- name: Test headless client (unit tests)
|
2022-09-25 10:17:44 +00:00
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
2021-09-30 09:48:44 +00:00
|
|
|
run: |
|
|
|
|
cd headless
|
2023-01-13 16:19:13 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env RUSTFLAGS="-Clink-arg=--coverage" RUSTDOCFLAGS="-Clink-arg=--coverage" ${{ matrix.cmake-path }}cmake --build . --config Debug --target run_tests ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
|
|
|
- name: Upload Codecov report (unit tests)
|
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
gcov: true
|
|
|
|
gcov_include: src
|
|
|
|
flags: unittests
|
|
|
|
|
|
|
|
- name: Test headless client (start & connect)
|
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
|
|
|
run: |
|
|
|
|
cd headless
|
|
|
|
# Remove old coverage data:
|
|
|
|
find . -name '*.gcno' -o -name '*.gcda' -delete
|
2021-09-30 09:48:44 +00:00
|
|
|
./DDNet-Server &
|
|
|
|
./DDNet "cl_download_skins 0;connect localhost:8303;quit"
|
|
|
|
|
2022-10-01 12:31:18 +00:00
|
|
|
- name: Upload Codecov report (start & connect)
|
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
gcov: true
|
|
|
|
gcov_include: src
|
|
|
|
flags: startconnect
|
|
|
|
|
2020-05-16 23:04:49 +00:00
|
|
|
- name: Build in release mode with debug info and all features on
|
|
|
|
if: matrix.fancy
|
|
|
|
run: |
|
|
|
|
mkdir fancy
|
|
|
|
cd fancy
|
2022-07-11 18:16:42 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. -DANTIBOT=ON -DWEBSOCKETS=ON ..
|
2021-04-07 16:07:44 +00:00
|
|
|
${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target everything ${{ matrix.build-args }}
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2020-05-16 23:04:49 +00:00
|
|
|
- name: Test fancy
|
|
|
|
if: matrix.fancy
|
|
|
|
run: |
|
2021-11-28 15:05:57 +00:00
|
|
|
cd fancy
|
2022-10-19 21:46:06 +00:00
|
|
|
${{ matrix.cmake-path }}cmake -E env ${{ matrix.gtest-env }} ${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target run_tests ${{ matrix.build-args }}
|
2022-05-26 12:28:55 +00:00
|
|
|
|
2022-01-30 23:07:48 +00:00
|
|
|
- name: Run fancy server
|
|
|
|
if: matrix.fancy
|
|
|
|
run: |
|
|
|
|
cd fancy
|
2020-05-16 23:04:49 +00:00
|
|
|
./DDNet-Server shutdown
|
|
|
|
|
2022-05-26 12:28:55 +00:00
|
|
|
- name: Run integration tests with Valgrind's Memcheck
|
2022-09-25 10:17:44 +00:00
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
2022-05-26 12:28:55 +00:00
|
|
|
run: |
|
2022-06-06 09:55:30 +00:00
|
|
|
cd headless
|
2022-10-01 12:31:18 +00:00
|
|
|
# Remove old coverage data:
|
|
|
|
find . -name '*.gcno' -o -name '*.gcda' -delete
|
2022-06-06 09:55:30 +00:00
|
|
|
./integration_test.sh --valgrind-memcheck
|
2022-05-26 12:28:55 +00:00
|
|
|
|
2022-10-01 12:31:18 +00:00
|
|
|
- name: Upload Codecov report (integration tests)
|
|
|
|
if: contains(matrix.os, 'ubuntu-latest')
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
gcov: true
|
|
|
|
gcov_include: src
|
2023-01-13 16:19:13 +00:00
|
|
|
flags: integrationtests
|
2022-10-01 12:31:18 +00:00
|
|
|
|
2020-01-23 15:01:52 +00:00
|
|
|
- name: Package
|
|
|
|
run: |
|
|
|
|
cd release
|
2021-04-07 16:07:44 +00:00
|
|
|
${{ matrix.cmake-path }}cmake --build . --config Release --target package_default ${{ matrix.build-args }}
|
2020-01-23 15:01:52 +00:00
|
|
|
mkdir artifacts
|
|
|
|
mv ${{ matrix.package-file }} artifacts
|
|
|
|
|
|
|
|
- name: Upload Artifacts
|
2022-10-25 11:50:49 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-01-23 15:01:52 +00:00
|
|
|
with:
|
|
|
|
name: ddnet-${{ matrix.os }}
|
|
|
|
path: release/artifacts
|
2022-09-25 10:17:44 +00:00
|
|
|
|