From c0485296541f3b7ec9856e6b50f60b9742dc0c0f Mon Sep 17 00:00:00 2001 From: Josh-Heaps Date: Wed, 26 Aug 2026 15:45:29 -0600 Subject: [PATCH] fix workflows take 2 --- .gitea/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 93a17dd..47bd8c8 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -12,13 +12,17 @@ concurrency: jobs: build-deploy: + # Gitea's runner images are lean, so the toolchain is installed below rather + # than assumed. The glibc that libchess_engine.so links against comes from + # this image, not from the runner host — keep it matched to the prod server. runs-on: ubuntu-latest steps: - - name: Install deploy tools + - name: Install toolchain run: | apt-get update - apt-get install -y --no-install-recommends rsync openssh-client + apt-get install -y --no-install-recommends \ + cmake build-essential rsync openssh-client - name: Checkout uses: actions/checkout@v4 @@ -29,10 +33,26 @@ jobs: dotnet-version: '8.0.x' - name: Restore - run: dotnet restore + run: dotnet restore JoshHeaps.Net/JoshHeaps.Net.csproj + - name: Build native chess engine (libchess_engine.so) + run: | + cmake -S native/chess_engine -B native/chess_engine/build -DCMAKE_BUILD_TYPE=Release + cmake --build native/chess_engine/build + cp native/chess_engine/build/libchess_engine.so JoshHeaps.Net/Resources/ + + # Publishing the project rather than the solution keeps chess_engine.vcxproj + # (Windows-only MSBuild C++ targets) and the UiTests assemblies out of it. - name: Publish - run: dotnet publish -c Release -o ./publish + run: dotnet publish JoshHeaps.Net/JoshHeaps.Net.csproj -c Release -o ./publish + + - name: Verify payload + run: | + set -euo pipefail + test -f publish/Resources/libchess_engine.so \ + || { echo "libchess_engine.so missing from publish output"; exit 1; } + test -x publish/Resources/stockfish-ubuntu-x86-64-sse41-popcnt \ + || { echo "stockfish is not executable"; exit 1; } - name: Prepare SSH env: @@ -47,6 +67,8 @@ jobs: chmod 600 ~/.ssh/deploy_key ssh-keyscan -p "$PORT" "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null + # --exclude chess-data: never let --delete remove the learned-engine training + # data, which lives in the deploy dir unless ChessEngine__WeightsPath is set. - name: Rsync to server env: SSH_HOST: ${{ secrets.SSH_HOST }} @@ -56,11 +78,11 @@ jobs: run: | set -euo pipefail PORT="${SSH_PORT:-22}" - rsync -az --delete \ + rsync -az --delete --exclude 'chess-data' \ -e "ssh -p $PORT -i ~/.ssh/deploy_key -o StrictHostKeyChecking=yes" \ publish/ "$SSH_USER@$SSH_HOST:$TARGET_DIR/" - - name: Restart service + - name: Reload and restart service env: SSH_HOST: ${{ secrets.SSH_HOST }} SSH_PORT: ${{ secrets.SSH_PORT }} -- 2.43.0