Version 0.0.8 #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Binary Files | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build-mac: | |
| if: startsWith(github.ref, 'refs/heads/ci/prebuilt-') == false | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install system libraries (OpenSSL, Opus, libsrtp) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew update | |
| brew install openssl@3 opus libsrtp pkg-config ninja cmake | |
| - name: Clone dependencies (no submodules) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p deps | |
| if [[ ! -d deps/re ]]; then git clone --depth=1 https://github.com/baresip/re.git deps/re; fi | |
| if [[ ! -d deps/baresip ]]; then git clone --depth=1 https://github.com/baresip/baresip.git deps/baresip; fi | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build libre (re) static and stage SDK | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ROOT="$GITHUB_WORKSPACE" | |
| OPENSSL_PREFIX=$(brew --prefix openssl@3 || echo "/opt/homebrew/opt/openssl@3") | |
| cd "$ROOT/deps/re" | |
| rm -rf build | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_PREFIX" | |
| cmake --build build -j | |
| mkdir -p "$ROOT/local/re/lib" "$ROOT/local/re/include" | |
| if [[ -f build/libre.a ]]; then cp -a build/libre.a "$ROOT/local/re/lib/"; \ | |
| elif [[ -f build/lib/libre.a ]]; then cp -a build/lib/libre.a "$ROOT/local/re/lib/"; \ | |
| else echo "libre.a not found" >&2; exit 1; fi | |
| cp -a include/* "$ROOT/local/re/include/" | |
| - name: Build baresip static and stage SDK | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ROOT="$GITHUB_WORKSPACE" | |
| OPENSSL_PREFIX=$(brew --prefix openssl@3 || echo "/opt/homebrew/opt/openssl@3") | |
| cd "$ROOT/deps/baresip" | |
| rm -rf build | |
| cmake -B build -DSTATIC=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_PREFIX" | |
| cmake --build build -j | |
| mkdir -p "$ROOT/local/baresip/lib" "$ROOT/local/baresip/include" | |
| if [[ -f build/libbaresip.a ]]; then cp -a build/libbaresip.a "$ROOT/local/baresip/lib/"; \ | |
| elif [[ -f build/lib/libbaresip.a ]]; then cp -a build/lib/libbaresip.a "$ROOT/local/baresip/lib/"; \ | |
| else echo "libbaresip.a not found" >&2; exit 1; fi | |
| cp -a include/* "$ROOT/local/baresip/include/" | |
| - name: Build Node addon (cmake-js) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| rm -rf build | |
| npx cmake-js rebuild | |
| - name: Stage prebuilt binary | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PLATFORM=$(node -p "process.platform") | |
| ARCH=$(node -p "process.arch") | |
| ABI="node-v$(node -p 'process.versions.modules')" | |
| OUTDIR="prebuilt/${PLATFORM}-${ARCH}/${ABI}" | |
| mkdir -p "$OUTDIR" | |
| cp -a build/Release/baresip_node.node "$OUTDIR/" | |
| - name: Clean build artifacts (keep prebuilt) | |
| run: rm -rf build | |
| - name: Compute Node ABI | |
| id: vars | |
| shell: bash | |
| run: echo "abi=node-v$(node -p 'process.versions.modules')" >> "$GITHUB_OUTPUT" | |
| - name: Create PR with prebuilt binaries | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: "chore: update prebuilt (darwin-arm64 ${{ steps.vars.outputs.abi }})" | |
| title: "Update prebuilt binaries (darwin-arm64, ${{ steps.vars.outputs.abi }})" | |
| body: | | |
| Auto-generated by GitHub Actions. | |
| Includes prebuilt binaries for darwin-arm64 with Node ABI ${{ steps.vars.outputs.abi }}. | |
| branch: "ci/prebuilt-darwin-arm64-${{ steps.vars.outputs.abi }}" | |
| add-paths: | | |
| prebuilt/** |