🎨 add windows nightly build

This commit is contained in:
ValKmjolnir
2025-10-10 20:30:05 +08:00
parent 8ccb5c36b8
commit 3cc47b744c
5 changed files with 105 additions and 0 deletions

View File

@@ -59,3 +59,70 @@ jobs:
draft: false
files: |
nasal-linux-x86_64.tar
windows-x86_64-build-msvc:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Deps
run: |
choco install -y cmake
- name: Update Tag
run: |
git fetch --tags origin
git tag -f next_windows_x86_64_msvc
git push -f origin next_windows_x86_64_msvc
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022"
MSBuild.exe nasal.sln /p:Configuration=Release /p:Platform=x64
- name: Package
run: |
python3 tools/msvc_move_file.py
python3 tools/pack.py msvc
- name: Release
uses: softprops/action-gh-release@v2.0.5
with:
name: windows MSVC nightly build
tag_name: next_windows_x86_64_msvc
prerelease: true
draft: false
files: |
nasal-windows-x86_64-msvc.tar
windows-x86_64-build-mingw:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Deps
run: |
choco install -y cmake
choco install -y mingw
- name: Update Tag
run: |
git fetch --tags origin
git tag -f next_windows_x86_64_mingw
git push -f origin next_windows_x86_64_mingw
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
mingw32-make.exe -j4
- name: Package
run: |
python3 tools/mingw_move_file.py
python3 tools/pack.py mingw
- name: Release
uses: softprops/action-gh-release@v2.0.5
with:
name: windows MSVC nightly build
tag_name: next_windows_x86_64_mingw
prerelease: true
draft: false
files: |
nasal-windows-x86_64-mingw.tar

View File

@@ -194,6 +194,9 @@ void repl::execute() {
}
// run program
if (source.back().back() != ';') {
source.back() += ";";
}
if (!run()) {
source.pop_back();
}

13
tools/mingw_move_file.py Normal file
View File

@@ -0,0 +1,13 @@
import os
import shutil
BUILD_DIR = "build"
if os.path.exists(f"{BUILD_DIR}\\nasal.exe"):
shutil.move(f"{BUILD_DIR}\\nasal.exe", ".\\nasal.exe")
if os.path.exists(f"{BUILD_DIR}\\nasal-format.exe"):
shutil.move(f"{BUILD_DIR}\\nasal-format.exe", ".\\nasal-format.exe")
for root, dirs, files in os.walk(f"{BUILD_DIR}"):
for file in files:
if file.endswith(".dll"):
shutil.move(os.path.join(root, file), ".\\module\\" + file)

13
tools/msvc_move_file.py Normal file
View File

@@ -0,0 +1,13 @@
import os
import shutil
BUILD_DIR = "build"
if os.path.exists(f"{BUILD_DIR}\\Release\\nasal.exe"):
shutil.move(f"{BUILD_DIR}\\Release\\nasal.exe", ".\\nasal.exe")
if os.path.exists(f"{BUILD_DIR}\\Release\\nasal-format.exe"):
shutil.move(f"{BUILD_DIR}\\Release\\nasal-format.exe", ".\\nasal-format.exe")
for root, dirs, files in os.walk(f"{BUILD_DIR}\\Release"):
for file in files:
if file.endswith(".dll"):
shutil.move(os.path.join(root, file), ".\\module\\lib" + file)

View File

@@ -3,6 +3,7 @@ import pathlib
import os
import platform
import shutil
import sys
build_directory = pathlib.Path("build")
if not os.path.exists(build_directory):
@@ -10,7 +11,11 @@ if not os.path.exists(build_directory):
exit(-1)
nasal_executable = pathlib.Path("nasal")
if platform.system() == "Windows":
nasal_executable = pathlib.Path("nasal.exe")
nasal_format_executable = pathlib.Path("nasal-format")
if platform.system() == "Windows":
nasal_format_executable = pathlib.Path("nasal-format.exe")
nasal_standard_library = pathlib.Path("std")
if not os.path.exists(nasal_executable):
print("pack binaries failed: nasal executable not found")
@@ -54,6 +59,10 @@ for m in ["libfib", "libkey", "libmat", "libnasock"]:
tar_file_name = "nasal"
if platform.system()=="Windows":
tar_file_name += "-windows-x86_64"
if len(sys.argv) == 2 and sys.argv[1] == "msvc":
tar_file_name += "-msvc"
else:
tar_file_name += "-mingw"
elif platform.system()=="Linux":
tar_file_name += "-linux-x86_64"
elif platform.system()=="Darwin":