Compare commits
3
Commits
internal-merge
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a61abcde2d | ||
|
|
a93a74aede | ||
|
|
9207e46105 |
@@ -1,149 +0,0 @@
|
||||
name: Linux Builds
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Linux Build
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-linux
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/linux/haxe/
|
||||
export/release/linux/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing LibVLC
|
||||
run: |
|
||||
sudo apt-get install libvlc-dev libvlccore-dev
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s
|
||||
- name: Building the game
|
||||
run: |
|
||||
haxelib run lime build linux -DCOMPILE_EXPERIMENTAL
|
||||
# - name: Tar files
|
||||
# run: tar -zcvf CodenameEngine.tar.gz -C export/release/linux/bin .
|
||||
- name: Uploading artifact (executable)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine (Executable Only)
|
||||
path: export/release/linux/bin/CodenameEngine
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine
|
||||
path: export/release/linux/bin/
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-linux") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-linux
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/linux/haxe/
|
||||
export/release/linux/obj/
|
||||
|
||||
# didnt compile debug in the same job or github would have said that job wasn't completed until debug was done too (debug uploads are not essential)
|
||||
debug_build:
|
||||
name: Linux Debug Build
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-24.04
|
||||
needs: build # since its low priority, it'll run after, so actions will concentrate first on normal builds
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-linux-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/linux/haxe/
|
||||
export/debug/linux/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing LibVLC
|
||||
run: |
|
||||
sudo apt-get install libvlc-dev libvlccore-dev
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s
|
||||
- name: Building the game
|
||||
run: |
|
||||
haxelib run lime build linux -debug
|
||||
# - name: Tar files
|
||||
# run: tar -zcvf CodenameEngine.tar.gz -C export/debug/linux/bin .
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine Debug
|
||||
path: export/debug/linux/bin/
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-linux-debug") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-linux-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/linux/haxe/
|
||||
export/debug/linux/obj/
|
||||
@@ -1,143 +0,0 @@
|
||||
name: Mac OS Builds
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Mac OS Build
|
||||
permissions: write-all
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-mac
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/macos/haxe/
|
||||
export/release/macos/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s
|
||||
- name: Building the game
|
||||
run: |
|
||||
arch -x86_64 haxelib run lime build mac -DCOMPILE_EXPERIMENTAL
|
||||
- name: Tar files
|
||||
run: tar -zcvf CodenameEngine.tar.gz -C export/release/macos/bin .
|
||||
- name: Uploading artifact (executable)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine (Executable Only)
|
||||
path: export/release/macos/bin/CodenameEngine.app/Contents/MacOS/CodenameEngine
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine
|
||||
path: CodenameEngine.tar.gz
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-mac") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-mac
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/macos/haxe/
|
||||
export/release/macos/obj/
|
||||
|
||||
# didnt compile debug in the same job or github would have said that job wasn't completed until debug was done too (debug uploads are not essential)
|
||||
debug_build:
|
||||
name: Mac OS Debug Build
|
||||
permissions: write-all
|
||||
runs-on: macos-14
|
||||
needs: build # since its low priority, it'll run after, so actions will concentrate first on normal builds
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-mac-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/macos/haxe/
|
||||
export/debug/macos/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s
|
||||
- name: Building the game
|
||||
run: |
|
||||
arch -x86_64 haxelib run lime build mac -debug
|
||||
- name: Tar files
|
||||
run: tar -zcvf CodenameEngine.tar.gz -C export/debug/macos/bin .
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine Debug
|
||||
path: CodenameEngine.tar.gz
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-mac-debug") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-mac-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/macos/haxe/
|
||||
export/debug/macos/obj/
|
||||
@@ -1,199 +0,0 @@
|
||||
name: Create Release Builds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag_name:
|
||||
description: "Release name (e.g. v1.0.5 or v1.2-rc1)"
|
||||
required: true
|
||||
prerelease:
|
||||
description: "Is this a prerelease?"
|
||||
required: true
|
||||
type: boolean
|
||||
custom_message:
|
||||
description: "Optional pre-changelog message"
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
collect-release:
|
||||
name: Release ${{ github.event.inputs.tag_name }} Builds
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download Windows Full Build
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: windows.yml
|
||||
name: Codename Engine
|
||||
path: artifacts/windows/full_build
|
||||
allow_forks: false
|
||||
|
||||
- name: Download Windows Executable
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: windows.yml
|
||||
name: Codename Engine (Executable Only)
|
||||
path: artifacts/windows/executable
|
||||
allow_forks: false
|
||||
|
||||
- name: Download Mac OS Full Build
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: macos.yml
|
||||
name: Codename Engine
|
||||
path: artifacts/macos/full_build
|
||||
allow_forks: false
|
||||
|
||||
- name: Download Mac OS Executable
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: macos.yml
|
||||
name: Codename Engine (Executable Only)
|
||||
path: artifacts/macos/executable
|
||||
allow_forks: false
|
||||
|
||||
- name: Download Linux Full Build
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: linux.yml
|
||||
name: Codename Engine
|
||||
path: artifacts/linux/full_build
|
||||
allow_forks: false
|
||||
|
||||
- name: Download Linux Executable
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: linux.yml
|
||||
name: Codename Engine (Executable Only)
|
||||
path: artifacts/linux/executable
|
||||
allow_forks: false
|
||||
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
mkdir -p renamed
|
||||
|
||||
# Windows
|
||||
mv artifacts/windows/executable/CodenameEngine.exe renamed/update-windows.exe
|
||||
cd artifacts/windows/full_build
|
||||
zip -r ../../../renamed/"Codename Engine-Windows.zip" *
|
||||
cd -
|
||||
|
||||
# Mac OS
|
||||
mv artifacts/macos/executable/CodenameEngine renamed/update-mac
|
||||
cd artifacts/macos/full_build
|
||||
if [ -f CodenameEngine.tar.gz ]; then
|
||||
# Keep tar.gz as-is
|
||||
cp CodenameEngine.tar.gz ../../../renamed/"Codename Engine-Mac.tar.gz"
|
||||
else
|
||||
# Zip contents at root
|
||||
zip -r ../../../renamed/"Codename Engine-Mac.zip" *
|
||||
fi
|
||||
cd -
|
||||
|
||||
# Linux
|
||||
mv artifacts/linux/executable/CodenameEngine renamed/update-linux
|
||||
cd artifacts/linux/full_build
|
||||
zip -r ../../../renamed/"Codename Engine-Linux.zip" *
|
||||
cd -
|
||||
|
||||
- name: Find Base Release
|
||||
id: get_base_release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "Looking for base release..."
|
||||
PRERELEASE="${{ github.event.inputs.prerelease }}"
|
||||
|
||||
if [[ "$PRERELEASE" == "true" ]]; then
|
||||
BASE=$(gh release list --repo ${{ github.repository }} --json tagName,isPrerelease,isDraft \
|
||||
-L 50 -q '.[] | select(.isPrerelease==false and .isDraft==false) | .tagName' | head -n 1)
|
||||
|
||||
if [ -z "$BASE" ]; then
|
||||
echo "No stable release found, resorting to prereleases."
|
||||
BASE=$(gh release list --repo ${{ github.repository }} --json tagName,isDraft \
|
||||
-L 1 -q '.[] | select(.isDraft==false) | .tagName')
|
||||
fi
|
||||
else
|
||||
BASE=$(gh release list --repo ${{ github.repository }} --json tagName,isPrerelease,isDraft \
|
||||
-L 50 -q '.[] | select(.isPrerelease==false and .isDraft==false) | .tagName' | head -n 1)
|
||||
fi
|
||||
|
||||
if [ -z "$BASE" ]; then
|
||||
echo "No older release found; please make sure to have at least one older release containing the 'update-assets.zip' file in order to generate the differences."
|
||||
exit 1
|
||||
else
|
||||
echo "Base release: $BASE"
|
||||
echo "base_release=$BASE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Prepare update-assets.zip
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "Looking for 'update-assets.zip' from release '${{ steps.get_base_release.outputs.base_release }}'"
|
||||
ASSETS=$(gh release view "${{ steps.get_base_release.outputs.base_release }}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--json assets \
|
||||
| jq -r '.assets[].name')
|
||||
|
||||
if echo "$ASSETS" | grep -xq "update-assets.zip"; then
|
||||
mkdir -p update_assets_temp renamed
|
||||
echo "Downloading assets from release '${{ steps.get_base_release.outputs.base_release }}'"
|
||||
gh release download "${{ steps.get_base_release.outputs.base_release }}" \
|
||||
--repo ${{ github.repository }} \
|
||||
--pattern "update-assets.zip" \
|
||||
-D update_assets_temp
|
||||
|
||||
unzip -q update_assets_temp/update-assets.zip -d update_assets_temp
|
||||
cd update_assets_temp
|
||||
zip -r ../renamed/update-assets.zip . -i assets
|
||||
else
|
||||
echo "No 'update-assets.zip' file found in release '${{ steps.get_base_release.outputs.base_release }}'; please make sure to have this file in that older release in order to generate the differences."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Prepare pre-changelog message
|
||||
id: pre_changelog_message
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
echo "Preparing a pre-changelog message..."
|
||||
|
||||
BODY="If you would like to download the full builds of the engine from this release, please ignore the files starting with 'update-' as they're needed for the engine's internal autoupdater.\n\n"
|
||||
|
||||
if [ -n "${{ github.event.inputs.custom_message }}" ]; then
|
||||
BODY="${{ github.event.inputs.custom_message }}\n${BODY}"
|
||||
fi
|
||||
|
||||
{
|
||||
echo "body<<EOF"
|
||||
echo -e "$BODY"
|
||||
echo "EOF"
|
||||
} >> $GITHUB_OUTPUT
|
||||
echo -e "Final pre-changelog message:\n\n$BODY"
|
||||
|
||||
- name: Create GitHub Release with Assets
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.tag_name }}
|
||||
name: Release ${{ github.event.inputs.tag_name }}
|
||||
draft: true
|
||||
prerelease: ${{ github.event.inputs.prerelease }}
|
||||
body: ${{ steps.build_body.outputs.body }}
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
renamed/Codename Engine-Windows.zip
|
||||
renamed/Codename Engine-Mac.zip
|
||||
renamed/Codename Engine-Mac.tar.gz
|
||||
renamed/Codename Engine-Linux.zip
|
||||
renamed/update-assets.zip
|
||||
renamed/update-windows.exe
|
||||
renamed/update-mac
|
||||
renamed/update-linux
|
||||
@@ -1,139 +0,0 @@
|
||||
name: Windows Builds
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Windows Build
|
||||
permissions: write-all
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-windows
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/windows/haxe/
|
||||
export/release/windows/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s --no-vscheck
|
||||
- name: Building the game
|
||||
run: |
|
||||
haxelib run lime build windows -DCOMPILE_EXPERIMENTAL
|
||||
- name: Uploading artifact (executable)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine (Executable Only)
|
||||
path: export/release/windows/bin/CodenameEngine.exe
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine
|
||||
path: export/release/windows/bin
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-windows") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-windows
|
||||
path: |
|
||||
.haxelib/
|
||||
export/release/windows/haxe/
|
||||
export/release/windows/obj/
|
||||
|
||||
# didnt compile debug in the same job or github would have said that job wasn't completed until debug was done too (debug uploads are not essential)
|
||||
debug_build:
|
||||
name: Windows Debug Build
|
||||
permissions: write-all
|
||||
runs-on: windows-latest
|
||||
needs: build # since its low priority, it'll run after, so actions will concentrate first on normal builds
|
||||
steps:
|
||||
- name: Pulling the new commit
|
||||
uses: actions/checkout@v4
|
||||
- name: Setting up Haxe
|
||||
uses: krdlab/setup-haxe@v2
|
||||
with:
|
||||
haxe-version: 4.3.7
|
||||
- name: Restore existing build cache for faster compilation
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# not caching the bin folder to prevent asset duplication and stuff like that
|
||||
key: cache-build-windows-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/windows/haxe/
|
||||
export/debug/windows/obj/
|
||||
- run: |
|
||||
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
|
||||
- name: Installing/Updating libraries
|
||||
run: |
|
||||
haxe -cp commandline -D analyzer-optimize --run Main setup -s --no-vscheck
|
||||
- name: Building the game
|
||||
run: |
|
||||
haxelib run lime build windows -debug
|
||||
- name: Uploading artifact (entire build)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Codename Engine Debug
|
||||
path: export/debug/windows/bin
|
||||
- name: Clearing already existing cache
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const caches = await github.rest.actions.getActionsCacheList({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
})
|
||||
for (const cache of caches.data.actions_caches) {
|
||||
if (cache.key == "cache-build-windows-debug") {
|
||||
console.log('Clearing ' + cache.key + '...')
|
||||
await github.rest.actions.deleteActionsCacheById({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
cache_id: cache.id,
|
||||
})
|
||||
console.log("Cache cleared.")
|
||||
}
|
||||
}
|
||||
- name: Uploading new cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
# caching again since for some reason it doesnt work with the first post cache shit
|
||||
key: cache-build-windows-debug
|
||||
path: |
|
||||
.haxelib/
|
||||
export/debug/windows/haxe/
|
||||
export/debug/windows/obj/
|
||||
@@ -8,7 +8,9 @@ import lime.media.AudioBuffer;
|
||||
import lime.text.Font;
|
||||
import lime.utils.Bytes;
|
||||
import openfl.utils.AssetLibrary;
|
||||
#if sys
|
||||
import sys.io.File;
|
||||
#end
|
||||
|
||||
#if MOD_SUPPORT
|
||||
import funkin.backend.utils.SysZip.SysZipEntry;
|
||||
|
||||
@@ -21,8 +21,10 @@ import openfl.Lib;
|
||||
import openfl.display.Sprite;
|
||||
import openfl.text.TextFormat;
|
||||
import openfl.utils.AssetLibrary;
|
||||
#if sys
|
||||
import sys.FileSystem;
|
||||
import sys.io.File;
|
||||
#end
|
||||
#if android
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
@@ -59,7 +61,9 @@ class Main extends Sprite
|
||||
|
||||
public static function preInit() {
|
||||
funkin.backend.utils.NativeAPI.registerAsDPICompatible();
|
||||
#if sys
|
||||
funkin.backend.system.CommandLineHandler.parseCommandLine(Sys.args());
|
||||
#end
|
||||
funkin.backend.system.Main.fixWorkingDirectory();
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,16 @@ class MainState extends FlxState {
|
||||
CoolUtil.safeAddAttributes('./.temp/', NativeAPI.FileAttribute.HIDDEN);
|
||||
#end
|
||||
|
||||
#if MOD_SUPPORT
|
||||
for (lib in ModsFolder.getLoadedModsLibs()) {
|
||||
if (!(lib is ZipFolderLibrary)) continue;
|
||||
if (cast(lib, ZipFolderLibrary).PRELOAD_VIDEOS) cast(lib, ZipFolderLibrary).precacheVideos();
|
||||
}
|
||||
#end
|
||||
|
||||
var startState:Class<FlxState> = Flags.DISABLE_WARNING_SCREEN ? TitleState : funkin.menus.WarningState;
|
||||
|
||||
#if MOD_SUPPORT
|
||||
// In this case if the mod we just loaded a compressed modpack, we can't edit or modify files without decompressing it.
|
||||
if (Options.devMode && Options.allowConfigWarning && !isZipMod) {
|
||||
var lib:ModsFolderLibrary;
|
||||
@@ -176,6 +179,7 @@ class MainState extends FlxState {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
FlxG.switchState(cast Type.createInstance(startState, []));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package funkin.backend.utils;
|
||||
|
||||
import flixel.sound.FlxSound;
|
||||
import lime.media.AudioBuffer;
|
||||
#if !js
|
||||
import lime.utils.ArrayBufferView.ArrayBufferIO;
|
||||
#end
|
||||
import lime.utils.ArrayBuffer;
|
||||
|
||||
#if (lime_cffi && lime_vorbis)
|
||||
@@ -30,6 +32,7 @@ final class AudioAnalyzer {
|
||||
* @param wordSize How many bytes to get with to one byte (Usually it's bitsPerSample / 8 or bitsPerSample >> 3).
|
||||
* @return Byte from the audio buffer with specified position.
|
||||
*/
|
||||
#if sys
|
||||
public static function getByte(buffer:ArrayBuffer, position:Int, wordSize:Int):Int {
|
||||
if (wordSize == 2) return inline ArrayBufferIO.getInt16(buffer, position);
|
||||
else if (wordSize == 3) {
|
||||
@@ -40,6 +43,19 @@ final class AudioAnalyzer {
|
||||
else if (wordSize == 4) return inline ArrayBufferIO.getInt32(buffer, position);
|
||||
else return inline ArrayBufferIO.getUint8(buffer, position) - 128;
|
||||
}
|
||||
#elseif js
|
||||
public static function getByte(buffer:lime.utils.UInt8Array, position:Int, wordSize:Int):Int {
|
||||
var view = new lime.utils.DataView(buffer.buffer);
|
||||
if (wordSize == 2) return inline view.getInt16(position, true);
|
||||
else if (wordSize == 3) {
|
||||
var b = inline view.getUint16(position, true) | (view.getUint8(position + 2) << 16);
|
||||
if (b & 0x800000 != 0) return b - 0x1000000;
|
||||
else return b;
|
||||
}
|
||||
else if (wordSize == 4) return inline view.getInt32(position, true);
|
||||
else return inline view.getUint8(position) - 128;
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* Gets levels from the frequencies with specified sample rate.
|
||||
@@ -450,12 +466,16 @@ final class AudioAnalyzer {
|
||||
}
|
||||
|
||||
inline function __readData(startPos:Float, endPos:Float, callback:AudioAnalyzerCallback) {
|
||||
var pos = Math.floor(startPos * __toBits), end = Math.min(Math.floor(endPos * __toBits), buffer.data.buffer.length), c = 0;
|
||||
var pos = Math.floor(startPos * __toBits), end = Math.min(Math.floor(endPos * __toBits), buffer.data.buffer.byteLength), c = 0;
|
||||
pos -= pos % __sampleSize;
|
||||
end -= end % __sampleSize;
|
||||
|
||||
while (pos < end) {
|
||||
#if sys
|
||||
callback(getByte(buffer.data.buffer, pos, __wordSize), c);
|
||||
#elseif js
|
||||
callback(getByte(buffer.data, pos, __wordSize), c);
|
||||
#end
|
||||
if (++c > buffer.channels) c = 0;
|
||||
pos += __wordSize;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.backend.utils;
|
||||
|
||||
import lime.utils.AssetType;
|
||||
#if cpp
|
||||
import cpp.Float64;
|
||||
#end
|
||||
@@ -1240,9 +1241,9 @@ final class CoolUtil
|
||||
* @return Bool
|
||||
*/
|
||||
public static function imageHasFrameData(path:String):String {
|
||||
if (FileSystem.exists(Path.withExtension(path, "xml"))) return "xml";
|
||||
if (FileSystem.exists(Path.withExtension(path, "txt"))) return "txt";
|
||||
if (FileSystem.exists(Path.withExtension(path, "json"))) return "json";
|
||||
if (Paths.assetsTree.existsSpecific(Path.withExtension(path, "xml"), AssetType.TEXT)) return "xml";
|
||||
if (Paths.assetsTree.existsSpecific(Path.withExtension(path, "txt"), AssetType.TEXT)) return "txt";
|
||||
if (Paths.assetsTree.existsSpecific(Path.withExtension(path, "json"), AssetType.TEXT)) return "json";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package funkin.backend.utils;
|
||||
|
||||
#if !macro
|
||||
import funkin.backend.system.Logs;
|
||||
#end
|
||||
#if (target.threaded)
|
||||
import sys.thread.Deque;
|
||||
import sys.thread.Thread;
|
||||
@@ -8,9 +11,6 @@ import sys.thread.Mutex;
|
||||
private typedef Thread = Dynamic;
|
||||
#end
|
||||
|
||||
#if !macro
|
||||
import funkin.backend.system.Logs;
|
||||
#end
|
||||
|
||||
final class ThreadUtil {
|
||||
inline static function error(text:String) {
|
||||
|
||||
@@ -254,6 +254,7 @@ final class TranslationUtil
|
||||
|
||||
// todo make it load the default languages in a second string map
|
||||
|
||||
#if MOD_SUPPORT
|
||||
for(mod in ModsFolder.getLoadedModsLibs(true)) for(file in mod.getFiles("assets/" + mainPath).sortAlphabetically().map((v)->'$mainPath/$v')) {
|
||||
if(Path.extension(file).toLowerCase() != "xml") continue;
|
||||
|
||||
@@ -277,6 +278,7 @@ final class TranslationUtil
|
||||
|
||||
parseXml(langNode, prefix);
|
||||
}
|
||||
#end
|
||||
|
||||
for(pair in translations) {
|
||||
var node = pair.node;
|
||||
|
||||
@@ -17,8 +17,10 @@ import funkin.game.Character;
|
||||
import haxe.xml.Access;
|
||||
import haxe.xml.Printer;
|
||||
import funkin.editors.ui.UIImageExplorer.ImageSaveData;
|
||||
#if sys
|
||||
import sys.FileSystem;
|
||||
import sys.io.File;
|
||||
#end
|
||||
|
||||
class CharacterEditor extends UIState {
|
||||
static var __character:String;
|
||||
@@ -518,6 +520,7 @@ class CharacterEditor extends UIState {
|
||||
characterPropertiesWindow.editCharacterInfo(oldInfo, false);
|
||||
case CCharEditSprite(fileID):
|
||||
var cneisdPath:String = './.temp/__undo__${Type.getClassName(Type.getClass(FlxG.state))}__${fileID}.cneisd';
|
||||
#if sys
|
||||
if (FileSystem.exists(cneisdPath)) {
|
||||
try {
|
||||
var cneisdData:String = File.getContent(cneisdPath);
|
||||
@@ -530,6 +533,7 @@ class CharacterEditor extends UIState {
|
||||
trace('ERROR COMPLETING UNDO: $e');
|
||||
};
|
||||
}
|
||||
#end
|
||||
case CAnimCreate(animID, animData):
|
||||
characterAnimsWindow.deleteAnimation(characterAnimsWindow.buttons.members[animID], false);
|
||||
case CAnimDelete(animID, animData):
|
||||
@@ -592,6 +596,7 @@ class CharacterEditor extends UIState {
|
||||
characterPropertiesWindow.editCharacterInfo(newInfo, false);
|
||||
case CCharEditSprite(fileID):
|
||||
var cneisdPath:String = './.temp/__redo__${Type.getClassName(Type.getClass(FlxG.state))}__${fileID}.cneisd';
|
||||
#if sys
|
||||
if (FileSystem.exists(cneisdPath)) {
|
||||
try {
|
||||
var cneisdData:String = File.getContent(cneisdPath);
|
||||
@@ -604,6 +609,7 @@ class CharacterEditor extends UIState {
|
||||
trace('ERROR COMPLETING UNDO: $e');
|
||||
};
|
||||
}
|
||||
#end
|
||||
case CAnimCreate(animID, animData):
|
||||
characterAnimsWindow.addAnimation(animData, animID, false);
|
||||
playAnimation(animData.name);
|
||||
|
||||
@@ -371,12 +371,14 @@ class SongCreationScreen extends UISubstateWindow {
|
||||
{
|
||||
case 2 /*"V-Slice Project (.fnfc)"*/:
|
||||
var files:Map<String, Any> = [];
|
||||
#if sys
|
||||
for (field in new ZipReader(new BytesInput(importChartFile.file)).read()) {
|
||||
var fileName = field.fileName;
|
||||
var fileContent = ZipUtil.unzip(field);
|
||||
files.set(fileName, fileContent);
|
||||
}
|
||||
saveFromVSlice(files);
|
||||
#end
|
||||
case 1 /*"V-Slice"*/:
|
||||
var songId = importIdTextBox.label.text;
|
||||
var files:Map<String, Any> = [];
|
||||
|
||||
@@ -62,7 +62,11 @@ class UIFileExplorer extends UISliceSprite {
|
||||
}
|
||||
|
||||
public function loadFile(path:String) {
|
||||
#if sys
|
||||
file = cast sys.io.File.getBytes(filePath = path);
|
||||
#else
|
||||
file = null;
|
||||
#end
|
||||
deleteButton.visible = deleteButton.selectable = deleteIcon.visible = !(uploadButton.visible = uploadButton.selectable = false);
|
||||
|
||||
if (this.onFile != null) this.onFile(filePath, file);
|
||||
|
||||
@@ -8,8 +8,10 @@ import haxe.Json;
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.Path;
|
||||
import openfl.display.BitmapData;
|
||||
#if sys
|
||||
import sys.FileSystem;
|
||||
import sys.io.File;
|
||||
#end
|
||||
import animate.FlxAnimateJson;
|
||||
|
||||
using StringTools;
|
||||
@@ -60,13 +62,19 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
directoryBG.members.push(directoryTextBox);
|
||||
|
||||
if (image != null) {
|
||||
#if sys
|
||||
var fullImagePath:String = '${Path.normalize(Sys.getCwd())}/${Paths.image(image)}'.replace('/', '\\');
|
||||
#else
|
||||
var fullImagePath = null;
|
||||
#end
|
||||
var noExt = Path.withoutExtension(fullImagePath);
|
||||
#if sys
|
||||
if (FileSystem.exists('$noExt\\spritemap1.png'))
|
||||
fullImagePath = '$noExt\\spritemap1.png';
|
||||
|
||||
if (FileSystem.exists(fullImagePath))
|
||||
loadFile(fullImagePath);
|
||||
#end
|
||||
}
|
||||
|
||||
allowDirectories = CoolUtil.isMapEmpty(imageFiles); __firstLoad = false;
|
||||
@@ -100,7 +108,11 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
// CHECK ATLAS
|
||||
if(allowAtlases && ANIMATE_ATLAS_REGEX.match(fileName)) {
|
||||
// check if directory has the other files
|
||||
#if sys
|
||||
files = FileSystem.readDirectory(directoryPath);
|
||||
#else
|
||||
files = null;
|
||||
#end
|
||||
var hasAnimationJson:Bool = false;
|
||||
var hasSpritemapJson:Bool = false;
|
||||
for(file in files) {
|
||||
@@ -116,12 +128,20 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
}
|
||||
} else if(allowAtlases && Path.extension(fileName) == "png") {
|
||||
// check if the spritemap json files point to the image
|
||||
#if sys
|
||||
files = FileSystem.readDirectory(directoryPath);
|
||||
#else
|
||||
files = null;
|
||||
#end
|
||||
var hasAnimationJson:Bool = false;
|
||||
var foundSpritemapJson:Bool = false;
|
||||
for(file in files) {
|
||||
if(SPRITEMAP_JSON_REGEX.match(file)) {
|
||||
#if sys
|
||||
var content:String = CoolUtil.removeBOM(File.getContent(Path.join([directoryPath, file])));
|
||||
#else
|
||||
var content = null;
|
||||
#end
|
||||
var json:SpritemapJson = Json.parse(content);
|
||||
if(json.meta.image.toLowerCase() == fileName.toLowerCase())
|
||||
foundSpritemapJson = true;
|
||||
@@ -146,7 +166,11 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
|
||||
spritemaps.sort(Reflect.compare);
|
||||
for(spritemap in spritemaps) {
|
||||
#if sys
|
||||
var content:String = CoolUtil.removeBOM(File.getContent(Path.join([directoryPath, spritemap])));
|
||||
#else
|
||||
var content = null;
|
||||
#end
|
||||
var json:SpritemapJson = Json.parse(content);
|
||||
var imageToFind:String = json.meta.image.toLowerCase();
|
||||
for(file in files) {
|
||||
@@ -168,17 +192,23 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
if (isAtlas) {
|
||||
var dataPath:String = '$directoryPath/Animation.json'.replace('/', '\\');
|
||||
|
||||
#if sys
|
||||
if (FileSystem.exists(dataPath)) {
|
||||
var dataPathFile:String = File.getContent(dataPath);
|
||||
animationList = CoolUtil.getAnimsListFromAtlas(cast haxe.Json.parse(dataPathFile));
|
||||
|
||||
imageFiles.set(Path.withoutDirectory(dataPath), dataPathFile);
|
||||
}
|
||||
#end
|
||||
} else {
|
||||
var dataPathExt:String = CoolUtil.imageHasFrameData(imagePath);
|
||||
var dataPath:String = Path.withExtension(imagePath, dataPathExt);
|
||||
#if sys
|
||||
var dataPathFile:String = !isAtlas && dataPathExt != null ? File.getContent(dataPath) : null;
|
||||
|
||||
#else
|
||||
var dataPathFile = null;
|
||||
#end
|
||||
|
||||
if (dataPathExt != null) {
|
||||
frames = CoolUtil.loadFramesFromData(dataPathFile, dataPathExt);
|
||||
animationList = CoolUtil.getAnimsListFromFrames(frames, dataPathExt);
|
||||
@@ -200,14 +230,24 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
for(spritemap in spritemapImages) {
|
||||
var spritemapPath:String = Path.join([directoryPath, spritemap]);
|
||||
|
||||
#if sys
|
||||
var info = FileSystem.stat(spritemapPath);
|
||||
#else
|
||||
var info = null;
|
||||
#end
|
||||
size += info.size;
|
||||
|
||||
spritemapPath = spritemapPath.replace('/', '\\');
|
||||
#if sys
|
||||
imageFiles.set(Path.withoutDirectory(spritemapPath), sys.io.File.getBytes(spritemapPath));
|
||||
#end
|
||||
}
|
||||
|
||||
#if sys
|
||||
file = cast sys.io.File.getBytes(filePath = spritemapPath);
|
||||
#else
|
||||
file = null;
|
||||
#end
|
||||
image = BitmapData.fromBytes(file).crop();
|
||||
|
||||
} else {
|
||||
@@ -321,12 +361,16 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
|
||||
var alreadlyExistingFiles:Array<String> = [];
|
||||
for (name => file in imageData.imageFiles)
|
||||
#if sys
|
||||
if (FileSystem.exists('$directory/$name'))
|
||||
alreadlyExistingFiles.push('$directory/$name');
|
||||
#end
|
||||
|
||||
function deleteExistingFiles() {
|
||||
#if sys
|
||||
for (file in alreadlyExistingFiles)
|
||||
FileSystem.deleteFile(file);
|
||||
#end
|
||||
alreadlyExistingFiles = [];
|
||||
}
|
||||
|
||||
@@ -346,8 +390,10 @@ class UIImageExplorer extends UIFileExplorer {
|
||||
label: TU.translate("uiImageExplorer.override"),
|
||||
color: 0xFFFF0000,
|
||||
onClick: (_) -> {
|
||||
#if sys
|
||||
deleteExistingFiles();
|
||||
acuttalySaveFiles();
|
||||
#end
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package funkin.game;
|
||||
|
||||
#if sys
|
||||
import sys.FileSystem;
|
||||
#end
|
||||
import flixel.util.FlxSpriteUtil;
|
||||
import openfl.display.Graphics;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
|
||||
@@ -35,4 +35,9 @@ class Config {
|
||||
public static final DISALLOW_ABSTRACT_AND_ENUM = [
|
||||
"funkin.backend.scripting.events.sprite.PlayAnimContext", // Error: expected member name or ';' after declaration specifiers, Due to define macro from math.h
|
||||
];
|
||||
}
|
||||
|
||||
@:unreflective
|
||||
public static final IMPORT_BLACKLIST:Array<String> = [
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class HTML5AudioSource
|
||||
private var parent:AudioSource;
|
||||
private var playing:Bool;
|
||||
private var position:Vector4;
|
||||
private var loopTime:Float;
|
||||
|
||||
public function new(parent:AudioSource)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user