ci: validate monster character import
Roll20 Sheet Build Successful The Ravenous Roll20 sheet was generated and validated successfully.
Ravenous/ravenous_roll20/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-09-19 20:58:26 +02:00
parent 01735d679a
commit 2ff6ed7cef
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
4 changed files with 14 additions and 6 deletions

6
Jenkinsfile vendored
View File

@ -82,9 +82,12 @@ pipeline {
mkdir -p "${BUILD_DIR}"
uv sync --frozen
./scripts/build.sh
uv run python tools/export_monsters.py --id 2 --output "${BUILD_DIR}/example-monster-2.json"
uv run python -m unittest discover -s tests -v
if command -v node >/dev/null 2>&1; then
RAVENOUS_CHARACTER_JSON="${BUILD_DIR}/example-character.json" node tests/test_character_io.mjs
RAVENOUS_CHARACTER_JSON="${BUILD_DIR}/example-character.json" \
RAVENOUS_MONSTER_JSON="${BUILD_DIR}/example-monster-2.json" \
node tests/test_character_io.mjs
node tests/test_craft_import.mjs
else
echo 'Node is not installed on this agent; skipping the optional Roll20 Mod simulator tests.'
@ -99,6 +102,7 @@ pipeline {
test -f "${BUILD_DIR}/example-character.json"
test -f "${BUILD_DIR}/example-craft-forge.json"
test -f "${BUILD_DIR}/example-craft-alchemy.json"
test -f "${BUILD_DIR}/example-monster-2.json"
echo "Roll20 sheet build complete:"
ls -lh "${BUILD_DIR}"

View File

@ -187,6 +187,9 @@ l'importe dans le simulateur de l'API Mod lorsque Node est disponible sur
l'agent ; l'absence de ce runtime n'empêche pas la construction de la feuille.
Le script `./scripts/build.sh` génère automatiquement ce même exemple dans son
dossier de sortie, et `./scripts/build.sh --check` vérifie également son contenu.
Jenkins exporte en plus le monstre d'ID 2 (`Yajjpnir`) dans
`build/example-monster-2.json`, l'archive, puis l'importe avec le même simulateur
pour vérifier les localisations, attaques et pouvoirs générés.
Le build génère aussi deux charges utiles prêtes à importer :
`build/example-craft-forge.json` (attaque et protection) et

View File

@ -18,7 +18,8 @@ class BuildTests(unittest.TestCase):
actual = {path.name for path in (ROOT / "build").iterdir()}
self.assertTrue(expected.issubset(actual))
self.assertLessEqual(actual - expected, {
"example-character.json", "example-craft-forge.json", "example-craft-alchemy.json"
"example-character.json", "example-craft-forge.json", "example-craft-alchemy.json",
"example-monster-2.json"
})
def test_source_data_was_imported(self):

View File

@ -167,12 +167,12 @@ test('a converted database monster imports with its body parts and abilities',
const handout = game.createObj('handout', { gmnotes: `<pre>${JSON.stringify(data).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')}</pre>` });
game.send(`!ravenous-import --handout ${handout.id}`);
const character = [...game.objects.values()].find(obj => obj.type === 'character');
assert.equal(character.get('name'), 'Arangar');
assert.equal(character.get('name'), data.name);
const attrs = [...game.objects.values()].filter(obj => obj.type === 'attribute' && obj.get('characterid') === character.id);
assert.equal(attrs.length, data.attributes.length);
assert.ok(attrs.some(obj => obj.get('name') === 'repeating_locations_dbpart1_name' && obj.get('current') === 'Tête'));
assert.ok(attrs.some(obj => obj.get('name') === 'repeating_attacks_dbability5_name'));
assert.ok(attrs.some(obj => obj.get('name') === 'repeating_powers_dbability1_name'));
assert.ok(attrs.some(obj => /^repeating_locations_dbpart\d+_name$/.test(obj.get('name'))));
assert.ok(attrs.some(obj => /^repeating_attacks_dbability\d+_name$/.test(obj.get('name'))));
assert.ok(attrs.some(obj => /^repeating_powers_dbability\d+_name$/.test(obj.get('name'))));
});
test('a generated fuzz character imports with all representative repeating sections',