mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-04 05:00:02 +00:00
Restores a fix that was dropped in e5b46e5e and re-exposed when cda01971 reintroduced nim/nimble into nimble.lock: the nim package never matches its Linux-computed checksum on Windows because nim's own .gitattributes forces line endings on parts of its tree, so the SHA1 differs regardless of core.autocrlf. autocrlf alone therefore cannot fix the nim mismatch. Remove nim/nimble from the lock before `nimble setup` (they are provided by the toolchain installed in CI, not real project deps). Added to the Windows workflow, which never had it, and restored in ci.yml's setup steps since the cache-key bump now forces those to run on a fresh tree. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
156 lines
5.1 KiB
YAML
156 lines
5.1 KiB
YAML
name: ci / build-windows
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
branch:
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
NPROC: 4
|
|
NIM_VERSION: '2.2.4'
|
|
NIMBLE_VERSION: '0.22.3'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
|
|
env:
|
|
MSYSTEM: MINGW64
|
|
|
|
steps:
|
|
- name: Configure Git to keep LF line endings
|
|
# Windows Git defaults to core.autocrlf=true, which converts LF→CRLF when
|
|
# nimble clones dependency packages into nimbledeps/. The CRLF conversion
|
|
# changes the SHA1 of the package source tree relative to the
|
|
# Linux-computed checksums stored in nimble.lock, so nimble decides the
|
|
# local copy is invalid and re-downloads on every subsequent invocation
|
|
# — and these retries can hang indefinitely on Windows runners.
|
|
# Disabling autocrlf globally makes nimble's child git clones produce
|
|
# the same tree (and SHA1) as on Linux.
|
|
shell: pwsh
|
|
run: |
|
|
git config --global core.autocrlf false
|
|
git config --global core.eol lf
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup MSYS2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
update: true
|
|
install: >-
|
|
git
|
|
base-devel
|
|
mingw-w64-x86_64-toolchain
|
|
make
|
|
cmake
|
|
upx
|
|
unzip
|
|
mingw-w64-x86_64-rust
|
|
mingw-w64-x86_64-postgresql
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-gcc-libs
|
|
mingw-w64-x86_64-libwinpthread-git
|
|
mingw-w64-x86_64-zlib
|
|
mingw-w64-x86_64-openssl
|
|
mingw-w64-x86_64-python
|
|
mingw-w64-x86_64-cmake
|
|
mingw-w64-x86_64-llvm
|
|
mingw-w64-x86_64-clang
|
|
mingw-w64-x86_64-nasm
|
|
|
|
- name: Configure Git in MSYS2 to keep LF line endings
|
|
# The autocrlf=false above only configures Git for Windows. nimble clones
|
|
# its dependency packages from within the MSYS2 shell, whose git reads a
|
|
# separate global config ($HOME/.gitconfig under the MSYS2 root). Without
|
|
# repeating the setting here, CRLF conversion still alters dependency
|
|
# source trees, so their SHA1 no longer matches nimble.lock and nimble
|
|
# re-downloads (and hangs) on every invocation.
|
|
run: |
|
|
git config --global core.autocrlf false
|
|
git config --global core.eol lf
|
|
|
|
- name: Manually install nasm
|
|
run: |
|
|
bash scripts/install_nasm_in_windows.sh
|
|
source $HOME/.bashrc
|
|
|
|
- name: Add UPX to PATH
|
|
run: |
|
|
echo "/usr/bin:$PATH" >> $GITHUB_PATH
|
|
echo "/mingw64/bin:$PATH" >> $GITHUB_PATH
|
|
echo "/usr/lib:$PATH" >> $GITHUB_PATH
|
|
echo "/mingw64/lib:$PATH" >> $GITHUB_PATH
|
|
|
|
- name: Verify dependencies
|
|
run: |
|
|
which upx gcc g++ make cmake cargo rustc python nasm
|
|
|
|
- name: Install Nim ${{ env.NIM_VERSION }}
|
|
uses: jiro4989/setup-nim-action@v2
|
|
with:
|
|
nim-version: ${{ env.NIM_VERSION }}
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install Nimble ${{ env.NIMBLE_VERSION }}
|
|
run: |
|
|
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$PATH"
|
|
cd /tmp && nimble install "nimble@${{ env.NIMBLE_VERSION }}" -y
|
|
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install nimble deps
|
|
if: steps.cache-nimbledeps.outputs.cache-hit != 'true'
|
|
run: |
|
|
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
|
|
# nim and nimble have unstable cross-platform checksums: their source
|
|
# trees check out differently per OS (nim ships a .gitattributes that
|
|
# forces line endings on some files), so their SHA1 never matches the
|
|
# Linux-computed values in nimble.lock on Windows — even with autocrlf
|
|
# disabled. Strip them from the lock before setup; they are provided by
|
|
# the toolchain installed above, not resolved as project deps.
|
|
python -c "
|
|
import json
|
|
lock = json.load(open('nimble.lock'))
|
|
for key in ['nim', 'nimble']:
|
|
lock['packages'].pop(key, None)
|
|
json.dump(lock, open('nimble.lock', 'w'), indent=2)
|
|
"
|
|
nimble setup --localdeps -y
|
|
make rebuild-nat-libs-nimbledeps CC=gcc
|
|
make rebuild-bearssl-nimbledeps CC=gcc
|
|
touch nimbledeps/.nimble-setup
|
|
|
|
- name: Creating tmp directory
|
|
run: mkdir -p tmp
|
|
|
|
- name: Building wakunode2.exe
|
|
run: |
|
|
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
|
|
make wakunode2 V=3 -j${{ env.NPROC }}
|
|
|
|
- name: Building libwaku.dll
|
|
run: |
|
|
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
|
|
make libwaku STATIC=0 V=1 -j
|
|
|
|
- name: Check Executable
|
|
run: |
|
|
if [ -f "./build/wakunode2.exe" ]; then
|
|
echo "wakunode2.exe build successful"
|
|
else
|
|
echo "Build failed: wakunode2.exe not found"
|
|
exit 1
|
|
fi
|
|
if [ -f "./build/libwaku.dll" ]; then
|
|
echo "libwaku.dll build successful"
|
|
else
|
|
echo "Build failed: libwaku.dll not found"
|
|
exit 1
|
|
fi |