Skip to content

Commit

Permalink
Switch from Travis to a GitHub Workflow
Browse files Browse the repository at this point in the history
- Upgrade from gmake to gmake2 (requires premake 5.0 alpha 12)
- Change instructions to indicate VS2019 instead of 2015
- Delete .travis.yml configuration
- Add a GitHub Workflow that checks out & runs tests
- Update README badge

ci.yml has a few improvements from the old Travis flow:
 - Targets Windows and MacOS in addition to Linux
 - Fetches libsodium from apt for faster builds
 - Runs on pull requests
 - Runs debug & release in parallel
  • Loading branch information
jorgenpt committed Nov 15, 2021
1 parent 8849a75 commit d6aee19
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 51 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,67 @@
name: CI

on: [push, pull_request]

jobs:
build_and_test:
name: Build & test

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
configuration: [release, debug]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@master
- name: Setup premake
uses: abel0b/setup-premake@v1

## Linux-specific build setup
# Install libsodium from apt
- name: Setup (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install libsodium-dev
## MacOS-specific build setup
# Install libsodium from homebrew
- name: Setup (MacOS)
if: runner.os == 'MacOS'
run: brew install libsodium

## Linux & MacOS-specific build steps
# Build with premake + make
- name: Build (gmake2)
if: runner.os != 'Windows'
run: |
premake5 gmake2
make clean
make all config=${{ matrix.configuration }}_x64
# Run the tests with sh syntax
- name: Test (gmake2)
if: runner.os != 'Windows'
run: ./bin/test

## Windows-specific build steps
# Set up PATH variables to point to MSBuild from at least VS 16.1 (2019)
- name: Setup (vs2019)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '16.1.0'

# Build with premake + msbuild
- name: Build (vs2019)
if: runner.os == 'Windows'
run: |
premake5 vs2019
msbuild netcode.sln -nologo -m -t:Clean -p:Configuration=${{ matrix.configuration }}
msbuild netcode.sln -nologo -m -p:Configuration=${{ matrix.configuration }}
# Run the tests with Powershell syntax
- name: Test (vs2019)
if: runner.os == 'Windows'
run: "& ./bin/x64/${{ matrix.configuration }}/test.exe"
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions BUILDING.md
Expand Up @@ -5,7 +5,7 @@ How to build netcode.io

Download [premake 5](https://premake.github.io/download.html) and copy the **premake5** executable somewhere in your path. Please make sure you have at least premake5 alpha 13.

You need Visual Studio to build the source code. If you don't have Visual Studio 2015 you can [download the community edition for free](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx).
You need Visual Studio to build the source code. If you don't have Visual Studio 2019 you can [download the community edition for free](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16).

Once you have Visual Studio installed, go to the command line under the netcode.io/c directory and type:

Expand All @@ -17,7 +17,7 @@ Now you can build the library and run individual test programs as you would for

## Building on MacOS and Linux

First, download and install [premake 5](https://premake.github.io/download.html) alpha 13 or greater.
First, download and install [premake 5](https://premake.github.io/download.html). Please make sure you have at least premake5 alpha 13.

Next, install libsodium.

Expand All @@ -29,7 +29,7 @@ On Linux, depending on your particular distribution there may be prebuilt packag

Now go to the command line under the netcode.io/c directory and enter:

premake5 gmake
premake5 gmake2

Which creates makefiles which you can use to build the source via:

Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
[![Travis Build Status](https://travis-ci.org/networkprotocol/netcode.io.svg?branch=master)](https://travis-ci.org/networkprotocol/netcode.io)
[![Build status](https://github.com/networkprotocol/netcode/workflows/CI/badge.svg)](https://github.com/networkprotocol/netcode/actions?query=workflow%3ACI)

# netcode

Expand Down
20 changes: 10 additions & 10 deletions premake5.lua
Expand Up @@ -33,7 +33,7 @@ solution "netcode"
optimize "Speed"
defines { "NETCODE_RELEASE" }
links { release_libs }
configuration { "gmake" }
configuration { "gmake2" }
linkoptions { "-lm" }

project "test"
Expand Down Expand Up @@ -63,7 +63,7 @@ if os.ishost "windows" then
trigger = "solution",
description = "Create and open the netcode.io solution",
execute = function ()
os.execute "premake5 vs2015"
os.execute "premake5 vs2019"
os.execute "start netcode.sln"
end
}
Expand All @@ -79,7 +79,7 @@ else
trigger = "test",
description = "Build and run all unit tests",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 test" then
os.execute "./bin/test"
end
Expand All @@ -91,7 +91,7 @@ else
trigger = "soak",
description = "Build and run soak test",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 soak" then
os.execute "./bin/soak"
end
Expand All @@ -103,7 +103,7 @@ else
trigger = "profile",
description = "Build and run profile tet",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 profile" then
os.execute "./bin/profile"
end
Expand All @@ -115,7 +115,7 @@ else
trigger = "client",
description = "Build and run the client",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 client" then
os.execute "./bin/client"
end
Expand All @@ -127,7 +127,7 @@ else
trigger = "server",
description = "Build and run the server",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 server" then
os.execute "./bin/server"
end
Expand All @@ -139,7 +139,7 @@ else
trigger = "client_server",
description = "Build and run the client/server testbed",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 client_server" then
os.execute "./bin/client_server"
end
Expand Down Expand Up @@ -170,7 +170,7 @@ else
trigger = "stress",
description = "Launch 256 client instances to stress test the server",
execute = function ()
os.execute "test ! -e Makefile && premake5 gmake"
os.execute "test ! -e Makefile && premake5 gmake2"
if os.execute "make -j32 client" then
for i = 0, 255 do
os.execute "./bin/client &"
Expand All @@ -193,7 +193,7 @@ else
trigger = "scan-build",
description = "Run clang scan-build over the project",
execute = function ()
os.execute "premake5 clean && premake5 gmake && scan-build make all -j32"
os.execute "premake5 clean && premake5 gmake2 && scan-build make all -j32"
end
}

Expand Down

0 comments on commit d6aee19

Please sign in to comment.