Restore cicd builds.

This commit is contained in:
K. S. Ernest (iFire) Lee
2022-12-03 10:29:23 -08:00
parent 6779ece5b9
commit 3bd6651dc1
6 changed files with 459 additions and 0 deletions

89
.github/workflows/linux.yml vendored Normal file
View File

@@ -0,0 +1,89 @@
name: 🐧 Linux Builds
on:
push:
branches: [main, github_actions]
pull_request:
branches: [main]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: master
SCONS_CACHE_LIMIT: 4096
jobs:
linux-editor:
runs-on: "ubuntu-20.04"
name: Editor
steps:
# Clone Godot
- uses: actions/checkout@v2
with:
repository: godotengine/godot
ref: master
# Clone our module under the correct directory
- uses: actions/checkout@v2
with:
path: modules/visual_script
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-editor-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=linuxbsd tools=yes tests=no target=release_debug production=yes
# TODO Such tests are able to run from Godot 4.0 only
# Execute unit tests for the editor
#- name: Unit Tests
# run: |
# ./bin/godot.linuxbsd.opt.tools.64 --test
# Make build available
- uses: actions/upload-artifact@v2
with:
name: godot.linuxbsd.opt.tools.64
path: bin/godot.linuxbsd.opt.tools.64

76
.github/workflows/macos.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
name: 🍎 Macos Builds
on:
push:
branches: [main, github_actions]
pull_request:
branches: [main]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: master
SCONS_CACHE_LIMIT: 4096
jobs:
macos-editor:
runs-on: "macos-10.15"
name: Editor
steps:
# Clone Godot
- uses: actions/checkout@v2
with:
repository: godotengine/godot
ref: master
# Clone our module under the correct directory
- uses: actions/checkout@v2
with:
path: modules/visual_script
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: macos-editor-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes tests=no target=release_debug production=yes module_text_server_fb_enabled=yes
# TODO Such tests are able to run from Godot 4.0 only
# Execute unit tests for the editor
#- name: Unit Tests
# run: |
# ./bin/godot.linuxbsd.opt.tools.64 --test
# Make build available
- uses: actions/upload-artifact@v2
with:
name: godot.osx.opt.tools.64
path: bin/godot.osx.opt.tools.64

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# This script runs clang-format and fixes copyright headers on all relevant files in the repo.
# This is the primary script responsible for fixing style violations.
set -uo pipefail
IFS=$'\n\t'
CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl")
# Loops through all text files tracked by Git.
git grep -zIl '' |
while IFS= read -rd '' f; do
# Exclude 3rd party files.
if [[ "$f" == "glad"* ]]; then
continue
elif [[ "$f" == "godot-cpp"* ]]; then
continue
elif [[ "$f" == "thirdparty"* ]]; then
continue
elif [[ "$f" == "gradle"* ]]; then
continue
elif [[ "$f" == "build"* ]]; then
continue
elif [[ "$f" == "android"* ]]; then
continue
elif [[ "$f" == ".github"* ]]; then
continue
fi
for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do
if [[ "$f" == *"$extension" ]]; then
# Run clang-format.
clang-format -i "$f"
fi
done
done
git diff > patch.patch
# If no patch has been generated all is OK, clean up, and exit.
if [ ! -s patch.patch ] ; then
printf "Files in this commit comply with the clang-format style rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# This script ensures proper POSIX text file formatting and a few other things.
# This is supplementary to clang_format.sh, but should be run before it.
# We need dos2unix and recode.
if [ ! -x "$(command -v dos2unix)" -o ! -x "$(command -v recode)" ]; then
printf "Install 'dos2unix' and 'recode' to use this script.\n"
fi
set -uo pipefail
IFS=$'\n\t'
# Loops through all text files tracked by Git.
git grep -zIl '' |
while IFS= read -rd '' f; do
# Exclude 3rd party files
if [[ "$f" == "glad"* ]]; then
continue
elif [[ "$f" == "godot-cpp"* ]]; then
continue
elif [[ "$f" == "thirdparty"* ]]; then
continue
elif [[ "$f" == "gradle"* ]]; then
continue
elif [[ "$f" == "build"* ]]; then
continue
elif [[ "$f" == "android"* ]]; then
continue
elif [[ "$f" == "api.json" ]]; then
continue
fi
# Ensure that files are UTF-8 formatted.
recode UTF-8 "$f" 2> /dev/null
# Ensure that files have LF line endings and do not contain a BOM.
dos2unix "$f" 2> /dev/null
# Remove trailing space characters and ensures that files end
# with newline characters. -l option handles newlines conveniently.
perl -i -ple 's/\s*$//g' "$f"
# Remove the character sequence "== true" if it has a leading space.
perl -i -pe 's/\x20== true//g' "$f"
# We don't want to change lines around braces in godot/tscn files.
if [[ "$f" == *"godot" ]]; then
continue
elif [[ "$f" == *"tscn" ]]; then
continue
fi
# Disallow empty lines after the opening brace.
sed -z -i 's/\x7B\x0A\x0A/\x7B\x0A/g' "$f"
# Disallow some empty lines before the closing brace.
sed -z -i 's/\x0A\x0A\x7D/\x0A\x7D/g' "$f"
done
git diff > patch.patch
# If no patch has been generated all is OK, clean up, and exit.
if [ ! -s patch.patch ] ; then
printf "Files in this commit comply with the formatting rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

26
.github/workflows/static_checks.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: 📊 Static Checks
on: [push, pull_request]
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static-checks
cancel-in-progress: true
jobs:
static-checks:
name: Formatting (clang-format, file format)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get install -qq dos2unix recode clang-format
- name: File formatting checks (file_format.sh)
run: |
bash ./.github/workflows/scripts/file_format.sh
- name: Style checks via clang-format (clang_format.sh)
run: |
bash ./.github/workflows/scripts/clang_format.sh

146
.github/workflows/windows.yml vendored Normal file
View File

@@ -0,0 +1,146 @@
name: 🚪 Windows Builds
on:
push:
branches: [main, github_actions]
pull_request:
branches: [main]
# Global Cache Settings
# SCONS_CACHE for windows must be set in the build environment
env:
GODOT_BASE_BRANCH: master
SCONS_CACHE_MSVC_CONFIG: true
SCONS_CACHE_LIMIT: 4096
jobs:
windows-editor:
# Windows 10 with latest image
runs-on: "windows-latest"
name: Editor
steps:
# Clone Godot
- uses: actions/checkout@v2
with:
repository: v-sekai/godot
ref: groups-4.x
# Clone our module under the correct directory
- uses: actions/checkout@v2
with:
path: modules/visual_script
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-editor-cache
uses: actions/cache@v2
with:
path: /.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons pywin32
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=yes tests=no target=release_debug
# TODO Such tests are able to run from Godot 4.0 only
# Execute unit tests for the editor
#- name: Unit Tests
# run: |
# ./bin/godot.windows.opt.tools.64.exe --test
# Make build available
- uses: actions/upload-artifact@v2
with:
name: godot.windows.opt.tools.64.exe
path: bin/godot.windows.opt.tools.64.exe
windows-template:
# Windows 10 with latest image
runs-on: "windows-latest"
name: Release
steps:
# Clone Godot
- uses: actions/checkout@v2
with:
repository: v-sekai/godot
ref: groups-4.x
# Clone our module under the correct directory
- uses: actions/checkout@v2
with:
path: modules/visual_script
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-editor-cache
uses: RevoluPowered/cache@v2.1
with:
path: /.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons pywin32
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=no tests=no target=release
# TODO Such tests are able to run from Godot 4.0 only
# Execute unit tests for the editor
#- name: Unit Tests
# run: |
# ./bin/godot.windows.opt.tools.64.exe --test
# Make build available
- uses: actions/upload-artifact@v2
with:
name: godot.windows.opt.64.exe
path: bin/godot.windows.opt.64.exe