Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 66 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: ci.yml
on:
push:
branches: ['**']
branches: ["**"]
pull_request:
branches: ['**']
branches: ["**"]

jobs:
build:
game:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -17,16 +16,74 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
distribution: "temurin"

- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Make gradlew executable (Linux btw)
run: chmod +x gradlew
run: chmod +x game/gradlew

- name: Run tests (I use neovim btw)
run: ./gradlew test
run: cd game && ./gradlew test

- name: Build project (gotcha!)
run: cd game && ./gradlew build

channel:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"

- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y cmake g++ libssl-dev

- name: Cache libdatachannel build
id: cache-libdc
uses: actions/cache@v4
with:
path: |
/usr/local/lib/libdatachannel*
/usr/local/lib/cmake/LibDataChannel
/usr/local/include/rtc

key: libdatachannel-${{ runner.os }}-v0.21

- name: Build libdatachannel from source
if: steps.cache-libdc.outputs.cache-hit != 'true'
run: |
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build -j$(nproc)
sudo cmake --install build

- name: Build channel
run: |
cd channel
cmake -B build
cmake --build build

- name: run channel tests
run: cd channel/build && ctest --output-on-failure

signaling-server:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: Build project
run: ./gradlew build
- name: Build signaling server
run: cd signaling_server && go build ./...
128 changes: 111 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,127 @@ permissions:
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest

build:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
native-lib: channel/build/libwebrtc_wrapper.so
- os: windows-latest
platform: windows
native-lib: channel/build/Release/webrtc_wrapper.dll
- os: macos-latest
platform: macos
native-lib: channel/build/libwebrtc_wrapper.dylib
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
node-version: 20
distribution: "temurin"
java-version: 17

# libdatachannel for Linux
- name: Install dependencies for Linux
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libssl-dev

- name: Build libdatachannel
if: matrix.platform == 'linux'
run: |
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build -j$(nproc)
sudo cmake --install build

# libdatachannel for macOS
- name: Install dependencies for macOS
if: matrix.platform == 'macos'
run: |
brew update
brew install cmake openssl
- name: Build libdatachannel for macOS
if: matrix.platform == 'macos'
run: |
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local \
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
cmake --build build -j$(sysctl -n hw.ncpu)
sudo cmake --install build

# libdatachannel for Windows
- name: Install dependencies for Windows
if: matrix.platform == 'windows'
run: |
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=C:/libdatachannel
cmake --build build --config Release
cmake --install build --config Release

# build channel native library
- name: Build channel native library (macOS and Linux)
if: matrix.platform != 'windows'
run: |
cd channel
cmake -B build
cmake --build build

- name: Build channel native library (Windows)
if: matrix.platform == 'windows'
shell: bash
run: |
cd channel
cmake -B build -DCMAKE_PREFIX_PATH=C:/libdatachannel
cmake --build build --config Release

- name: Set up JDK 17
uses: actions/setup-java@v3
# Build game JAR
- name: Build game JAR (macOS and Linux)
if: matrix.platform != 'windows'
run: |
chmod +x game/gradlew
cd game
./gradlew build

- name: Build game JAR (Windows)
if: matrix.platform == 'windows'
shell: cmd
run: |
cd game
gradlew.bat build

# upload artifacts for each platform
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
java-version: '17'
distribution: 'temurin'
name: ufg-${{ matrix.platform }}
path: |
game/build/libs/*.jar
${{ matrix.native-lib }}

release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
arguments: build
path: dist/

- name: Upload JAR artifact
uses: actions/upload-artifact@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
name: jar-package
path: build/libs/*.jar
node-version: 20

- name: Install semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/release-notes-generator conventional-changelog-conventionalcommits
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ node_modules/
.idea/**/shelf
.gradle/


# Specific
CLAUDE.md
game/bin/

# AWS User-specific
.idea/**/aws.xml
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: signaling game channel all clean down

all: signaling game

signaling:
docker compose up --build -d

host:
cd game && ./gradlew run --args='--host'

game:
cd game && ./gradlew run

channel:
cd channel && cmake -B build && cmake --build build

down:
docker compose down

clean:
docker compose down
cd game && ./gradlew clean

Usage:

# make signaling # run the signaling server, make sure to run this before starting the game
# make game # run the game, make sure signaling server is running first
# make all # both game and signaling
# make down # stop containers
# make clean # clean everything, including docker containers and gradle build files
Loading
Loading