Build Millennium #19
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 | |
on: | |
workflow_dispatch: | |
jobs: | |
build-windows: | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
runs-on: windows-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
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: (Setup) Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: (Setup) Assets Build Environment | |
run: cd assets && npm install && npm run build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: (Setup) Build Assets | |
run: . scripts\ci\win32\mk-assets.ps1 | |
- name: (Setup) Construct Python Environment | |
run: . scripts\ci\win32\setup-python.ps1 D:/a/env/ext/data/cache | |
- name: (Setup) Semantic Release | |
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# dry run to get the next version | |
- name: Bump Version | |
id: read_version | |
run: . scripts\ci\win32\version.ps1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- 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) Add msbuild to PATH | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
uses: microsoft/setup-msbuild@v2 | |
- name: (Python) Download 3.11.8 win32 source | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: . scripts\ci\win32\build-python.ps1 | |
- 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 prerequisites | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw32 | |
install: >- | |
mingw-w64-i686-libgcrypt | |
mingw-w64-i686-gcc | |
mingw-w64-i686-cmake | |
mingw-w64-i686-ninja | |
unzip | |
- name: (Dependency) Install vcpkg | |
shell: pwsh | |
run: ./vendor/vcpkg/bootstrap-vcpkg.bat && ./vendor/vcpkg/vcpkg integrate install | |
- name: (Generator) Configure CMake | |
shell: msys2 {0} | |
run: cmake --preset=windows-mingw-release -DGITHUB_ACTION_BUILD=ON | |
- name: Install Node.js and npm | |
shell: msys2 {0} | |
run: | | |
curl -fsSL https://nodejs.org/dist/v16.20.0/node-v16.20.0-win-x86.zip -o node.zip | |
unzip node.zip -d /usr/local | |
export PATH="/usr/local/node-v16.20.0-win-x86:$PATH" | |
node --version | |
npm --version | |
- name: Build Millennium | |
shell: msys2 {0} | |
run: | | |
mkdir D:/a/Millennium/Millennium/build/artifacts | |
cmake --build build --config Release | |
cp D:/a/Millennium/Millennium/Python-3.11.8/PCbuild/win32/python311.dll D:/a/env/python311.dll | |
cp /d/a/Millennium/Millennium/build/win32/user32.dll D:/a/env/user32.dll | |
cp /d/a/Millennium/Millennium/build/millennium.dll D:/a/env/millennium.dll | |
mkdir D:/a/env/ext/bin | |
# Disable Millennium CLI for now, as it keeps get false positive detections for no apparent reason | |
# cp /d/a/Millennium/Millennium/build/cli/millennium.exe D:/a/env/ext/bin/millennium.exe | |
npm install @steambrew/api | |
mkdir D:/a/env/ext/data/shims | |
cp -r ./node_modules/@steambrew/api/dist/webkit_api.js D:/a/env/ext/data/shims/webkit_api.js | |
cp -r ./node_modules/@steambrew/api/dist/client_api.js D:/a/env/ext/data/shims/client_api.js | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
include-hidden-files: true | |
name: millennium-windows | |
path: D:/a/env/ | |
build-linux: | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
env: | |
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: (Setup) Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: (Setup) Assets Build Environment | |
run: cd assets && npm install && npm run build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: (Setup) Build Assets | |
run: bash scripts/ci/posix/mk-assets.sh | |
- name: (Setup) Semantic Release | |
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# dry run to get the next version | |
- name: Bump Version | |
id: read_version | |
run: bash scripts/ci/posix/version.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install -y \ | |
build-essential \ | |
zlib1g-dev:i386 \ | |
libncurses5-dev:i386 \ | |
libgdbm-dev:i386 \ | |
libnss3-dev:i386 \ | |
libssl-dev:i386 \ | |
libreadline-dev:i386 \ | |
libffi-dev:i386 \ | |
wget \ | |
curl \ | |
libbz2-dev:i386 \ | |
libsqlite3-dev:i386 \ | |
liblzma-dev:i386 \ | |
gcc-multilib \ | |
g++-multilib | |
- name: Set up cache for Python source | |
uses: actions/cache@v3 | |
id: build-cache | |
with: | |
path: home/runner/.millennium/ext/data/cache | |
key: ${{ runner.os }}-python-linux-3.11.8-build | |
restore-keys: ${{ runner.os }}-python-linux-3.11.8-build- | |
- name: Download Python 3.11.8 source | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
wget https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz | |
tar -xf Python-3.11.8.tgz | |
- name: Configure and build Python 3.11.8 (32-bit) | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p $HOME/.millennium/ext/data/cache | |
cd Python-3.11.8 | |
sudo CFLAGS="-m32" LDFLAGS="-m32" ./configure --prefix=$HOME/.millennium/ext/data/cache --enable-optimizations | |
sudo make -j$(nproc) | |
sudo make altinstall | |
- name: Setup installation | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
sudo mkdir -p $HOME/.millennium/ext/data/cache/lib/tmp | |
cd $HOME/.millennium/ext/data/cache/lib/tmp | |
sudo ar -x ../libpython3.11.a | |
sudo gcc -m32 -shared -o ../libpython-3.11.8.so *.o | |
cd $HOME/.millennium/ext/data/cache/lib | |
sudo rm -rf tmp | |
ls | |
sudo mkdir -p $HOME/Documents/LibPython/ | |
cd $HOME/.millennium/ext/data/cache/include/python3.11/ | |
sudo mv * $HOME/Documents/LibPython/ | |
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/test/ | |
sudo rm -rf $HOME/.millennium/ext/data/cache/share | |
sudo rm -rf $HOME/.millennium/ext/data/cache/include | |
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/__pycache__/ | |
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/config-3.11-x86_64-linux-gnu/ | |
sudo rm $HOME/.millennium/ext/data/cache/lib/libpython3.11.a | |
sudo mv $HOME/.millennium/ext/data/cache/lib/libpython-3.11.8.so $HOME/.millennium/libpython-3.11.8.so | |
$HOME/.millennium/ext/data/cache/bin/python3.11 --version | |
mkdir -p /home/runner/env/ext/data | |
sudo cp -r $HOME/.millennium/ext/data/cache /home/runner/env/ext/data | |
- name: (Generator) Install CMake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.21.1' | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
- name: (Dependency) Install vcpkg & setup environment | |
run: sudo apt install libgtk-3-dev ninja-build && ./vendor/vcpkg/bootstrap-vcpkg.sh && ./vendor/vcpkg/vcpkg integrate install | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
- name: (Generator) Configure CMake | |
run: cmake --preset=linux -G "Ninja" -DGITHUB_ACTION_BUILD=ON | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
- name: Build Millennium | |
run: | | |
# mkdir -p /home/runner/Millennium/build/artifacts | |
cmake --build build --config Release | |
# ls -laR /home/runner/Millennium/build | |
mkdir -p /home/runner/env | |
cp ./build/libMillennium.so /home/runner/env/libMillennium.so | |
cp ~/.millennium/libpython-3.11.8.so /home/runner/env/libpython-3.11.8.so | |
cp ./scripts/posix/start.sh /home/runner/env/start.sh | |
mkdir -p /home/runner/env/ext/bin | |
cp ./build/cli/millennium /home/runner/env/ext/bin/millennium | |
npm install @steambrew/api | |
mkdir -p D:/a/env/ext/data/shims | |
cp -r ./node_modules/@steambrew/api/dist/webkit_api.js /home/runner/env/ext/data/shims/webkit_api.js | |
cp -r ./node_modules/@steambrew/api/dist/client_api.js /home/runner/env/ext/data/shims/client_api.js | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
include-hidden-files: true | |
name: millennium-linux | |
path: /home/runner/env/ |