Migrate to Github Actions

This commit is contained in:
Learath 2020-01-23 16:01:52 +01:00
parent a47a94ee0e
commit a9e3a4029a
4 changed files with 100 additions and 206 deletions

View file

@ -1,120 +0,0 @@
version: 2
defaults: &defaults
working_directory: ~/ddnet/ddnet
docker:
- image: buildpack-deps:stretch
defignore: &defignore
filters:
branches:
ignore:
- /.*\.tmp/
jobs:
pre_test:
<<: *defaults
parallelism: 1
steps:
- checkout
- run: python scripts/check_header_guards.py
build:
<<: *defaults
parallelism: 1
#environment:
#CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
#CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
steps:
- checkout
#- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run: git submodule update --init
- run: |
apt-get update
apt-get install -y build-essential \
python3 \
libcurl4-openssl-dev \
libfreetype6-dev \
libsdl2-dev \
libglew-dev \
libogg-dev \
libopus-dev \
libpnglite-dev \
libopusfile-dev \
libwavpack-dev \
libwebsockets-dev \
libmysqlcppconn-dev
apt-get install -y cmake xz-utils
# Compile
- run: python scripts/check_header_guards.py
- run: |
mkdir build
cd build
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DDOWNLOAD_GTEST=ON ..
make everything
make package_default
mkdir -p /tmp/artifacts
cp DDNet-*-linux_x86_64.tar.xz /tmp/artifacts
- run: |
mkdir noautoupdate
cd noautoupdate
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DAUTOUPDATE=OFF -DDOWNLOAD_GTEST=ON ..
make everything
- run: |
mkdir websockets
cd websockets
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DWEBSOCKETS=ON -DDOWNLOAD_GTEST=ON ..
make everything
- run: |
mkdir mysql
cd mysql
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DDMYSQL=ON -DDOWNLOAD_GTEST=ON ..
make everything
- run: |
mkdir bundled
cd bundled
env CFLAGS="-Wdeclaration-after-statement -Werror" CXXFLAGS="-Werror" cmake -DPREFER_BUNDLED_LIBS=ON -DDOWNLOAD_GTEST=ON ..
make everything
- store_artifacts:
path: /tmp/artifacts
- persist-to-workspace:
root: ./
paths: ./*
test:
<<: *defaults
steps:
- attach-workspace:
at: ./
- run: |
apt-get update
apt-get install -y make cmake xz-utils
- run: |
cd build
make run_tests
./DDNet-Server shutdown
- run: |
cd noautoupdate
make run_tests
workflows:
version: 2
build_and_test:
jobs:
- pre_test:
<<: *defignore
- build:
<<: *defignore
requires:
- pre_test
- test:
<<: *defignore
requires:
- build

100
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,100 @@
name: Build
on: [push, pull_request]
jobs:
build-cmake:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest, ubuntu-16.04]
include:
- os: ubuntu-latest
cmake-args: -G "Unix Makefiles"
build-args: --parallel
package-file: DDNet-Server-*-linux_x86_64.tar.xz
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: ubuntu-16.04
cmake-path: /usr/bin/
cmake-args: -G "Unix Makefiles"
package-file: DDNet-Server-*-linux_x86_64.tar.xz
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: macOS-latest
cmake-args: -G "Unix Makefiles"
build-args: --parallel
package-file: DDNet-Server-*-osx.dmg
env:
CFLAGS: -Wdeclaration-after-statement -Werror
CXXFLAGS: -Werror
- os: windows-latest
cmake-args: -G "Visual Studio 16 2019" -A x64
package-file: DDNet-Server-*-win64.zip
env:
CFLAGS: /WX
CXXFLAGS: /WX
LDFLAGS: /WX
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install pkg-config cmake libfreetype6-dev libsdl2-dev -y
- name: Prepare MacOS
if: contains(matrix.os, 'macOS')
run: |
brew update
brew install pkg-config freetype sdl2
- name: Build in debug mode
env: ${{ matrix.env }}
run: |
mkdir debug
cd debug
${{ matrix.cmake-path }}cmake --version
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
${{ matrix.cmake-path }}cmake --build . --config Debug ${{ matrix.build-args }} --target everything
- name: Test debug
run: |
cd debug
${{ matrix.cmake-path }}cmake --build . --config Debug ${{ matrix.build-args }} --target run_tests
./DDNet-Server shutdown
- name: Build in release mode
env: ${{ matrix.env }}
run: |
mkdir release
cd release
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -Werror=dev -DDOWNLOAD_GTEST=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
${{ matrix.cmake-path }}cmake --build . --config Release ${{ matrix.build-args }} --target everything
- name: Test release
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release ${{ matrix.build-args }} --target run_tests
./DDNet-Server shutdown
- name: Package
run: |
cd release
${{ matrix.cmake-path }}cmake --build . --config Release ${{ matrix.build-args }} --target package_default
mkdir artifacts
mv ${{ matrix.package-file }} artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: ddnet-${{ matrix.os }}
path: release/artifacts

View file

@ -1,35 +0,0 @@
language: c++
sudo: false
dist: trusty
os:
- linux
- osx
addons:
apt:
packages:
- libfreetype6-dev
- libgtest-dev
- libsdl2-dev
script:
- python scripts/check_header_guards.py
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then CMAKE_EXTRA_ARGS="-DDOWNLOAD_GTEST=ON -DDEV=ON"; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then CMAKE_EXTRA_ARGS="-DGTEST_LIBRARY=../gtest_build/libgtest.a -DGTEST_MAIN_LIBRARY=../gtest_build/libgtest_main.a"; mkdir gtest_build; cmake -E chdir gtest_build cmake /usr/src/gtest; cmake --build gtest_build; fi
- mkdir build; cd build
- cmake -Werror=dev -DCMAKE_INSTALL_PREFIX=/usr $CMAKE_EXTRA_ARGS ..
- make everything
- make run_tests
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then make DESTDIR=install install; test -x install/bin/DDNet; test -x install/bin/DDNet-Server; test -d install/bin/data; test -d install/usr/lib; fi
- make package_default
- cd ..; mkdir build_debug; cd build_debug
- cmake -Werror=dev -DCMAKE_BUILD_TYPE=Debug $CMAKE_EXTRA_ARGS ..
- make run_tests
- cd ..
- build/DDNet-Server shutdown
env:
global:
- CFLAGS="-Wdeclaration-after-statement -Werror"
- CXXFLAGS="-Werror"
branches:
except:
- staging.tmp
- testing.tmp

View file

@ -1,51 +0,0 @@
image: Visual Studio 2015
before_build:
- cmd: |
git submodule update --init
scripts\check_header_guards.py
md build32 & cd build32
cmake -Werror=dev -G "Visual Studio 14 2015" ..
cd ..
md build64 & cd build64
cmake -Werror=dev -G "Visual Studio 14 2015 Win64" ..
cd ..
build_script:
- cmd: cmake --build build32 --config Release --target everything
- cmd: cmake --build build64 --config Release --target everything
test_script:
- cmd: cmake --build build32 --config Debug --target run_tests
- cmd: cmake --build build64 --config Debug --target run_tests
- cmd: cmake --build build32 --config Release --target run_tests
- cmd: cmake --build build64 --config Release --target run_tests
- cmd: |
cd build32
Release\DDNet-Server shutdown
cd ..
- cmd: |
cd build64
Release\DDNet-Server shutdown
cd ..
after_build:
- cmd: cmake --build build32 --config Release --target package
- cmd: cmake --build build64 --config Release --target package
environment:
CFLAGS: /WX
CXXFLAGS: /WX
LDFLAGS: /WX
artifacts:
- path: build*/DDNet-*.zip
name: DDNet
branches:
except:
- staging.tmp
- testing.tmp