Fail CI on lint warnings
This commit is contained in:
committed by
Matthias Mailänder
parent
34bcae9abb
commit
ade27ad8b9
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get install lua5.1
|
sudo apt-get install lua5.1
|
||||||
make check-scripts
|
make check-scripts
|
||||||
make test
|
make TREAT_WARNINGS_AS_ERRORS=true test
|
||||||
|
|
||||||
linux-mono:
|
linux-mono:
|
||||||
name: Linux (mono)
|
name: Linux (mono)
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
- name: Check Mods
|
- name: Check Mods
|
||||||
run: |
|
run: |
|
||||||
# check-scripts does not depend on .net/mono, so is not needed here
|
# check-scripts does not depend on .net/mono, so is not needed here
|
||||||
make RUNTIME=mono test
|
make RUNTIME=mono TREAT_WARNINGS_AS_ERRORS=true test
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
name: Windows (.NET 6.0)
|
name: Windows (.NET 6.0)
|
||||||
@@ -76,5 +76,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
chocolatey install lua --version 5.1.5.52
|
chocolatey install lua --version 5.1.5.52
|
||||||
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
|
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
|
||||||
|
$ENV:TREAT_WARNINGS_AS_ERRORS = "true"
|
||||||
.\make.ps1 check-scripts
|
.\make.ps1 check-scripts
|
||||||
.\make.ps1 test
|
.\make.ps1 test
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -180,7 +180,7 @@ help:
|
|||||||
@echo ' make [RUNTIME=net6] TARGETPLATFORM=unix-generic'
|
@echo ' make [RUNTIME=net6] TARGETPLATFORM=unix-generic'
|
||||||
@echo
|
@echo
|
||||||
@echo 'to check the official mods for erroneous yaml files, run:'
|
@echo 'to check the official mods for erroneous yaml files, run:'
|
||||||
@echo ' make [RUNTIME=net6] test'
|
@echo ' make [RUNTIME=net6] [TREAT_WARNINGS_AS_ERRORS=false] test'
|
||||||
@echo
|
@echo
|
||||||
@echo 'to check the engine and official mod dlls for code style violations, run:'
|
@echo 'to check the engine and official mod dlls for code style violations, run:'
|
||||||
@echo ' make [RUNTIME=net6] check'
|
@echo ' make [RUNTIME=net6] check'
|
||||||
|
|||||||
@@ -41,11 +41,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool warningAsError = false;
|
||||||
|
|
||||||
[Desc("[MAPFILE]", "Check a mod or map for certain yaml errors.")]
|
[Desc("[MAPFILE]", "Check a mod or map for certain yaml errors.")]
|
||||||
void IUtilityCommand.Run(Utility utility, string[] args)
|
void IUtilityCommand.Run(Utility utility, string[] args)
|
||||||
{
|
{
|
||||||
// HACK: The engine code assumes that Game.modData is set.
|
// HACK: The engine code assumes that Game.modData is set.
|
||||||
var modData = Game.ModData = utility.ModData;
|
var modData = Game.ModData = utility.ModData;
|
||||||
|
warningAsError = Environment.GetEnvironmentVariable("TREAT_WARNINGS_AS_ERRORS")?.Equals("true", StringComparison.CurrentCultureIgnoreCase) ?? false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -77,7 +80,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var customPass = (ILintPass)modData.ObjectCreator.CreateBasic(customPassType);
|
var customPass = (ILintPass)modData.ObjectCreator.CreateBasic(customPassType);
|
||||||
customPass.Run(EmitError, EmitWarning, modData);
|
customPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -140,7 +143,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var customMapPass = (ILintMapPass)modData.ObjectCreator.CreateBasic(customMapPassType);
|
var customMapPass = (ILintMapPass)modData.ObjectCreator.CreateBasic(customMapPassType);
|
||||||
customMapPass.Run(EmitError, EmitWarning, modData, map);
|
customMapPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData, map);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -156,7 +159,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var customRulesPass = (ILintRulesPass)modData.ObjectCreator.CreateBasic(customRulesPassType);
|
var customRulesPass = (ILintRulesPass)modData.ObjectCreator.CreateBasic(customRulesPassType);
|
||||||
customRulesPass.Run(EmitError, EmitWarning, modData, rules);
|
customRulesPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData, rules);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -172,7 +175,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var customRulesPass = (ILintSequencesPass)modData.ObjectCreator.CreateBasic(customSequencesPassType);
|
var customRulesPass = (ILintSequencesPass)modData.ObjectCreator.CreateBasic(customSequencesPassType);
|
||||||
customRulesPass.Run(EmitError, EmitWarning, modData, rules, sequences);
|
customRulesPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData, rules, sequences);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user