Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Create virtual gamepad using Vigem #81

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
124 changes: 77 additions & 47 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,57 @@ on:
pull_request:

jobs:
build-go:
name: Build go binary
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
#TODO: Find a way to test this before building
-
name: Build binary
run: go build -v ./
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gobinary
path: ./warp

build-gpad:
name: Build exe for gpads
runs-on: windows-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
# - TODO: find a way to test this
-
name: Setup Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
-
name: Build Gpad.exe
run: cargo build --release
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gpad
path: ./target/release/gpad.exe

build-docker-base:
name: Build base image
needs:
- build-gpad
- build-go
runs-on: ubuntu-latest
steps:
-
Expand All @@ -15,6 +64,18 @@ jobs:
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Download gpad.exe
uses: actions/download-artifact@v3
with:
name: gpad
path: ./
-
name: Download go binary
uses: actions/download-artifact@v3
with:
name: gobinary
path: ./
-
name: Build Docker image
uses: docker/build-push-action@v4
Expand Down Expand Up @@ -57,54 +118,11 @@ jobs:
name: warp
path: /tmp/warp.tar

build-brave-example:
name: Build brave browser
needs: build-docker-base
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v3
-
name: Download artifact
uses: actions/download-artifact@v3
with:
name: warp
path: /tmp
-
name: Load Docker image
run: |
docker load --input /tmp/warp.tar
docker image ls -a
-
name: Build Docker example
run: |
set -o pipefail

cp docker/brave/Dockerfile .

docker build --tag warp:brave --build-arg WARP_IMAGE=warp:latest .

rm Dockerfile

-
name: Run Docker Container example
run: |
set -o pipefail
output=$(timeout 20s docker run warp:brave 2>&1) || exitcode=$?

if [[ $exitcode != 0 && $exitcode != 124 ]]; then
echo "$output"
exit $exitcode
else
echo "$output"
echo -e "\033[01;34mDocker run successful\033[0m"
exit 0
fi

shell: bash
build-docker-nvidia:
name: Build nvidia base image
needs:
- build-gpad
- build-go
runs-on: ubuntu-latest
steps:
-
Expand All @@ -113,6 +131,18 @@ jobs:
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Download gpad.exe
uses: actions/download-artifact@v3
with:
name: gpad
path: ./
-
name: Download go binary
uses: actions/download-artifact@v3
with:
name: gobinary
path: ./
-
name: Build Docker image
uses: docker/build-push-action@v4
Expand All @@ -127,7 +157,7 @@ jobs:
#error code 124 is timeout error
run: |
set -o pipefail
output=$(timeout 20s docker run warp:nvenc 2>&1) || exitcode=$?
output=$(timeout 2m docker run warp:nvenc 2>&1) || exitcode=$?

if [[ $exitcode != 0 && $exitcode != 124 ]]; then
echo "$output"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.mp4
logs/
logs/
target
Loading