From 4897a20ed0f8f88886f17709c2cbce0d9d40d602 Mon Sep 17 00:00:00 2001 From: Wanjohi <71614375+wanjohiryan@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:57:14 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Add=20warp=20(moq-pub)=20(#?= =?UTF-8?q?15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description **What(what issue does this code solve/what feature does it add):** `Warp` will be used to "trasmit" the video and audio from the container to the user/viewer wherever they are. **How(how does it solve it):** 1. Add a Github worker that builds warp on pr, and one that builds and pushes on release ## Required Checklist: - [ ] I have added any necessary documentation and comments in my code (where appropriate) - [ ] I have added tests to make sure my code runs in all contexts ## Further comments --- .github/workflows/warp.yml | 159 +++++++++++++++++++++++++++++++++++++ .gitmodules | 3 + moq-server | 1 + 3 files changed, 163 insertions(+) create mode 100644 .github/workflows/warp.yml create mode 100644 .gitmodules create mode 160000 moq-server diff --git a/.github/workflows/warp.yml b/.github/workflows/warp.yml new file mode 100644 index 00000000..ee599ade --- /dev/null +++ b/.github/workflows/warp.yml @@ -0,0 +1,159 @@ +name: CI for moq-rs + +on: + workflow_dispatch: + schedule: + - cron: 0 0 * * * # At the end of everyday + pull_request: + release: + types: [published] + +# Cancel previous runs of the same workflow on the same branch. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-warp-release: + if: ${{ github.event_name == 'release' }} + defaults: + run: + working-directory: moq-server + strategy: + fail-fast: false + matrix: + settings: + - host: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bundles: appimage + asset_name: warp-ubuntu-amd64 + - host: windows-latest + target: x86_64-pc-windows-msvc + bundles: msi + asset_name: warp-windows-amd64 + - host: macos-latest + target: x86_64-apple-darwin + bundles: dmg + asset_name: warp-macos-amd64 + - host: macos-latest + target: aarch64-apple-darwin + bundles: dmg + asset_name: warp-macos-apple-silicon + # - host: ubuntu-20.04 + # target: x86_64-unknown-linux-musl + # - host: ubuntu-20.04 + # target: aarch64-unknown-linux-gnu + # - host: ubuntu-20.04 + # target: aarch64-unknown-linux-musl + # - host: ubuntu-20.04 + # target: armv7-unknown-linux-gnueabihf + name: Build warp on release + runs-on: ${{ matrix.settings.host }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Rust + id: toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.settings.target }} + toolchain: stable + components: clippy, rustfmt + + - name: Cache Rust Dependencies + uses: Swatinem/rust-cache@v2 + with: + save-if: false + prefix-key: 'v0-rust-deps' + shared-key: ${{ matrix.settings.target }} + + - name: Cargo build + run: cargo build --target ${{ matrix.settings.target }} --manifest-path ./moq-pub/Cargo.toml --release + + - name: Copy and rename artifacts (Linux) + if: ${{ matrix.settings.host == 'ubuntu-20.04' }} + run: | + cp target/${{ matrix.settings.target }}/release/moq-pub ./warp + + - name: Copy and rename artifacts (Windows) + if: ${{ matrix.settings.host == 'windows-latest' }} + run: | + cp "target/${{ matrix.settings.target }}/release/moq-pub.exe" ./warp.exe + + - name: Copy and rename artifacts (macOS) + if: ${{ matrix.settings.host == 'macos-latest' }} + run: | + cp target/${{ matrix.settings.target }}/release/moq-pub ./warp + + - name: Publish release for (${{ matrix.settings.host }}) + if: ${{ matrix.settings.host == 'windows-latest' }} + uses: svenstaro/upload-release-action@2.7.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./moq-server/warp.exe + asset_name: ${{ matrix.settings.asset_name }} + tag: ${{ github.ref }} + + - name: Publish release for (${{ matrix.settings.host }}) + if: ${{ matrix.settings.host != 'windows-latest' }} + uses: svenstaro/upload-release-action@2.7.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./moq-server/warp + asset_name: ${{ matrix.settings.asset_name }} + tag: ${{ github.ref }} + + build-warp-pr: + if: ${{ github.event_name == 'pull_request' }} + name: Build warp on PR + defaults: + run: + working-directory: moq-server + strategy: + fail-fast: false + matrix: + settings: + - host: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bundles: appimage + asset_name: warp-ubuntu-amd64 + + runs-on: ${{ matrix.settings.host }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Rust + id: toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.settings.target }} + toolchain: stable + components: clippy, rustfmt + + - name: Cache Rust Dependencies + uses: Swatinem/rust-cache@v2 + with: + save-if: false + prefix-key: 'v0-rust-deps' + shared-key: ${{ matrix.settings.target }} + + - name: Cargo build + run: cargo build --target ${{ matrix.settings.target }} --manifest-path ./moq-pub/Cargo.toml --release + + - name: Copy and rename artifacts (Linux) + run: | + cp target/${{ matrix.settings.target }}/release/moq-pub ./warp + + - name: Publish artifacts (${{ matrix.settings.host }}) + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.settings.asset_name }} + path: ./moq-server/warp + if-no-files-found: error + retention-days: 5 \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..0a932957 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "moq-server"] + path = moq-server + url = https://github.com/kixelated/moq-rs diff --git a/moq-server b/moq-server new file mode 160000 index 00000000..01a4da83 --- /dev/null +++ b/moq-server @@ -0,0 +1 @@ +Subproject commit 01a4da8352540c696a279d784c6fa48ec756d25e