Skip to content

Commit

Permalink
Automate and publish prebuilt mediasoup-worker binaries (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed May 26, 2023
1 parent c977028 commit 6d0a4e1
Show file tree
Hide file tree
Showing 10 changed files with 1,277 additions and 302 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/mediasoup-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ jobs:
ci:
strategy:
matrix:
# Different Node versions on Ubuntu, the latest Node on other platforms.
ci:
- os: ubuntu-22.04
node: 16
- os: ubuntu-22.04
- os: ubuntu-20.04
node: 18
- os: ubuntu-22.04
node: 20
- os: macos-12
node: 18
- os: windows-2022
node: 18

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

env:
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/mediasoup-worker-prebuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: mediasoup-worker-prebuild

on:
push:
# Only trigger for production releases.
tags:
- "*.*.*"

# Only trigger when other workflows succeeded.
workflow_run:
workflows: [mediasoup-worker, mediasoup-node, mediasoup-rust]
types:
- completed

jobs:
ci:
strategy:
fail-fast: false
matrix:
build:
- os: ubuntu-22.04
cc: gcc
cxx: g++
- os: macos-12
cc: clang
cxx: clang++
- os: windows-2022
cc: cl
cxx: cl
node:
- 18

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

env:
CC: ${{ matrix.build.cc }}
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

# We need to install some NPM production deps for npm-scripts.js to work.
- run: npm ci --ignore-scripts --omit=dev
- run: npm run worker:build
# Publish prebuild binaries on tag.
- run: npm run worker:prebuild
- name: Upload mediasoup-worker prebuilt binary
uses: softprops/action-gh-release@v1
with:
files: worker/prebuild/mediasoup-worker-*.tgz
3 changes: 3 additions & 0 deletions .github/workflows/mediasoup-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
env:
CC: ${{ matrix.build.cc }}
CXX: ${{ matrix.build.cxx }}
MEDIASOUP_SKIP_WORKER_PREBUILT_DOWNLOAD: "true"

steps:
- name: Checkout
Expand All @@ -54,6 +55,8 @@ jobs:
with:
node-version: ${{ matrix.node }}

# We need to install some NPM production deps for npm-scripts.js to work.
- run: npm ci --ignore-scripts --omit=dev
- run: npm run install-clang-tools
# TODO: Maybe fix this one day.
if: runner.os != 'Windows'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Meson.
/worker/out
/worker/subprojects/*
!/worker/subprojects/*.wrap
!/worker/subprojects/.clang-tidy
Expand All @@ -14,8 +15,8 @@
/target

## Worker.
/worker/out
/worker/scripts/node_modules
/worker/prebuild
# Vistual Studio generated Stuff.
/worker/**/Debug
/worker/**/Release
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog


### NEXT

* Automate and publish prebuilt `mediasoup-worker` binaries ([PR #1087](https://github.com/versatica/mediasoup/pull/1087), thanks to @barlock for his work in ([PR #1083](https://github.com/versatica/mediasoup/pull/1083)).

### 3.11.26

* `Worker`: Fix NACK timer and avoid negative RTT ([PR #1082](https://github.com/versatica/mediasoup/pull/1082), thanks to o-u-p for his work in ([PR #1076](https://github.com/versatica/mediasoup/pull/1076)).
* `Worker`: Fix NACK timer and avoid negative RTT ([PR #1082](https://github.com/versatica/mediasoup/pull/1082), thanks to @o-u-p for his work in ([PR #1076](https://github.com/versatica/mediasoup/pull/1076)).


### 3.11.25
Expand Down
10 changes: 7 additions & 3 deletions doc/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Compiles mediasoup TypeScript code (`lib` folder) JavaScript, places it into the

Builds the `mediasoup-worker` binary. It invokes `make`below.

### `npm run worker:prebuild`

Creates a prebuilt of `mediasoup-worker` in the `worker/prebuild` folder.

### `npm run lint`

Runs both `npm run lint:node` and `npm run lint:worker`.
Expand Down Expand Up @@ -60,7 +64,7 @@ Installs clang tools needed for local development.

## Rust

The only special feature in Rust case is special environment variable `KEEP_BUILD_ARTIFACTS`, that when set to `1` will allow incremental recompilation of changed C++ sources during hacking on mediasoup.
The only special feature in Rust case is special environment variable `"KEEP_BUILD_ARTIFACTS", that when set to `1` will allow incremental recompilation of changed C++ sources during hacking on mediasoup.
It is not necessary for normal usage of mediasoup as a dependency.

## Makefile
Expand Down Expand Up @@ -132,7 +136,7 @@ MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js

Builds the `libmediasoup-worker` static library at `worker/out/Release/`.

`MEDIASOUP_MAX_CORES` and `MEDIASOUP_BUILDTYPE` environment variables from above still apply for static library build.
"MEDIASOUP_MAX_CORES"` and "MEDIASOUP_BUILDTYPE" environment variables from above still apply for static library build.

### `make xcode`

Expand Down Expand Up @@ -160,7 +164,7 @@ Runs [clang-tidy](http://clang.llvm.org/extra/clang-tidy/) and performs C++ code
* [PyYAML](https://pyyaml.org/) is required.
- In OSX install it with `brew install libyaml` and `sudo easy_install-X.Y pyyaml`.

`MEDIASOUP_TIDY_CHECKS` environment variable with a comma separated list of checks overrides the checks defined in `.clang-tidy` file.
"MEDIASOUP_TIDY_CHECKS" environment variable with a comma separated list of checks overrides the checks defined in `.clang-tidy` file.

### `make fuzzer`

Expand Down
13 changes: 9 additions & 4 deletions node/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const eslintConfig =
settings : {},
parserOptions :
{
ecmaVersion : 2018,
ecmaVersion : 2022,
sourceType : 'module',
ecmaFeatures :
{
impliedStrict : true
},
lib : [ 'es2018' ],
lib : [ 'es2022' ],
project : 'node/tsconfig.json'
},
globals :
Expand Down Expand Up @@ -78,7 +78,7 @@ const eslintConfig =
'max-len' : [ 2, 100,
{
tabWidth : 2,
comments : 84,
comments : 88,
ignoreUrls : true,
ignoreStrings : true,
ignoreTemplateLiterals : true,
Expand Down Expand Up @@ -166,7 +166,12 @@ const eslintConfig =
'prefer-rest-params' : 2,
'prefer-spread' : 2,
'prefer-template' : 2,
'quotes' : [ 2, 'single', { avoidEscape: true } ],
'quotes' : [ 2, 'single',
{
avoidEscape : true,
allowTemplateLiterals : true
}
],
'semi' : [ 2, 'always' ],
'semi-spacing' : 2,
'space-before-blocks' : 2,
Expand Down

0 comments on commit 6d0a4e1

Please sign in to comment.