Files
uconsole_asw_game/.github/workflows/soak.yml
T

103 lines
3.5 KiB
YAML

# Nightly soak: every scenario, both sides, an hour of simulation each with a
# random operator at every station, save/load continuation checks and a
# memory watch (tools/soak_game.py). A failure opens an issue labelled "soak"
# with the report, or adds the report to the open one, so a crash is found
# before a player finds it. Not hardware acceptance (docs/hardware-acceptance.md).
name: Soak
on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
inputs:
minutes:
description: "Simulation minutes per scenario and side"
default: "60"
permissions:
contents: read
jobs:
soak:
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
# Every scenario of config.SCENARIO_ORDER (tests/test_soak.py checks it).
scenario: [s1_patrouille, s2_doppeljagd, s3_abfang, s4_zufall, s11_geleitschutz,
s12_datum, s13_fuehlung, s14_hafenschutz, s15_versorgung, s16_seenot,
s21_suchgruppe, s5_durchbruch, s6_aufklaerung, s7_geleitzug,
s8_meerenge, s9_kampfschwimmer, s10_versorger, s17_duell,
s18_heimkehr, s19_abholung, s20_lauschposten, s22_jagdgruppe,
frei_fregatte, frei_uboot]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: python -m pip install -e ".[dev]"
- name: Soak ${{ matrix.scenario }}
run: >-
python tools/soak_game.py --scenario ${{ matrix.scenario }}
--minutes ${{ github.event.inputs.minutes || '60' }}
--report soak-${{ matrix.scenario }}.md
--dump-dir refused-saves
- name: Keep the report
if: always()
uses: actions/upload-artifact@v4
with:
name: soak-${{ matrix.scenario }}
path: soak-${{ matrix.scenario }}.md
if-no-files-found: ignore
# A save that did not load, kept for offline analysis (the report names it).
- name: Keep refused saves
if: always()
uses: actions/upload-artifact@v4
with:
name: refused-saves-${{ matrix.scenario }}
path: refused-saves/
if-no-files-found: ignore
retention-days: 30
report:
needs: soak
if: failure()
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: soak-*
merge-multiple: true
- name: Open or update the soak issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
{
echo "Nightly soak failed: $RUN_URL"
echo
echo "Saves that did not load are attached to the run as refused-saves-* artifacts."
echo
grep -l "FAIL" soak-*.md | xargs -r cat
} > body.md
head -c 60000 body.md > issue.md
gh label create soak --color B60205 --description "Nightly soak failures" 2>/dev/null || true
number=$(gh issue list --label soak --state open --json number --jq '.[0].number')
if [ -n "$number" ]; then
gh issue comment "$number" --body-file issue.md
else
gh issue create --title "Nightly soak failed" --label soak --body-file issue.md
fi