ci: Integrate Github Actions as a CI Provider

Integrates Github Actions which is much much faster than AppVeyor in all areas, and even supports multiple workflows instead of forcing everything into just one workflow like AppVeyor does. Plus we get 20 parallel builds that nearly instantly finish, which results in much faster feedback without having to run our own Jenkins CI.

The builder and packager scripts have been adjusted to add support for both Windows and Linux, and both AppVeyor and Github Actions. Additionally to that, the builder script now correctly executes x32 and x64 steps in a chain, instead of waiting for the other architecture to finish first. This further reduces build times.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-09-03 21:18:14 +02:00 committed by Michael Fabian Dirks
parent 2b35328fcb
commit ebb518186d
4 changed files with 174 additions and 88 deletions

34
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: CI
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
os: [windows-2016, windows-2019]
include:
- os: windows-2016
generator_32: "Visual Studio 15 2017"
generator_64: "Visual Studio 15 2017 Win64"
sysversion: "10.0.17763.0"
- os: windows-2019
generator_32:
generator_64: "Visual Studio 16 2019"
sysversion: "10.0.18362.0"
runs-on: ${{ matrix.os }}
steps:
- name: Clone Repository
uses: actions/checkout@v1
- name: Update Submodules
run: git submodule update --init --force --recursive
- name: Install Node.JS 10.x
uses: actions/setup-node@v1
with:
node-version: 10
- name: Build
env:
CMAKE_GENERATOR_32: ${{ matrix.generator_32 }}
CMAKE_GENERATOR_64: ${{ matrix.generator_64 }}
CMAKE_SYSTEM_VERSION: ${{ matrix.sysversion }}
run: node ./ci/builder.js

View file

@ -12,6 +12,8 @@ image:
environment:
CMAKE_SYSTEM_VERSION: 10.0.17134.0
CMAKE_GENERATOR_32: "Visual Studio 15 2017"
CMAKE_GENERATOR_64: "Visual Studio 15 2017 Win64"
PACKAGE_PREFIX: obs-stream-effects
INNOSETUP_URL: http://www.jrsoftware.org/download.php/is.exe
CURL_VERSION: 7.39.0
@ -42,6 +44,7 @@ build_script:
- cmd: node ci/builder.js
after_build:
- cmd: node ci/packager.js
- cmd: ci/appveyor-package.bat
# Testing

View file

@ -2,108 +2,94 @@
const process = require('process');
const runner = require('./runner.js');
let env = process.env;
// Steps
let configure_runners = [];
let build_runners = [];
let package_runners = [];
let x32_steps = [];
let x64_steps = [];
{
let cmake_configure_extra = [
if ((process.platform == "win32") || (process.platform == "win64")) {
// Windows
let extra_conf = [
`-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`,
`-DCMAKE_PACKAGE_NAME=obs-stream-effects`,
'-DCMAKE_INSTALL_PREFIX="build/distrib/"',
'-DCMAKE_PACKAGE_PREFIX="build/"',
`-DCMAKE_PACKAGE_NAME="${process.env.PACKAGE_PREFIX}"`,
];
let cmake_build_extra = [
let extra_build = [
];
// Configuration depends on platform
if (process.platform == "win32" || process.platform == "win64") {
configure_runners.push(new runner('32-bit', 'cmake', [
if(process.env.APPVEYOR) {
extra_build.concat(['--', '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"']);
}
if ((process.env.CMAKE_GENERATOR_32 !== undefined) && (process.env.CMAKE_GENERATOR_32 !== "")) {
x32_steps.push(
[ 'cmake', [
'-H.',
'-Bbuild/32',
`-G"Visual Studio 15 2017"`,
].concat(cmake_configure_extra)));
configure_runners.push(new runner('64-bit', 'cmake', [
`-G"${process.env.CMAKE_GENERATOR_32}"`,
].concat(extra_conf), env ]
);
x32_steps.push(
[ 'cmake', [
'--build', 'build/32',
'--config', 'RelWithDebInfo',
'--target', 'INSTALL'
].concat(extra_build), env ]
);
}
if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) {
x64_steps.push(
[ 'cmake', [
'-H.',
'-Bbuild/64',
`-G"Visual Studio 15 2017 Win64"`,
'-T"host=x64"',
].concat(cmake_configure_extra)));
// Extra build steps for AppVeyor on Windows for Logging purposes.
if(process.env.APPVEYOR) {
cmake_build_extra.concat(['--', '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"']);
}
} else if (process.platform == "linux") {
configure_runners.push(new runner('32-bit', 'cmake', [
'-H.',
'-Bbuild32',
`-G"Unix Makefiles"`,
`-DCOPIED_DEPENDENCIES=false`,
].concat(cmake_configure_extra),
{ ...process.env, ...{
CFLAGS: `${process.env.COMPILER_FLAGS_32}`,
CXXFLAGS: `${process.env.COMPILER_FLAGS_32}`,
}}));
configure_runners.push(new runner('64-bit', 'cmake', [
'-H.',
'-Bbuild64',
`-G"Unix Makefiles"`,
`-DCOPIED_DEPENDENCIES=false`,
].concat(cmake_configure_extra),
{ ...process.env, ...{
CFLAGS: `${process.env.COMPILER_FLAGS_64}`,
CXXFLAGS: `${process.env.COMPILER_FLAGS_64}`,
}}));
`-G"${process.env.CMAKE_GENERATOR_64}"`,
'-T"host=x64"'
].concat(extra_conf), env ]
);
x64_steps.push(
[ 'cmake', [
'--build', 'build/64',
'--config', 'RelWithDebInfo',
'--target', 'INSTALL'
].concat(extra_build), env ]
);
}
build_runners.push(new runner('32-bit', 'cmake', [
'--build', 'build/32',
'--config', 'RelWithDebInfo',
'--target', 'INSTALL'
].concat(cmake_build_extra)));
build_runners.push(new runner('64-bit', 'cmake', [
'--build', 'build/64',
'--config', 'RelWithDebInfo',
'--target', 'INSTALL'
].concat(cmake_build_extra)));
package_runners.push(new runner('32-bit', 'cmake', [
'--build', 'build/32',
'--target', 'PACKAGE_7Z',
'--config', 'RelWithDebInfo'
].concat(cmake_build_extra)));
package_runners.push(new runner('64-bit', 'cmake', [
'--build', 'build/64',
'--target', 'PACKAGE_ZIP',
'--config', 'RelWithDebInfo'
].concat(cmake_build_extra)));
} else {
// Unix
}
// Run Configure steps.
let configure_promises = [];
for (let config of configure_runners) {
configure_promises.push(config.run());
}
Promise.all(configure_promises).then(function(result) {
let build_promises = [];
for (let build of build_runners) {
build_promises.push(build.run());
}
Promise.all(build_promises).then(function(result) {
let package_promises = [];
for (let pack of package_runners) {
package_promises.push(pack.run());
function runRunners(runnerArray, name) {
return new Promise(async (resolve, reject) => {
let local = runnerArray.reverse();
while (local.length > 0) {
try {
let task = local.pop();
let work = new runner(name, task[0], task[1], task[2]);
await work.run();
} catch (e) {
reject(e);
return;
}
}
Promise.all(package_promises).then(function(result) {
process.exit(result);
}).catch(function(result) {
process.exit(result);
});
}).catch(function(result) {
process.exit(result);
resolve(0);
});
}).catch(function(result) {
process.exit(result);
});
}
let promises = [];
promises.push(runRunners(x32_steps, "32-Bit"));
promises.push(runRunners(x64_steps, "64-Bit"));
Promise.all(promises).then(
res => {
process.exit(0);
},
err => {
console.log(err);
process.exit(1);
}
).catch(err => {
console.log(err);
process.exit(1);
})

63
ci/packager.js Normal file
View file

@ -0,0 +1,63 @@
"use strict";
const process = require('process');
const runner = require('./runner.js');
function runRunners(runnerArray, name) {
return new Promise(async (resolve, reject) => {
let local = runnerArray.reverse();
while (local.length > 0) {
let task = local.pop();
let work = new runner(name, task[0], task[1], task[2]);
await work.run();
}
resolve(0);
});
}
let env = process.env;
let steps = [];
if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) {
steps.push(
[ 'cmake', [
'--build', 'build/64',
'--config', 'RelWithDebInfo',
'--target', 'PACKAGE_7Z'
], env ]
);
steps.push(
[ 'cmake', [
'--build', 'build/64',
'--config', 'RelWithDebInfo',
'--target', 'PACKAGE_ZIP'
], env ]
);
} else if ((process.env.CMAKE_GENERATOR_32 !== undefined) && (process.env.CMAKE_GENERATOR_32 !== "")) {
steps.push(
[ 'cmake', [
'--build', 'build/32',
'--config', 'RelWithDebInfo',
'--target', 'PACKAGE_7Z'
], env ]
);
steps.push(
[ 'cmake', [
'--build', 'build/32',
'--config', 'RelWithDebInfo',
'--target', 'PACKAGE_ZIP'
], env ]
);
}
let promises = [];
promises.push(runRunners(steps, "32-Bit"));
Promise.all(promises).then(
res => {
process.exit(0);
},
err => {
console.log(err);
process.exit(1);
}
)