Skip to content

Commit 172fb7f

Browse files
authored
Add ck3-tiger validation to integration tests and fix some ck3-tiger warnings (#2665) #patch
closes #1292
1 parent b47aba4 commit 172fb7f

File tree

3 files changed

+210
-0
lines changed

3 files changed

+210
-0
lines changed

.github/workflows/ck3-tiger.conf

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
2+
languages = {
3+
# This will check only english localizations
4+
check = "english"
5+
}
6+
7+
# Allows configuring what reports are printed by CK3-Tiger.
8+
filter = {
9+
# Whether to report about problems in vanilla game files.
10+
# Setting this to 'yes' results in a LOT of spam.
11+
# Optional boolean value, defaults to no.
12+
show_vanilla = no
13+
14+
# Whether to report about problems in mods loaded via the load_mod sections.
15+
# Optional boolean value, defaults to no.
16+
show_loaded_mods = yes
17+
18+
# Contains rules for reports, using trigger syntax.
19+
# Only reports matching the trigger will be printed.
20+
# The root trigger is an AND block, just like any other trigger.
21+
trigger = {
22+
AND = {
23+
severity >= Warning
24+
25+
NOR = {
26+
key = "strict-scopes"
27+
key = "scopes"
28+
29+
text = "OR with only one item inside is probably not what you intended"
30+
31+
# vanilla issues
32+
text = "missing english localization key d_tyrol_adj"
33+
text = "missing english localization key d_lothian_adj"
34+
text = "missing english localization key d_valois_adj"
35+
text = "missing english localization key d_thessaly_adj"
36+
text = "missing english localization key d_tripolitania_adj"
37+
text = "missing english localization key d_kashgar_adj"
38+
text = "missing english localization key d_halych_adj"
39+
text = "missing english localization key d_soghd_adj"
40+
text = "missing english localization key d_balkh_adj"
41+
text = "missing english localization key d_kroumerie_adj"
42+
text = "missing english localization key d_kairouan_adj"
43+
text = "missing english localization key d_makran_adj"
44+
text = "missing english localization key d_rayy_adj"
45+
text = "missing english localization key d_kirman_adj"
46+
text = "missing english localization key d_hormuz_adj"
47+
text = "missing english localization key d_rif_adj"
48+
text = "missing english localization key d_samarra_adj"
49+
text = "missing english localization key d_kurdistan_adj"
50+
text = "missing english localization key d_badakhshan_adj"
51+
text = "missing english localization key d_sutiya_adj"
52+
text = "missing english localization key d_kamarupanagara_adj"
53+
text = "missing english localization key d_tirabhukti_adj"
54+
text = "missing english localization key d_vanga_adj"
55+
text = "missing english localization key d_suhma_adj"
56+
text = "missing english localization key d_para_lauhitya_adj"
57+
text = "missing english localization key d_sous_adj"
58+
text = "missing english localization key d_zab_adj"
59+
text = "missing english localization key d_ajmer_adj"
60+
text = "missing english localization key d_karashar_adj"
61+
text = "missing english localization key d_altay_adj"
62+
text = "missing english localization key d_nasa_adj"
63+
text = "missing english localization key d_khorezm_adj"
64+
text = "missing english localization key d_uzboy_adj"
65+
text = "missing english localization key d_laamp_" # ignores all missing adjectives for LAAMP titles
66+
}
67+
}
68+
}
69+
}
70+
71+
# Sometimes ck3-tiger makes a mistake in determining the scope types expected
72+
# by a scripted trigger or effect. Its conclusions can be overridden here.
73+
# Scope overrides can be ALL (to accept any scope) or a list separated by |,
74+
# like character|province|landed_title
75+
scope_override = {
76+
artifact_low_rarity_trigger = ALL
77+
artifact_medium_rarity_trigger = ALL
78+
artifact_high_rarity_trigger = ALL
79+
artifact_region_trigger = ALL
80+
}
81+
82+
# Optional block to control output styles and colors. Colors are enabled by default.
83+
# Another way to disable all ANSI characters in the output is to supply the --no-color flag.
84+
# That flag will override anything you define here, in the config file.
85+
output_style = {
86+
# Default value is 'yes', except with ck3-tiger-auto when it is default 'no'.
87+
# If set to 'no', no ANSI characters will be added to the output and the output will not be colored.
88+
# Also, all other settings in this block will be ignored.
89+
# enable = yes
90+
91+
# Optional block to set the error color.
92+
# error = {
93+
# # Default is red. Supported values are Black, Red, Green, Yellow, Blue, Purple, Cyan, White.
94+
# color = "red"
95+
# }
96+
# Optional block to set the warning color.
97+
# warning = {
98+
# # Default is yellow. Supported values are Black, Red, Green, Yellow, Blue, Purple, Cyan, White.
99+
# color = "yellow"
100+
# }
101+
# Optional block to set the info color.
102+
# info = {
103+
# # Default is green. Supported values are Black, Red, Green, Yellow, Blue, Purple, Cyan, White.
104+
# color = "green"
105+
# }
106+
# Optional block to set the advice color.
107+
# untidy = {
108+
# # Default is cyan. Supported values are Black, Red, Green, Yellow, Blue, Purple, Cyan, White.
109+
# color = "cyan"
110+
# }
111+
112+
}

.github/workflows/integration_tests.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,106 @@ jobs:
5151
echo 'targetGameModPath = "C:\Users\Administrator\Documents\Paradox Interactive\Crusader Kings III\mod"' >> configuration.txt
5252
echo 'SaveGame = "../../save.rome"' >> configuration.txt
5353
echo 'SkipDynamicCoAExtraction = 1' >> configuration.txt
54+
echo 'output_name = "test_save"' >> configuration.txt
5455
cat configuration.txt
5556
- name: "Run conversion"
5657
working-directory: Release/ImperatorToCK3
5758
run: |
5859
dotnet ImperatorToCK3Converter.dll
5960
61+
- name: "Download and unzip ck3-tiger"
62+
run: |
63+
Invoke-WebRequest -Uri "https://github.com/amtep/tiger/releases/download/v1.11.0/ck3-tiger-windows-v1.11.0.zip" -OutFile "ck3-tiger.zip"
64+
Expand-Archive -Path "ck3-tiger.zip" -DestinationPath "ck3-tiger"
65+
Remove-Item -Path "ck3-tiger.zip"
66+
67+
- name: "Validate generated mod with ck3-tiger"
68+
run: |
69+
# Run ck3-tiger validation on the generated mod
70+
$modPath = "$env:GITHUB_WORKSPACE\Release\ImperatorToCK3\output\test_save"
71+
$tigerPath = "$env:GITHUB_WORKSPACE\ck3-tiger\ck3-tiger.exe"
72+
$tigerConfigPath = "$env:GITHUB_WORKSPACE\.github\workflows\ck3-tiger.conf"
73+
74+
# Run tiger and capture output
75+
cmd /c "`"$tigerPath`" --no-color --config `"$tigerConfigPath`" `"$modPath`" > result.txt 2> result-error.txt"
76+
77+
# Display any errors from stderr
78+
if (Test-Path "result-error.txt") {
79+
$errorContent = Get-Content "result-error.txt" -Raw
80+
if ($errorContent) {
81+
Write-Host $errorContent
82+
}
83+
}
84+
85+
# Count base errors (initialization failures)
86+
$baseErrors = 0
87+
if (Test-Path "result-error.txt") {
88+
$baseErrors = (Select-String -Path "result-error.txt" -Pattern "Error" -AllMatches).Matches.Count
89+
}
90+
91+
# Check if validator failed to initialize
92+
if ($baseErrors -gt 0) {
93+
Write-Host ""
94+
Write-Host "The validator could not be initialized!" -ForegroundColor Red -BackgroundColor Black
95+
exit 1
96+
}
97+
98+
# Process results if file exists and has content
99+
if ((Test-Path "result.txt") -and (Get-Item "result.txt").Length -gt 0) {
100+
# Display full results
101+
Get-Content "result.txt"
102+
103+
# Count different types of issues
104+
$tips = (Select-String -Path "result.txt" -Pattern "tips" -AllMatches).Matches.Count
105+
$untidy = (Select-String -Path "result.txt" -Pattern "untidy" -AllMatches).Matches.Count
106+
$warnings = (Select-String -Path "result.txt" -Pattern "warning" -AllMatches).Matches.Count
107+
$errors = (Select-String -Path "result.txt" -Pattern "error" -AllMatches).Matches.Count
108+
$fatal = (Select-String -Path "result.txt" -Pattern "fatal" -AllMatches).Matches.Count
109+
110+
Write-Host ""
111+
Write-Host "Overview:" -ForegroundColor White
112+
113+
if ($tips -gt 0) {
114+
Write-Host " - $tips tips" -ForegroundColor White
115+
} else {
116+
Write-Host " - no tips" -ForegroundColor White
117+
}
118+
119+
if ($untidy -gt 0) {
120+
Write-Host " - $untidy untidy hints" -ForegroundColor White
121+
} else {
122+
Write-Host " - no untidy hints" -ForegroundColor White
123+
}
124+
125+
if ($warnings -gt 0) {
126+
Write-Host " - $warnings warnings" -ForegroundColor White
127+
} else {
128+
Write-Host " - no warnings" -ForegroundColor White
129+
}
130+
131+
if ($errors -gt 0) {
132+
Write-Host " - $errors errors" -ForegroundColor White
133+
} else {
134+
Write-Host " - no errors" -ForegroundColor White
135+
}
136+
137+
if ($fatal -gt 0) {
138+
Write-Host " - $fatal fatal errors" -ForegroundColor White
139+
} else {
140+
Write-Host " - no fatal errors" -ForegroundColor White
141+
}
142+
143+
# Check if validation failed
144+
if ($warnings -gt 0 -or $errors -gt 0 -or $fatal -gt 0) {
145+
Write-Host ""
146+
Write-Host "There are warnings or errors. The validation failed!" -ForegroundColor Red -BackgroundColor Black
147+
exit 1
148+
}
149+
} else {
150+
Write-Host ""
151+
Write-Host "Successfully validated!" -ForegroundColor Green -BackgroundColor Black
152+
}
153+
60154
- name: "Cleanup"
61155
if: always()
62156
run: |

ImperatorToCK3/Data_Files/blankMod/output/common/named_colors/IRToCK3_culture_colors.txt renamed to ImperatorToCK3/Data_Files/blankMod/output/common/named_colors/IRToCK3_culture_colors.txt.liquid

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ colors = {
77
venetic_culture = { 193 117 241 }
88
chong = { 217 189 104 } # from Rajas of Asia
99

10+
{% if wtwsms %}
1011
# fallback colors for WtWSMS
1112
coptic = { 0.20 0.35 0.50 } # taken from the coptic culture color in WtWSMS
1213
sakan = { 0.55 0.44 0.33 } # taken from the saka named color in WtWSMS
@@ -23,7 +24,9 @@ colors = {
2324
language_syrianromance = { 0.85 0.3 0.3 } # taken from the romano_aramean named color in WtWSMS
2425
trojan = { 0.83 0.55 0.95 } # taken from the trojan named color in vanilla CK3
2526
ancient_egyptian = { 0.9 0.85 0.17 } # taken from the ancient_egyptian named color in vanilla CK3
27+
{% endif %}
2628

29+
{% if roa %}
2730
# fallback colors for Rajas of Asia
2831
samoyed = { 0.3 0.87 0.21 } # taken from RoA samoyed culture
2932
guanche = { 0.63 0.26 0.01 }
@@ -47,4 +50,5 @@ colors = {
4750
telengit = rgb { 96 136 146 } # from the телесы map color from https://upload.wikimedia.org/wikipedia/commons/f/f3/Brockhaus_and_Efron_Encyclopedic_Dictionary_b58_809-0.jpg
4851
ahom = rgb { 219 2 0 } # from the background color of https://upload.wikimedia.org/wikipedia/commons/b/b8/Ahom_Kingdom.webp
4952
yemek = rgb { 255 249 116 } # from the Kimek-Kipchak confederation map color from https://upload.wikimedia.org/wikipedia/commons/d/d6/%D2%9A%D0%B8%D0%BC%D0%B0%D2%9B%D1%82%D0%B0%D1%80.png
53+
{% endif %}
5054
}

0 commit comments

Comments
 (0)