-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release maker bug fix & script update (#58)
- Loading branch information
1 parent
42412ce
commit 8f255fb
Showing
13 changed files
with
450 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
on: [push, pull_request, workflow_dispatch] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-20.04 | ||
|
@@ -11,28 +11,5 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: git clone https://github.com/daeken/ldid.git | ||
- run: cd ldid && ./make.sh | ||
- run: rm -rf ./release_make/release-builds | ||
- run: mkdir -p ./release_make/release-builds/win/x64 | ||
- run: mkdir -p ./release_make/release-builds/linux/x64 | ||
- run: mkdir -p ./release_make/release-builds/macos/x64 | ||
- run: mkdir -p ./release_make/release-builds/win/arm64 | ||
- run: mkdir -p ./release_make/release-builds/linux/arm64 | ||
- run: mkdir -p ./release_make/release-builds/macos/arm64 | ||
- run: npm install pkg | ||
- run: npm install [email protected] | ||
- run: if [[ "$(npx pkg ./release_make --target win-x64 --output ./release-builds/win/x64/FairyGround.exe | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target win-x64 --output ./release-builds/win/x64/FairyGround.exe; fi | ||
- run: if [[ "$(npx pkg ./release_make --target linux-x64 --output ./release-builds/linux/x64/FairyGround | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target linux-x64 --output ./release-builds/linux/x64/FairyGround; fi | ||
- run: if [[ "$(npx pkg ./release_make --target win-arm64 --output ./release-builds/win/arm64/FairyGround.exe | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target win-arm64 --output ./release-builds/win/arm64/FairyGround.exe; fi | ||
- run: if [[ "$(npx pkg ./release_make --target linux-arm64 --output ./release-builds/linux/arm64/FairyGround | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target linux-arm64 --output ./release-builds/linux/arm64/FairyGround; fi | ||
- run: export PATH="$PATH:$(pwd)/ldid" && if [[ "$(npx pkg ./release_make --target macos-x64 --output ./release-builds/macos/x64/FairyGround.app | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target macos-x64 --output ./release-builds/macos/x64/FairyGround.app; fi | ||
- run: export PATH="$PATH:$(pwd)/ldid" && if [[ "$(npx pkg ./release_make --target macos-arm64 --output ./release-builds/macos/arm64/FairyGround.app | grep 'Failed to make bytecode')" == "" ]]; then echo "Pass."; else echo "Fail: Bytecode generation failed. Trying --no-bytecode..." & npx pkg ./release_make --no-bytecode --public --public-packages --target macos-arm64 --output ./release-builds/macos/arm64/FairyGround.app; fi | ||
- run: npm install | ||
- run: npm run build | ||
- run: cp -r ./public ./release_make/release-builds/win/x64/ | ||
- run: cp -r ./public ./release_make/release-builds/win/arm64/ | ||
- run: cp -r ./public ./release_make/release-builds/linux/x64/ | ||
- run: cp -r ./public ./release_make/release-builds/linux/arm64/ | ||
- run: cp -r ./public ./release_make/release-builds/macos/x64/ | ||
- run: cp -r ./public ./release_make/release-builds/macos/arm64/ | ||
- run: chmod 744 ./release_make/CI.sh | ||
- run: ./release_make/CI.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/bash | ||
|
||
echo "[Warning] This script is intended to be run in Github Actions for continuous integration purposes." | ||
echo "[Warning] If this is your own platform instead of Github Actions platform, use \"./make.sh\"." | ||
|
||
function Error() { | ||
echo "[Error] CI build test failed." | ||
exit 1 | ||
} | ||
|
||
export nodeversion="node18" | ||
|
||
cd ./release_make | ||
|
||
chmod -R 744 $(pwd)/ldid | ||
|
||
if [ "$(lscpu | grep 'x86_64')" != "" ]; then | ||
export PATH="$PATH:$(pwd)/ldid/linux/x64" | ||
elif [ "$(lscpu | grep 'ARM64')" != "" ]; then | ||
export PATH="$PATH:$(pwd)/ldid/linux/arm64" | ||
else | ||
echo Unknown CPU architecture: | ||
lscpu | grep 'Architecture:' | ||
Error | ||
fi | ||
|
||
rm -rf ./release-builds | ||
mkdir -p ./release-builds/win/x64 | ||
mkdir -p ./release-builds/linux/x64 | ||
mkdir -p ./release-builds/win/arm64 | ||
mkdir -p ./release-builds/linux/arm64 | ||
mkdir -p ./release-builds/macos/x64 | ||
mkdir -p ./release-builds/macos/arm64 | ||
|
||
npm install || Error | ||
npm install pkg || Error | ||
|
||
function TryNoByteCode() { | ||
npx pkg . --no-bytecode --public --public-packages --target $1 --output $2 >/tmp/make_fairyground.log 2>&1 | ||
if [ "$(grep 'Error' /tmp/make_fairyground.log)" != "" ]; then | ||
echo "[Error] CI failed. Check the log below to see what\'s going on. File: /tmp/make_fairyground.log" | ||
cat /tmp/make_fairyground.log | ||
return 11 | ||
fi | ||
if [ "$(grep 'Warning' /tmp/make_fairyground.log)" != "" ]; then | ||
cat /tmp/make_fairyground.log | ||
fi | ||
return 0 | ||
} | ||
|
||
function Make() { | ||
npx pkg . --target $1 --output $2 >/tmp/make_fairyground.log 2>&1 | ||
if [ "$(grep 'Error' /tmp/make_fairyground.log)" != "" ]; then | ||
echo "[Warning] Fail: Bytecode generation failed. Trying --no-bytecode..." | ||
TryNoByteCode $1 $2 | ||
if [ $? -eq 11 ]; then | ||
return 11 | ||
fi | ||
echo "[Info] Pass: $1" | ||
return 0 | ||
fi | ||
if [ "$(grep 'Failed to make bytecode' /tmp/make_fairyground.log)" != "" ]; then | ||
echo "[Warning] Fail: Bytecode generation failed. Trying --no-bytecode..." | ||
TryNoByteCode $1 $2 | ||
if [ $? -eq 11 ]; then | ||
return 11 | ||
fi | ||
echo "[Info] Pass: $1" | ||
return 0 | ||
fi | ||
if [ "$(grep 'Warning' /tmp/make_fairyground.log)" != "" ]; then | ||
cat /tmp/make_fairyground.log | ||
fi | ||
echo "[Info] Pass: $1" | ||
return 0 | ||
} | ||
|
||
|
||
Make "$nodeversion"-win-x64 ./release-builds/win/x64/FairyGround.exe | ||
if [ $? -eq 11 ]; then Error; fi | ||
Make "$nodeversion"-linux-x64 ./release-builds/linux/x64/FairyGround | ||
if [ $? -eq 11 ]; then Error; fi | ||
Make "$nodeversion"-win-arm64 ./release-builds/win/arm64/FairyGround.exe | ||
if [ $? -eq 11 ]; then Error; fi | ||
Make "$nodeversion"-linux-arm64 ./release-builds/linux/arm64/FairyGround | ||
if [ $? -eq 11 ]; then Error; fi | ||
Make "$nodeversion"-macos-x64 ./release-builds/macos/x64/FairyGround.app | ||
if [ $? -eq 11 ]; then Error; fi | ||
Make "$nodeversion"-macos-arm64 ./release-builds/macos/arm64/FairyGround.app | ||
if [ $? -eq 11 ]; then Error; fi | ||
|
||
cd .. | ||
npm install || Error | ||
npm run build || Error | ||
cp -r ./public ./release_make/release-builds/win/x64/ | ||
cp -r ./public ./release_make/release-builds/linux/x64/ | ||
cp -r ./public ./release_make/release-builds/win/arm64/ | ||
cp -r ./public ./release_make/release-builds/linux/arm64/ | ||
cp -r ./public ./release_make/release-builds/macos/x64/ | ||
cp -r ./public ./release_make/release-builds/macos/arm64/ | ||
echo "[Warning] The macOS executables are not suitably signed yet. If you want them to work, you need to be an Apple Developer and sign it with your signing certificate." | ||
echo "[Warning] Use codesign on macOS to sign your executable. If you don't have a Mac, you can use a virtual machine." | ||
echo "[Warning] If you want to build a macOS virtual machine, please visit https://www.sysnettechsolutions.com/en/install-macos-vmware/" | ||
echo "[Info] CI build test OK." | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,116 @@ | ||
@echo off | ||
SETLOCAL ENABLEEXTENSIONS | ||
set nodeversion=node18 | ||
cd /d "%~dp0" | ||
rd /s /q .\release-builds | ||
md .\release-builds || goto error | ||
md .\release-builds\win || goto error | ||
md .\release-builds\linux || goto error | ||
md .\release-builds\macos || goto error | ||
md .\release-builds\win\x64 || goto error | ||
md .\release-builds\linux\x64 || goto error | ||
md .\release-builds\win\arm64 || goto error | ||
md .\release-builds\linux\arm64 || goto error | ||
md .\release-builds\macos\x64 || goto error | ||
md .\release-builds\macos\arm64 || goto error | ||
md .\release-builds || goto Error | ||
md .\release-builds\win || goto Error | ||
md .\release-builds\linux || goto Error | ||
md .\release-builds\macos || goto Error | ||
md .\release-builds\win\x64 || goto Error | ||
md .\release-builds\linux\x64 || goto Error | ||
md .\release-builds\win\arm64 || goto Error | ||
md .\release-builds\linux\arm64 || goto Error | ||
md .\release-builds\macos\x64 || goto Error | ||
md .\release-builds\macos\arm64 || goto Error | ||
|
||
echo What is the CPU architecture of your build platform (This computer)? (Enter x86_64 or ARM64) | ||
set /P input=^> | ||
if "%input%"=="ARM64" ( | ||
set arch=arm64 | ||
) else if "%input%"=="x86_64" ( | ||
set arch=x64 | ||
) else ( | ||
echo Bad input. Build failed. | ||
pause | ||
exit /b 1 | ||
) | ||
|
||
set PATH=%PATH%;%~dp0ldid\win\%arch% | ||
|
||
::Platforms include x86, x64, arm, arm64 | ||
(start /wait "" npm install -g pkg ^& exit) || goto error | ||
(start /wait "" pkg . --target win-x64 --output .\release-builds\win\x64\FairyGround.exe ^& exit) || goto error | ||
(start /wait "" pkg . --target linux-x64 --output .\release-builds\linux\x64\FairyGround ^& exit) || goto error | ||
(start /wait "" pkg . --target win-arm64 --output .\release-builds\win\arm64\FairyGround.exe ^& exit) || goto error | ||
(start /wait "" pkg . --target linux-arm64 --output .\release-builds\linux\arm64\FairyGround ^& exit) || goto error | ||
(start /wait "" pkg . --target macos-x64 --output .\release-builds\macos\x64\FairyGround ^& exit) || goto error | ||
(start /wait "" pkg . --target macos-arm64 --output .\release-builds\macos\arm64\FairyGround ^& exit) || goto error | ||
set result= | ||
start /wait "" cmd.exe /C npm install pkg ^> %TEMP%\make_fairyground.log ^& exit | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Error" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" (goto Error) | ||
|
||
call :Make %nodeversion%-win-x64 .\release-builds\win\x64\FairyGround.exe | ||
if "%errorlevel%"=="11" (goto Error) | ||
call :Make %nodeversion%-linux-x64 .\release-builds\linux\x64\FairyGround | ||
if "%errorlevel%"=="11" (goto Error) | ||
call :Make %nodeversion%-win-arm64 .\release-builds\win\arm64\FairyGround.exe | ||
if "%errorlevel%"=="11" (goto Error) | ||
call :Make %nodeversion%-linux-arm64 .\release-builds\linux\arm64\FairyGround | ||
if "%errorlevel%"=="11" (goto Error) | ||
call :Make %nodeversion%-macos-x64 .\release-builds\macos\x64\FairyGround.app | ||
if "%errorlevel%"=="11" (goto Error) | ||
call :Make %nodeversion%-macos-arm64 .\release-builds\macos\arm64\FairyGround.app | ||
if "%errorlevel%"=="11" (goto Error) | ||
|
||
cd .. | ||
(start /wait "" npm run buildwithcmd ^& exit) || goto error | ||
xcopy .\public .\release_make\release-builds\win\x64\public /E /H /C /I /Q || goto error | ||
xcopy .\public .\release_make\release-builds\linux\x64\public /E /H /C /I /Q || goto error | ||
xcopy .\public .\release_make\release-builds\win\arm64\public /E /H /C /I /Q || goto error | ||
xcopy .\public .\release_make\release-builds\linux\arm64\public /E /H /C /I /Q || goto error | ||
xcopy .\public .\release_make\release-builds\macos\x64\public /E /H /C /I /Q || goto error | ||
xcopy .\public .\release_make\release-builds\macos\arm64\public /E /H /C /I /Q || goto error | ||
set result= | ||
start /wait "" cmd.exe /C npm run buildwithcmd ^> %TEMP%\make_fairyground.log ^& exit | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Error" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" (goto Error) | ||
|
||
xcopy .\public .\release_make\release-builds\win\x64\public /E /H /C /I /Q || goto Error | ||
xcopy .\public .\release_make\release-builds\linux\x64\public /E /H /C /I /Q || goto Error | ||
xcopy .\public .\release_make\release-builds\win\arm64\public /E /H /C /I /Q || goto Error | ||
xcopy .\public .\release_make\release-builds\linux\arm64\public /E /H /C /I /Q || goto Error | ||
xcopy .\public .\release_make\release-builds\macos\x64\public /E /H /C /I /Q || goto Error | ||
xcopy .\public .\release_make\release-builds\macos\arm64\public /E /H /C /I /Q || goto Error | ||
echo Release build finished. Check "%~dp0release-builds\" to see the results. | ||
echo [Warning] The macOS executables are not suitably signed yet. If you want them to work, you need to be an Apple Developer and sign it with your signing certificate. | ||
echo [Warning] Use codesign on macOS to sign your executable. If you don't have a Mac, you can use a virtual machine. | ||
echo [Warning] If you want to build a macOS virtual machine, please visit https://www.sysnettechsolutions.com/en/install-macos-vmware/ | ||
pause | ||
exit /b 0 | ||
|
||
:error | ||
:Error | ||
echo Release build failed. | ||
pause | ||
exit /b 1 | ||
|
||
:Make | ||
start /WAIT /MIN "" cmd.exe /C ^(npx pkg . --target %~1 --output %2 ^& exit ^) ^> %TEMP%\make_fairyground.log 2^>^&1 | ||
set result= | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Error" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" ( | ||
echo Fail: Bytecode generation failed. Trying --no-bytecode... | ||
call :TryNoByteCode %~1 %2 | ||
if "%errorlevel%"=="11" (exit /b 11) | ||
echo Pass: %~1 | ||
exit /b 0 | ||
) | ||
set result= | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Failed to make bytecode" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" ( | ||
echo Fail: Bytecode generation failed. Trying --no-bytecode... | ||
call :TryNoByteCode %~1 %2 | ||
if "%errorlevel%"=="11" (exit /b 11) | ||
echo Pass: %~1 | ||
exit /b 0 | ||
) | ||
set result= | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Warning" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" ( | ||
type "%TEMP%\make_fairyground.log" | ||
) | ||
echo Pass: %~1 | ||
exit /b 0 | ||
|
||
:TryNoByteCode | ||
start /WAIT /MIN "" cmd.exe /C ^(npx pkg . --no-bytecode --public --public-packages --target %~1 --output %2 ^& exit ^) ^> %TEMP%\make_fairyground.log 2^>^&1 | ||
set result= | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Error" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" ( | ||
echo Error: Build failed. Check the log below to see what's going on. File: %TEMP%\make_fairyground.log | ||
type "%TEMP%\make_fairyground.log" | ||
exit /b 11 | ||
) | ||
set result= | ||
FOR /F "usebackq" %%i IN (`findstr /L /I "Warning" "%TEMP%\make_fairyground.log"`) DO set result=%%i | ||
if not "%result%"=="" ( | ||
type "%TEMP%\make_fairyground.log" | ||
) | ||
exit /b 0 |
Oops, something went wrong.