Skip to content

Commit

Permalink
prebuilt working
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed May 22, 2024
1 parent 376bdcf commit b559e4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 46 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/mediasoup-worker-prebuild.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: mediasoup-worker-prebuild

# Only trigger on GitHub releases.
# on:
# release:
# types: [published]

on: [pull_request, workflow_dispatch]
on:
release:
types: [published]

jobs:
ci:
Expand Down Expand Up @@ -69,5 +67,4 @@ jobs:
- name: Upload mediasoup-worker prebuilt binary
uses: softprops/action-gh-release@v1
with:
tag_name: addon-test-5
files: worker/prebuild/libmediasoup-worker-*.tgz
40 changes: 0 additions & 40 deletions npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -598,46 +598,6 @@ async function downloadPrebuiltWorker() {
`downloadPrebuiltWorker() | failed to give execution permissions to the mediasoup-worker prebuilt binary: ${error}`
);
}

// Let's confirm that the fetched mediasoup-worker prebuit binary does
// run in current host. This is to prevent weird issues related to
// different versions of libc in the system and so on.
// So run mediasoup-worker without the required MEDIASOUP_VERSION env and
// expect exit code 41 (see main.cpp).

logInfo(
'downloadPrebuiltWorker() | checking fetched mediasoup-worker prebuilt binary in current host'
);

try {
const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH);

// This will always fail on purpose, but if status code is 41 then
// it's good.
execSync(`"${resolvedBinPath}"`, {
stdio: ['ignore', 'ignore', 'ignore'],
// Ensure no env is passed to avoid accidents.
env: {},
});
} catch (error) {
if (error.status === 41) {
logInfo(
'downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host'
);

resolve(true);
} else {
logError(
`downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary fails to run in this host [status:${error.status}]`
);

try {
fs.unlinkSync(WORKER_RELEASE_BIN_PATH);
} catch (error2) {}

resolve(false);
}
}
})
.on('error', error => {
logError(
Expand Down

0 comments on commit b559e4d

Please sign in to comment.