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
39 changes: 39 additions & 0 deletions .github/actions/godot-cache-restore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Restore Godot build cache
description: Restore Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: ${{ github.job }}
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons_cache/

runs:
using: composite
steps:
- name: Restore default cache
uses: actions/cache/restore@v5
id: cache-ping
with:
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}|${{ github.event.repository.default_branch }}|${{ github.sha }}
restore-keys: ${{ inputs.cache-name }}|${{ github.event.repository.default_branch }}

- name: Log default cache files
if: steps.cache-ping.outputs.cache-matched-key && github.ref_name != github.event.repository.default_branch
shell: sh
run: find "${{ inputs.scons-cache }}" >> redundant.txt

# This is done after pulling the default cache so that PRs can integrate any potential changes
# from the default branch without conflicting with whatever local changes were already made.
- name: Restore local cache
uses: actions/cache/restore@v5
if: github.ref_name != github.event.repository.default_branch
with:
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}|${{ github.ref_name }}|${{ github.sha }}
restore-keys: ${{ inputs.cache-name }}|${{ github.ref_name }}

- name: Store unix timestamp
shell: sh
run: echo "CACHE_TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
22 changes: 22 additions & 0 deletions .github/actions/godot-cache-save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Save Godot build cache
description: Save Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: ${{ github.job }}
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons_cache/

runs:
using: composite
steps:
- name: Purge files before timestamp
shell: sh
run: misc/scripts/purge_cache.py ${{ env.CACHE_TIMESTAMP }} "${{ inputs.scons-cache }}"

- name: Save SCons cache directory
uses: actions/cache/save@v5
with:
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}|${{ github.ref_name }}|${{ github.sha }}
22 changes: 0 additions & 22 deletions .github/actions/godot-cache/action.yml

This file was deleted.

46 changes: 22 additions & 24 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,24 @@ env:
jobs:
static-checks:
name: 📊 Static Checks (clang-format, black format, file format)
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # Treeless clone. Slightly less performant than a shallow clone, but makes finding diffs instantaneous.
filter: tree:0 # See: https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/

- name: Install dependencies
run: |
# Add clang repository (so we have clang-format-14)
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"
sudo apt-get update
# Install required deps
sudo apt-get install -qq dos2unix moreutils recode clang-format-14
sudo update-alternatives --remove-all clang-format
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100
sudo pip3 install black==22.3.0 pygments

- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh

- name: Style checks via clang-format (clang_format.sh)
# This needs to happen before Python and npm execution; it must happen before any extra files are written.
- name: .gitignore checks (gitignore_check.sh)
run: |
bash ./misc/scripts/clang_format.sh
bash ./misc/scripts/gitignore_check.sh

- name: Python style checks via black (black_format.sh)
run: |
bash ./misc/scripts/black_format.sh
- name: Style checks via prek
uses: j178/prek-action@v2
with:
extra-args: "-a"

build:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -148,10 +138,11 @@ jobs:
with:
submodules: recursive

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
with:
cache-name: ${{ matrix.cache-name }}
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true

- name: Setup Windows MinGW toolchain cache
Expand Down Expand Up @@ -253,6 +244,13 @@ jobs:
run: |
scons target=release generate_bindings=yes ${{ matrix.gdnative_flags }} godot_version=3

- name: Save Godot build cache
uses: ./.github/actions/godot-cache-save
with:
cache-name: ${{ matrix.cache-name }}
scons-cache: ${{ env.SCONS_CACHE }}
continue-on-error: true

- uses: actions/upload-artifact@v7
with:
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
Expand Down
91 changes: 91 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
default_language_version:
python: python3

exclude: |
(?x)^(
.*thirdparty/.*|
.*misc/patches/.*|
)$

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
exclude: (SConstruct|SCsub)$ # SCons files use shebangs for syntax highlighting only.

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.5
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java)$
types_or: [text]
- id: clang-format
name: clang-format-glsl
files: \.glsl$
types_or: [text]
args: [-style=file:misc/utility/clang_format_glsl.yml]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
hooks:
- id: ruff-check
args: [--color=always]
files: (\.py|SConstruct|SCsub)$
types_or: [text]
- id: ruff-format
args: [--color=always]
files: (\.py|SConstruct|SCsub)$
types_or: [text]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
files: \.py$
types_or: [text]

- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
hooks:
- id: codespell
additional_dependencies: [tomli]

- repo: local
hooks:
- id: header-guards
name: header-guards
language: python
entry: python misc/scripts/header_guards.py
files: \.(h|hpp|hh|hxx)$

- id: file-format
name: file-format
language: python
entry: python misc/scripts/file_format.py
types_or: [text]
exclude: |
(?x)^(
.*\.test\.txt|
.*\.svg|
.*\.patch|
.*\.out|
modules/gdscript/tests/scripts/parser/features/mixed_indentation_on_blank_lines\.gd|
modules/gdscript/tests/scripts/parser/warnings/empty_file_newline_comment\.norun\.gd|
modules/gdscript/tests/scripts/parser/warnings/empty_file_newline\.norun\.gd|
tests/data/.*\.bin
)$

#
# End of upstream Godot pre-commit hooks.
#
# Keep this separation to let downstream forks add their own hooks to this file,
# without running into merge conflicts when rebasing on latest upstream.
#
# Start of downstream pre-commit hooks.
#
# This is still the "repo: local" scope, so new local hooks can be defined directly at this indentation:
# - id: new-local-hook
# To add external repo hooks, bring the indentation back to:
# - repo: my-remote-hook
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ You simply need to copy that folder to the root folder of your project. Note tha

### License

The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and its dependencies are licensed under other permissive open source licences. Please see [`thirdparty/README.md`](thirdparty/README.md) for more informations.
The `webrtc-native` plugin is licensed under the MIT license (see [LICENSE](https://github.com/godotengine/webrtc-native/blob/master/LICENSE)), while `libdatachannel` and its dependencies are licensed under other permissive open source licenses. Please see [`thirdparty/README.md`](thirdparty/README.md) for more information.
17 changes: 8 additions & 9 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!python
# ruff: noqa: F821

import os, sys, platform, json, subprocess
import SCons
import os
import sys


def add_sources(sources, dirpath, extension):
Expand Down Expand Up @@ -46,7 +47,7 @@ if "macos_deployment_target" not in ARGUMENTS:
ARGUMENTS["macos_deployment_target"] = "11.0"
if "android_api_level" not in ARGUMENTS:
ARGUMENTS["android_api_level"] = "28"
# Godot CPP (4.3+) default API verison
# Godot CPP (4.3+) default API version
if "api_version" not in ARGUMENTS:
ARGUMENTS["api_version"] = "4.3"

Expand Down Expand Up @@ -169,12 +170,10 @@ else:
env.Append(CPPPATH=["src/"])
env.Append(CPPDEFINES=["RTC_STATIC"])
sources = []
sources.append(
[
"src/WebRTCLibDataChannel.cpp",
"src/WebRTCLibPeerConnection.cpp",
]
)
sources.append([
"src/WebRTCLibDataChannel.cpp",
"src/WebRTCLibPeerConnection.cpp",
])
if env["godot_version"] == "3":
env.Append(CPPDEFINES=["GDNATIVE_WEBRTC"])
sources.append("src/init_gdnative.cpp")
Expand Down
2 changes: 0 additions & 2 deletions bin/thirdparty/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions misc/scripts/black_format.sh

This file was deleted.

53 changes: 0 additions & 53 deletions misc/scripts/clang_format.sh

This file was deleted.

Loading
Loading