Skip to content

Commit

Permalink
feat: test & doc support
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Dec 30, 2023
1 parent 58edeb0 commit bbf43ce
Show file tree
Hide file tree
Showing 26 changed files with 1,357 additions and 59 deletions.
3 changes: 1 addition & 2 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[codespell]
skip = assets/**
ignore-words-list = lod,LOD
skip = addons/gd-plug/**,addons/gut/**
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Godot

GODOT_VERSION=4.2
GODOT_VERSION=4.2.1

# Addon

Expand Down
12 changes: 9 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Properly detect languages on Github.
*.gd linguist-language=GDScript

# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
*.gd linguist-language=GDScript

# The above only works properly for Git 2.10+, so for older versions
# we need to manually list the binary files we don't want modified.
*.mp3 binary
*.png binary
*.hdr binary

# Exclude all top-level files and directories (except addons) from zip downloads.
# This makes installing through the AssetLib easier, because no files and folders
# need to be unchecked.

/** export-ignore
/** export-ignore
/addons/greeter !export-ignore
/addons/greeter/** !export-ignore
64 changes: 64 additions & 0 deletions .github/actions/setup-godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Setup Godot
description: Setup Godot dependencies.
runs:
using: "composite"
steps:

############
# Windows #
############

- name: Installing Mesa3D
if: ${{ runner.os == 'Windows' }}
uses: ssciwr/setup-mesa-dist-win@v1

- name: Installing Scream, a virtual sound card
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
<# Script to install Scream, a dummy sound card for Windows: https://github.com/duncanthrax/scream
Taken from comment by Aleksandr Chebotov (al-cheb) at: https://github.com/actions/virtual-environments/issues/2528#issuecomment-766883233 #>
Start-Service audio*
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
Expand-Archive C:\Scream3.6.zip -DestinationPath C:\Scream
$cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
cd C:\Scream\Install\driver
C:\Scream\Install\helpers\devcon install Scream.inf *Scream
############
# Linux #
############

- name: Installing Linux dependencies
if: ${{ runner.os == 'Linux' }}
shell: bash
run: sudo apt-get install -y pulseaudio xvfb x11-xserver-utils mesa-vulkan-drivers

- name: Starting X11 server on :0
if: ${{ runner.os == 'Linux' }}
shell: bash
run: xset -q || /bin/bash -c "sudo Xvfb -ac :0 -screen 0 1920x1080x24 > /dev/null 2>&1 &"
env:
DISPLAY: ":0"

- name: Check that X11 server is running
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: /bin/bash -c "xset -q > /dev/null 2>&1"
env:
DISPLAY: ":0"

- name: Starting dummy sound device
if: ${{ runner.os == 'Linux' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 3
command: pulseaudio --check || pulseaudio -D
66 changes: 33 additions & 33 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"regexManagers": [
{
"fileMatch": ["^plug\\.gd$"],
"matchStrings": [
"\\s+plug\\(\"(?<gitUrl>.*?)\",\\ \\{\\s*\"commit\":\\ \"(?<currentValue>)(?<currentDigest>.*?)\""
],
"depNameTemplate": "{{{gitUrl}}}",
"packageNameTemplate": "https://github.com/{{{gitUrl}}}",
"versioningTemplate": "git",
"datasourceTemplate": "git-refs"
},
{
"fileMatch": ["^plug\\.gd$"],
"matchStrings": [
"\\s+plug\\(\"(?<gitUrl>.*?)\",\\ \\{\\s*\"tag\":\\ \"(?<currentValue>)(?<currentDigest>.*?)\""
],
"depNameTemplate": "{{{gitUrl}}}",
"packageNameTemplate": "https://github.com/{{{gitUrl}}}",
"versioningTemplate": "git",
"datasourceTemplate": "git-tags"
},
{
"fileMatch": ["^.env$"],
"matchStrings": [
"GODOT_VERSION=(?<currentValue>.*?)\\n"
],
"depNameTemplate": "godotengine/godot",
"packageNameTemplate": "https://github.com/godotengine/godot",
"versioningTemplate": "loose",
"extractVersionTemplate": "^(?<version>.*)-stable$",
"datasourceTemplate": "git-tags"
}
]
"regexManagers": [
{
"fileMatch": ["^plug\\.gd$"],
"matchStrings": [
"\\s+plug\\(\"(?<gitUrl>.*?)\",\\ \\{\\s*\"commit\":\\ \"(?<currentValue>.*)\""
],
"depNameTemplate": "{{{gitUrl}}}",
"packageNameTemplate": "https://github.com/{{{gitUrl}}}",
"versioningTemplate": "git",
"datasourceTemplate": "git-refs"
},
{
"fileMatch": ["^plug\\.gd$"],
"matchStrings": [
"\\s+plug\\(\"(?<gitUrl>.*?)\",\\ \\{\\s*\"tag\":\\ \"(?<currentValue>.*)\""
],
"depNameTemplate": "{{{gitUrl}}}",
"packageNameTemplate": "https://github.com/{{{gitUrl}}}",
"versioningTemplate": "git",
"datasourceTemplate": "git-tags"
},
{
"fileMatch": ["^.env$"],
"matchStrings": [
"GODOT_VERSION=(?<currentValue>.*?)\\n"
],
"depNameTemplate": "godotengine/godot",
"packageNameTemplate": "https://github.com/godotengine/godot",
"versioningTemplate": "loose",
"extractVersionTemplate": "^(?<version>.*)-stable$",
"datasourceTemplate": "git-tags"
}
]
}
43 changes: 40 additions & 3 deletions .github/workflows/release-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,55 @@ jobs:
- name: Load dotenv
run: just ci-load-dotenv

# Retry multiple times, sometimes in CI, gdlint raise "file exists"
- name: Check
run: just fmt
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 3
command: just fmt

- name: Ensure version is equal to tag
if: startsWith(github.ref, 'refs/tags/')
run: |
[ "${{ env.game_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2
[ "${{ env.addon_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: true
matrix:
os: [ ubuntu-22.04, windows-2022, macos-12 ]
godot_version: [ '4.0.4', '4.1.3', '4.2.1' ]

steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1

- name: Setup Godot dependencies
uses: ./.github/actions/setup-godot

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Run unit tests
run: just unit
env:
GODOT_VERSION: ${{ matrix.godot_version }}

- name: Run integration tests
if: ${{ runner.os == 'Linux' }}
run: just integration
env:
GODOT_VERSION: ${{ matrix.godot_version }}

publish:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [check]
needs: [check, test]

if: startsWith(github.ref, 'refs/tags/')

Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ gfxrecon_capture_*
.mono/
data_*/

# gd-plug
.plugged/
addons/*
!addons/gd-plug/
!addons/greeter/

# Python-specific ignores
venv/

# Export output
dist/
build/
override.cfg

# Docs output
reference.json
site/
10 changes: 10 additions & 0 deletions .gutconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dirs": [
"res://test"
],
"prefix": "",
"suffix": ".test.gd",
"include_subdirs": true,
"log_level": 1,
"should_exit": true
}
11 changes: 10 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ repos:
entry: gdformat
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
plug.gd
)
- id: check-shaders
name: check shaders
entry: clang-format
Expand All @@ -55,9 +60,13 @@ repos:
- -i
language: system
files: \.gdshader$
exclude: ^addons/
- id: lint-gdscript
name: lint gdscript
entry: gdlint
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
plug.gd
)
12 changes: 12 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@ Source: https://github.com/MechanicalFlower/godot-addons-template
Files: *
Copyright: 2023-present Florian Vazelle
License: MIT

# Addons

Files: addons/gd-plug/*
Copyright: 2021 Tan Jian Ping
License: MIT
Source: https://github.com/imjp94/gd-plug

Files: addons/gut/*
Copyright: 2018 Tom "Butch" Wesley
License: MIT
Source: https://github.com/bitwes/Gut
Loading

0 comments on commit bbf43ce

Please sign in to comment.