logger - change log color #22
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
name: Build Millennium (Windows-MinGW) | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # allow fortnite wallhacks | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
steps: | |
- name: Export GitHub Actions cache environment variables | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: (Generator) Setup Minimal MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86 | |
- name: Set up cache for Python source | |
uses: actions/cache@v3 | |
id: build-cache | |
with: | |
path: | | |
Python-3.11.8/PCbuild/win32 | |
key: ${{ runner.os }}-python-3.11.8-build | |
restore-keys: | | |
${{ runner.os }}-python-3.11.8-build- | |
- name: (Python) Download 3.11.8 win32 source | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
# download python 3.11.8 source code | |
curl -o Python-3.11.8.tgz https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz | |
# extract the tarball | |
tar -xzvf Python-3.11.8.tgz >nul 2>&1 | |
- name: (Python) Stage Python 3.11.8 static build | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
cd Python-3.11.8 | |
$vcxprojPath = "PCbuild/pythoncore.vcxproj" | |
$content = Get-Content $vcxprojPath -Raw # Read the entire content as a single string | |
$pattern = '</ClCompile>' | |
$replacement = @" | |
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary> | |
<RuntimeLibrary Condition="'`$(Configuration)|`$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary> | |
</ClCompile> | |
"@ | |
$modifiedContent = $content -replace [regex]::Escape($pattern), $replacement | |
$modifiedContent | Set-Content $vcxprojPath | |
shell: pwsh | |
- name: (Python) Build 3.11.8 | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
cd Python-3.11.8 | |
# get python external libs before build | |
./PCbuild/get_externals.bat | |
# build python 3.11.8 as win32 and release | |
msbuild PCBuild/pcbuild.sln /p:Configuration=Release /p:Platform=Win32 /p:RuntimeLibrary=MT | |
msbuild PCBuild/pcbuild.sln /p:Configuration=Debug /p:Platform=Win32 /p:RuntimeLibrary=MT | |
# verify python is installed | |
PCbuild\win32\python.exe --version | |
- name: Upload Python artifacts | |
run: | | |
mkdir D:/a/Millennium/Millennium/build/python | |
# Move the python311.dll binary to the release directory | |
copy D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32\python311.dll D:/a/Millennium/Millennium/build/python/python311.dll | |
copy D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32\python311_d.dll D:/a/Millennium/Millennium/build/python/python311_d.dll | |
copy D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32\python311.lib D:/a/Millennium/Millennium/build/python/python311.lib | |
copy D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32\python311_d.lib D:/a/Millennium/Millennium/build/python/python311_d.lib | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python 3.11.8 build libraries | |
path: D:/a/Millennium/Millennium/build/python | |
- name: Install MinGW | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: > | |
mingw-w64-i686-toolchain | |
mingw-w64-i686-cmake | |
mingw-w64-i686-gcc | |
- name: Add MinGW32 to PATH | |
run: echo "::add-path::C:\msys64\mingw32\bin" | |
- name: (Dependency) Install vcpkg | |
shell: pwsh | |
run: | | |
# bootstrap and install vcpkg | |
./vendor/vcpkg/bootstrap-vcpkg.bat | |
./vendor/vcpkg/vcpkg integrate install | |
- name: (Generator) Configure CMake | |
run: | | |
cmake --preset=windows-mingw-release -DGITHUB_ACTION_BUILD=ON -DCMAKE_CXX_COMPILER=C:/msys64/mingw32/bin/i686-w64-mingw32-g++.exe | |
- name: Build Millennium | |
run: | | |
mkdir D:/a/Millennium/Millennium/build/artifacts | |
dir "D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32" | |
# build millennium with msvc; x86; release | |
cmake --build build --config Release | |
# Move the python311.dll binary to the release directory | |
copy D:\a\Millennium\Millennium\Python-3.11.8\PCbuild\win32\python311.dll D:/a/Millennium/Millennium/build/artifacts/python311.dll | |
copy D:\a\Millennium\Millennium\build\Release\user32.dll D:/a/Millennium/Millennium/build/artifacts/user32.dll | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: millennium | |
path: D:/a/Millennium/Millennium/build/artifacts |