ci: Integrate Github Actions as a CI provider #2

Merged
Xaymar merged 1 commits from ci into master 2019-09-04 00:30:07 +02:00
5 changed files with 177 additions and 89 deletions
+34
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
+6
View File
@@ -7,11 +7,16 @@ matrix:
# Build Image & Environment # Build Image & Environment
platform: x64 platform: x64
# Build Tags only
skip_non_tags: true
image: image:
- Visual Studio 2017 - Visual Studio 2017
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-ffmpeg-encoder PACKAGE_PREFIX: obs-ffmpeg-encoder
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
@@ -32,6 +37,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
+74 -88
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
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);
}
)
-1
View File
@@ -18,7 +18,6 @@ class Runner {
run() { run() {
let self = this; let self = this;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
console.log(self.cmd, self.args);
self.proc = cp.spawn( self.proc = cp.spawn(
self.cmd, self.args, { self.cmd, self.args, {
windowsVerbatimArguments: true, windowsVerbatimArguments: true,