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: |
|
||||
sudo apt-get install lua5.1
|
||||
make check-scripts
|
||||
make test
|
||||
make TREAT_WARNINGS_AS_ERRORS=true test
|
||||
|
||||
linux-mono:
|
||||
name: Linux (mono)
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
- name: Check Mods
|
||||
run: |
|
||||
# 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:
|
||||
name: Windows (.NET 6.0)
|
||||
@@ -76,5 +76,6 @@ jobs:
|
||||
run: |
|
||||
chocolatey install lua --version 5.1.5.52
|
||||
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
|
||||
$ENV:TREAT_WARNINGS_AS_ERRORS = "true"
|
||||
.\make.ps1 check-scripts
|
||||
.\make.ps1 test
|
||||
|
||||
2
Makefile
2
Makefile
@@ -180,7 +180,7 @@ help:
|
||||
@echo ' make [RUNTIME=net6] TARGETPLATFORM=unix-generic'
|
||||
@echo
|
||||
@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 'to check the engine and official mod dlls for code style violations, run:'
|
||||
@echo ' make [RUNTIME=net6] check'
|
||||
|
||||
@@ -41,11 +41,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
return true;
|
||||
}
|
||||
|
||||
bool warningAsError = false;
|
||||
|
||||
[Desc("[MAPFILE]", "Check a mod or map for certain yaml errors.")]
|
||||
void IUtilityCommand.Run(Utility utility, string[] args)
|
||||
{
|
||||
// HACK: The engine code assumes that Game.modData is set.
|
||||
var modData = Game.ModData = utility.ModData;
|
||||
warningAsError = Environment.GetEnvironmentVariable("TREAT_WARNINGS_AS_ERRORS")?.Equals("true", StringComparison.CurrentCultureIgnoreCase) ?? false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -77,7 +80,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
try
|
||||
{
|
||||
var customPass = (ILintPass)modData.ObjectCreator.CreateBasic(customPassType);
|
||||
customPass.Run(EmitError, EmitWarning, modData);
|
||||
customPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -140,7 +143,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
try
|
||||
{
|
||||
var customMapPass = (ILintMapPass)modData.ObjectCreator.CreateBasic(customMapPassType);
|
||||
customMapPass.Run(EmitError, EmitWarning, modData, map);
|
||||
customMapPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData, map);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -156,7 +159,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
try
|
||||
{
|
||||
var customRulesPass = (ILintRulesPass)modData.ObjectCreator.CreateBasic(customRulesPassType);
|
||||
customRulesPass.Run(EmitError, EmitWarning, modData, rules);
|
||||
customRulesPass.Run(EmitError, warningAsError ? EmitError : EmitWarning, modData, rules);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -172,7 +175,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user