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: environment:
CMAKE_SYSTEM_VERSION: 10.0.17134.0 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 PACKAGE_PREFIX: obs-stream-effects
INNOSETUP_URL: http://www.jrsoftware.org/download.php/is.exe INNOSETUP_URL: http://www.jrsoftware.org/download.php/is.exe
CURL_VERSION: 7.39.0 CURL_VERSION: 7.39.0
@ -42,6 +44,7 @@ build_script:
- cmd: node ci/builder.js - cmd: node ci/builder.js
after_build: after_build:
- cmd: node ci/packager.js
- cmd: ci/appveyor-package.bat - cmd: ci/appveyor-package.bat
# Testing # Testing

View File

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