ci-test/.forgejo/workflows/ci.yml
ci-bot 71b7db4985
All checks were successful
CI Test / hello (push) Successful in 1s
CI Test / windows-test (push) Successful in 7s
ci(windows): resolve host gateway at runtime instead of hardcoding 172.17.0.1
Forgejo Runner spawns each job on a per-job custom Docker network whose
gateway is not the default bridge (172.17.0.1). Detecting the default
route inside the container picks up whatever bridge gateway is in use.
2026-05-01 14:32:47 -04:00

70 lines
2.2 KiB
YAML

name: CI Test
on:
push:
branches: [main, windows-ci]
workflow_dispatch:
env:
# WIN_HOST is the host machine reachable from inside the job container.
# Resolved at runtime to the container's default gateway, since Forgejo Runner
# creates a per-job Docker network whose gateway IP varies between runs.
WIN_PORT: 2210
WIN_USER: edr
jobs:
hello:
runs-on: docker
steps:
- name: Say hello
run: |
echo "Hello from Forgejo Actions!"
echo "Runner: $RUNNER_NAME"
uname -a
node --version
- name: Math check
run: echo "2+2 = $((2+2))"
windows-test:
runs-on: docker
steps:
- name: Install sshpass
run: |
apt-get update -qq
apt-get install -y -qq sshpass openssh-client iproute2
- name: Resolve host gateway
run: |
GW=$(ip route | awk '/default/ {print $3; exit}')
echo "WIN_HOST=$GW" >> "$GITHUB_ENV"
echo "Using host gateway: $GW"
- name: Wait for Windows VM SSH
env:
SSHPASS: ${{ secrets.WINDOWS_SSH_PASSWORD }}
run: |
for i in $(seq 1 30); do
if sshpass -e ssh -o StrictHostKeyChecking=no -o ConnectTimeout=3 \
-p "$WIN_PORT" "$WIN_USER@$WIN_HOST" "exit" 2>/dev/null; then
echo "VM SSH ready"; exit 0
fi
echo "[$i/30] waiting for VM..."; sleep 5
done
echo "VM SSH never became ready"; exit 1
- name: Smoke test on Windows
env:
SSHPASS: ${{ secrets.WINDOWS_SSH_PASSWORD }}
run: |
sshpass -e ssh -o StrictHostKeyChecking=no \
-p "$WIN_PORT" "$WIN_USER@$WIN_HOST" \
"whoami && ver && echo windows-smoke-ok"
# The actual test step — runs the test inside the Windows VM.
# Customise the command to fit the project once Windows test tooling is in place.
- name: Run Windows test
env:
SSHPASS: ${{ secrets.WINDOWS_SSH_PASSWORD }}
run: |
sshpass -e ssh -o StrictHostKeyChecking=no \
-p "$WIN_PORT" "$WIN_USER@$WIN_HOST" \
"echo TODO: run actual test command here"