提交 64031496 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi

Add CI with Windows

上级 87b0ee24
......@@ -28,10 +28,16 @@ jobs:
cxx: clang++
# macOS 11 is in private preview currently.
# - os: macos-11.0
# Windows needs to be tuned before it can run, I didn't bother, feel
# free to contribute.
# - os: windows-2019
# Just 1 Node.js version should be fine for C++.
- os: windows-2019
cc: gcc
cxx: g++
- os: windows-2019
cc: clang
cxx: clang++
- os: windows-2019
cc: cl
cxx: cl
# A single Node.js version should be fine for C++.
node:
- 14
......@@ -42,9 +48,34 @@ jobs:
CXX: ${{ matrix.build.cxx }}
steps:
- name: Add MSVC compiler
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows' && matrix.build.cc == 'cl'
# This is needed as a workaround for GNU linker being first in PATH and thus preventing Meson from finding MSVC
# linker.
- name: Remove GNU linker for MSVC
shell: bash
run: rm /usr/bin/link
if: runner.os == 'Windows' && matrix.build.cc == 'cl'
# Clang is in MSYS2's bin directory, but adding it to PATH breaks a lot of stuff, so let's just fix paths.
- name: Specify full path to Clang on Windows
run: |
echo "CC=C:\msys64\mingw64\bin\${env:CC}" >> $env:GITHUB_ENV
echo "CXX=C:\msys64\mingw64\bin\${env:CXX}" >> $env:GITHUB_ENV
if: runner.os == 'Windows' && matrix.build.cc == 'clang'
- name: Checkout
uses: actions/checkout@v2
- run: npm run install-clang-tools
# TODO: Maybe fix this one day
if: runner.os != 'Windows'
- run: npm run lint:worker
# TODO: Maybe fix this one day
if: runner.os != 'Windows'
- name: Node.js
uses: actions/setup-node@v2
with:
......@@ -59,7 +90,8 @@ jobs:
restore-keys: |
${{ matrix.build.os }}-node-${{matrix.build.cc}}-
- run: npm install
- run: npm run install-clang-tools
- run: npm run lint:worker
- run: npm run postinstall
- run: npm run test:worker
# All compilers on Windows can build everything, but tests fail to run on GCC/Clang with "Error -1073741511",
# remove condition below if you fixed it.
if: runner.os != 'Windows' || matrix.build.cc == 'cl'
......@@ -19,8 +19,6 @@
# Mac Stuff.
.DS_Store
# Python generated stuff in Windows.
/worker/scripts/configure.pyc
# worker scripts node-modules.
/worker/scripts/node_modules/
......
......@@ -11,20 +11,6 @@ const task = process.argv.slice(2).join(' ');
// mediasoup mayor version.
const MAYOR_VERSION = 3;
// Just for Windows.
let PYTHON;
let MSBUILD;
let MEDIASOUP_BUILDTYPE;
let MEDIASOUP_TEST_TAGS;
if (isWindows)
{
PYTHON = process.env.PYTHON || 'python';
MSBUILD = process.env.MSBUILD || 'MSBuild';
MEDIASOUP_BUILDTYPE = process.env.MEDIASOUP_BUILDTYPE || 'Release';
MEDIASOUP_TEST_TAGS = process.env.MEDIASOUP_TEST_TAGS || '';
}
let MAKE;
if (isFreeBSD)
......@@ -119,17 +105,7 @@ switch (task)
case 'test:worker':
{
if (!isWindows)
{
execute(`${MAKE} test -C worker`);
}
else if (!process.env.MEDIASOUP_WORKER_BIN)
{
execute(`${PYTHON} ./worker/scripts/configure.py --format=msvs -R mediasoup-worker-test`);
execute(`${MSBUILD} ./worker/mediasoup-worker.sln /p:Configuration=${MEDIASOUP_BUILDTYPE}`);
execute(`cd worker && .\\out\\${MEDIASOUP_BUILDTYPE}\\mediasoup-worker-test.exe --invisibles --use-colour=yes ${MEDIASOUP_TEST_TAGS}`);
}
execute(`${MAKE} test -C worker`);
break;
}
......@@ -146,15 +122,7 @@ switch (task)
{
if (!process.env.MEDIASOUP_WORKER_BIN)
{
if (!isWindows)
{
execute(`${MAKE} -C worker`);
}
else
{
execute(`${PYTHON} ./worker/scripts/configure.py --format=msvs -R mediasoup-worker`);
execute(`${MSBUILD} ./worker/mediasoup-worker.sln /p:Configuration=${MEDIASOUP_BUILDTYPE}`);
}
execute(`${MAKE} -C worker`);
}
break;
......
......@@ -15,11 +15,16 @@ PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
MESON ?= $(PIP_DIR)/bin/meson
MESON_ARGS ?= ""
# Disable `*.pyc` files creation
# Disable `*.pyc` files creation.
export PYTHONDONTWRITEBYTECODE = 1
# Instruct `meson` where to look for ninja binary
export NINJA = $(PIP_DIR)/bin/ninja
# Instruct Python where to look for modules it needs, such that `meson` actually runs from installed location
# Instruct `meson` where to look for ninja binary.
ifeq ($(OS),Windows_NT)
# Windows is, of course, special.
export NINJA = $(PIP_DIR)/bin/ninja.exe
else
export NINJA = $(PIP_DIR)/bin/ninja
endif
# Instruct Python where to look for modules it needs, such that `meson` actually runs from installed location.
export PYTHONPATH = $(PIP_DIR)
.PHONY: \
......@@ -35,7 +40,7 @@ ifeq ($(wildcard $(PIP_DIR)),)
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
$(PYTHON) -m pip install --system --target=$(PIP_DIR) pip setuptools || \
$(PYTHON) -m pip install --target=$(PIP_DIR) pip setuptools
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation.
$(PYTHON) -m pip install --upgrade --target=$(PIP_DIR) meson ninja
endif
......@@ -75,9 +80,14 @@ format:
test: setup
ifeq ($(MEDIASOUP_WORKER_BIN),)
$(MESON) compile -j $(CORES) -C $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE) mediasoup-worker-test
# On Windows lcov doesn't work (at least not yet) and we need to add `.exe` to the binary path.
ifeq ($(OS),Windows_NT)
./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test.exe --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
else
$(LCOV) --directory ./ --zerocounters
./$(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/mediasoup-worker-test --invisibles --use-colour=yes $(MEDIASOUP_TEST_TAGS)
endif
endif
tidy:
$(PYTHON) ./scripts/clang-tidy.py \
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论