Skip to content
Open
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
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

[codespell]
skip = assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/**
ignore-words-list = acess
Comment on lines +5 to +6
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Remove 'acess' from the ignored words list and skip CREDITS.md.

This will prevent missing real misspellings of 'access', and CREDITS.md is auto-generated by GLAM, so any misspellings in that file on GLAM's side should be caught by other checks.

Suggested change
skip = assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/**
ignore-words-list = acess
skip = CREDITS.md,assets/**,test/**,addons/gd-plug/**,LICENSES/**,addons/glam/LICENSES/**,addons/glam/.LICENSES/**

13 changes: 13 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

# Variables used by the Justfile

# Godot

GODOT_VERSION=3.5.3

# Addon

ADDON_NAME=glam
ADDON_VERSION=0.1.0
31 changes: 7 additions & 24 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,15 @@

# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

# 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

# Files to exclude from asset-lib download.
/.github export-ignore
/.reuse export-ignore
/LICENSES export-ignore
/assets export-ignore
/addons/gd-plug export-ignore
/docs export-ignore
/misc export-ignore
/test export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.gut_editor_config.json export-ignore
/.gutconfig.json export-ignore
/.gutconfig_all.json export-ignore
/CREDITS.md export-ignore
/LICENSE export-ignore
/README.md export-ignore
/default_env.tres export-ignore
/icon.png export-ignore
/icon.png.import export-ignore
/plug.gd export-ignore
/project.godot export-ignore
/requirements.txt export-ignore
/*.license export-ignore
# 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.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: This is a great comment. Should definitely keep this.

/** export-ignore
/addons/glam !export-ignore
/addons/glam/** !export-ignore
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker: This is nice, but unfortunately doesn't work. It results in an empty zip archive. There is currently a check in the workflow for this which fails with this .gitattributes file.

# Git archive should only include addons/glam directory.
check-archive:
name: 'Check Archive'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create git archive
run: git archive -o archive.zip HEAD
- name: Extract archive
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped
- name: Copy extracted archive to working directory
run: cp -avr /tmp/unzipped ./unzipped
- name: REUSE compliance check
uses: fsfe/reuse-action@v2
with:
args: --root ./unzipped/addons/glam lint
- name: Check that archive only contains addons directory
run: |
shopt -s nullglob dotglob
ls -laR /tmp/unzipped
files=(/tmp/unzipped/*)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in archive (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons" ]; then
echo "Expected directory (addons) not found."
exit 1
fi
files=(/tmp/unzipped/addons)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in addons directory (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons/glam" ]; then
echo "Expected directory (addons/glam) not found."
exit 1
fi

Adding files and forgetting to update .gitattributes has caught me out a lot. It would be nice if there were a pre-commit hook for it. I'm considering adding one to setup-godot as I would also use it in other projects.

67 changes: 67 additions & 0 deletions .github/actions/setup-godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# SPDX-FileCopyrightText: 2021 Leroy Hopson <glam@leroy.geek.nz>
# SPDX-License-Identifier: MIT

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
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Thanks for this. I have cherry-picked the commit that adds this file and it works well.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0

version: 2
updates:

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '00:00'
timezone: UTC
open-pull-requests-limit: 10
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependabot"
- "dependencies"
163 changes: 67 additions & 96 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,82 @@
# SPDX-FileCopyrightText: 2021 Leroy Hopson <glam@leroy.geek.nz>
# SPDX-License-Identifier: MIT
name: 'Test'

name: Release Packaging

on:
push:
schedule: # Keep the cache alive!
- cron: 7 1 * * fri
workflow_dispatch:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
Test:
name: Test (${{ matrix.os }} ${{ matrix.version }})
check:
runs-on: ubuntu-22.04
timeout-minutes: 30

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

- name: Load dotenv
run: just ci-load-dotenv

- name: Check
run: just fmt

- name: Ensure version is equal to tag
if: startsWith(github.ref, 'refs/tags/')
run: |
[ "${{ env.addon_version }}" == "${{ env.BRANCH_NAME }}" ] || exit 2

test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
version: [ "v3.3-stable", "v3.4.4-stable", "v3.5-beta4" ]
os: [ ubuntu-22.04, windows-2022, macos-12 ]
godot_version: [ '3.3.4', '3.4.5', '3.5.3' ]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.13.0
- name: Install npx
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: npm i -g npx
- name: Start HTTP server
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: npx http-server --port=7121 ./test/integration/streaming/ &
- name: Setup Godot
id: setup-godot
uses: lihop/setup-godot@v2
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1

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

- uses: actions/setup-python@v5
with:
version: ${{ matrix.version }}
- name: Install plugins
shell: bash
run: godot --no-window -s plug.gd install
- name: Import files
shell: bash
run: godot --editor --quit
python-version: '3.10'

- name: Run unit tests
shell: bash
run: godot --no-window -s addons/gut/gut_cmdln.gd -gconfig=.gutconfig.json
- name: Run (some) integration tests
shell: bash
if: ${{ matrix.os == 'ubuntu-latest' }}
run: godot --no-window -s addons/gut/gut_cmdln.gd -gdir=res://test/integration/sources -gexit

reuse-compliance-check:
name: 'Check REUSE Compliance'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
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, test]

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

gdformat-check:
name: 'Check GDScript Format'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: GDFormat Check
run: |
python -m pip install -r requirements.txt
gdformat -c .

# Git archive should only include addons/glam directory.
check-archive:
name: 'Check Archive'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create git archive
run: git archive -o archive.zip HEAD
- name: Extract archive
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped
- name: Copy extracted archive to working directory
run: cp -avr /tmp/unzipped ./unzipped
- name: REUSE compliance check
uses: fsfe/reuse-action@v1
with:
args: --root ./unzipped/addons/glam lint
- name: Check that archive only contains addons directory
run: |
shopt -s nullglob dotglob
ls -laR /tmp/unzipped
files=(/tmp/unzipped/*)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in archive (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons" ]; then
echo "Expected directory (addons) not found."
exit 1
fi
files=(/tmp/unzipped/addons)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in addons directory (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons/glam" ]; then
echo "Expected directory (addons/glam) not found."
exit 1
fi
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1

- name: Load dotenv
run: just ci-load-dotenv

- name: Publish
run: just publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ mono_crash.*
todo.gd
.gut_editor_config.json
*.swp
venv/
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tought: With pre-commit sandboxing the python git hooks, I don't think we need any reference to python in this project. Therefore, we could also remove the .venv/ ignore from this file.

47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: fix-byte-order-marker # Prevents weird UTF-8 encoding edge cases
- id: check-case-conflict # Check if case-insensitive filesystems would bork
- id: check-docstring-first # Check for if docstring was misplaced
- id: check-executables-have-shebangs
- id: check-json # Checks for valid json
- id: check-merge-conflict # Checks strings that look like a committed merge conflict
- id: check-xml # Checks for valid xml
- id: check-yaml # Checks for valid yaml
- id: end-of-file-fixer # Checks for ending with a newline
- id: mixed-line-ending # Consistent LF or CRLF
- id: trailing-whitespace # No trailing whitespace
- repo: https://github.com/fsfe/reuse-tool
rev: v2.0.0
hooks:
- id: reuse
- id: reuse
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: reuse appears twice here.

args: ["--root", "./addons/glam", "lint"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
- repo: local
hooks:
- id: check-gdscript
name: check gdscript
entry: gdformat
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
)
- id: lint-gdscript
name: lint gdscript
entry: gdlint
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
)
Comment on lines +28 to +47
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: GDScript Toolkit supports pre-commit, so we can use their repo rather than local. Also, I've ordered the hooks with gdformat first with the idea that it might fix certain things that gdlint would complain about.

Suggested change
- repo: local
hooks:
- id: check-gdscript
name: check gdscript
entry: gdformat
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
)
- id: lint-gdscript
name: lint gdscript
entry: gdlint
language: system
files: \.gd$
exclude: |
(?x)^(
addons/gd-plug/|
)
repos:
- repo: https://github.com/Scony/godot-gdscript-toolkit
rev: 3.5.0
hooks:
- id: gdformat
exclude: '^addons/gd-plug/'
- id: gdlint
exclude: '^addons/gd-plug/'

2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Source: https://github.com/lihop/glam

# Licenses in this directory are not used by the project, but are used by
# assets from the various sources. However the REUSE linter complains about
# unusued licenses so they are kept in a separate directory.
# unused licenses so they are kept in a separate directory.
Files: addons/glam/.LICENSES/*
Copyright: ignore
License: CC0-1.0
Expand Down
Loading