-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(input): Migrate to moq for input transmission (#38)
## Description **What issue are you solving (or what feature are you adding) and how are you doing it?** We cannot use golang for our input binary as we will be redoing the Webtransport stack, plus we will have to use CGO in-order to hook into X11. Like what [neko](https://github.com/m1k1o/neko) does. However, we could go down the Rust route, where X11 mouse/keyboard drivers are in pretty, and moq-rs (the MoQ library using Webtransport) works really well. So, that is what am trying to do here; implement input using rust.
- Loading branch information
1 parent
3a7d404
commit c0f5735
Showing
10 changed files
with
2,265 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
#Tabs not spaces, you moron :) | ||
|
||
name: CI for netris:warp-input | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "warp-input.Dockerfile" | ||
- ".github/workflows/warp-input.yml" | ||
- "bin/input/**" | ||
schedule: | ||
- cron: 0 0 * * * # At the end of everyday | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "warp-input.Dockerfile" | ||
- ".github/workflows/warp-input.yml" | ||
tags: | ||
- v*.*.* | ||
release: | ||
types: [published, created] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: wanjohiryan/netris | ||
BASE_TAG_PREFIX: warp-input | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-docker-pr: | ||
name: Build image on pr | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'pull_request' }} | ||
steps: | ||
- | ||
name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- | ||
name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: warp-input.Dockerfile | ||
context: ./ | ||
push: false | ||
load: true | ||
tags: netris:warp-input | ||
|
||
build-docker-main: | ||
name: Build image on merge to main | ||
if: ${{github.ref == 'refs/heads/main'}} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- | ||
name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- | ||
name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Extract Container metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }} | ||
# | ||
#tag on release, and a nightly build for 'dev' | ||
tags: | | ||
type=raw,value=nightly,enable={{is_default_branch}} | ||
type=ref,event=tag | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- | ||
name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: warp-input.Dockerfile | ||
context: ./ | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
build-warp-input-release: | ||
if: ${{ github.event_name == 'release' }} | ||
defaults: | ||
run: | ||
working-directory: bin/input | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
settings: | ||
- host: ubuntu-20.04 | ||
target: x86_64-unknown-linux-gnu | ||
bundles: appimage | ||
asset_name: warp-input-ubuntu-amd64 | ||
- host: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
bundles: msi | ||
asset_name: warp-input-windows-amd64 | ||
# - host: macos-latest | ||
# target: x86_64-apple-darwin | ||
# bundles: dmg | ||
# asset_name: warp-input-macos-amd64 | ||
# - host: macos-latest | ||
# target: aarch64-apple-darwin | ||
# bundles: dmg | ||
# asset_name: warp-input-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-input on release | ||
runs-on: ${{ matrix.settings.host }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
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 }} --release | ||
|
||
- name: Copy and rename artifacts (Linux) | ||
if: ${{ matrix.settings.host == 'ubuntu-20.04' }} | ||
run: | | ||
cp target/${{ matrix.settings.target }}/release/warp-input ./warp-input | ||
- name: Copy and rename artifacts (Windows) | ||
if: ${{ matrix.settings.host == 'windows-latest' }} | ||
run: | | ||
cp "target/${{ matrix.settings.target }}/release/warp-input.exe" ./warp-input.exe | ||
- name: Copy and rename artifacts (macOS) | ||
if: ${{ matrix.settings.host == 'macos-latest' }} | ||
run: | | ||
cp target/${{ matrix.settings.target }}/release/warp-input ./warp-input | ||
- name: Publish release for (${{ matrix.settings.host }}) | ||
if: ${{ matrix.settings.host == 'windows-latest' }} | ||
uses: svenstaro/[email protected] | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ./bin/input/warp-input.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/[email protected] | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ./bin/input/warp-input | ||
asset_name: ${{ matrix.settings.asset_name }} | ||
tag: ${{ github.ref }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Oops, something went wrong.