Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CI): prevent PRs that cause DB errors to get on master #1407

Merged
merged 14 commits into from Feb 6, 2019
@@ -44,3 +44,5 @@ install:
script:
# compile
- bash ./acore.sh "compiler" "all"
- git clone --depth=1 --single-branch https://github.com/ac-data/ac-data.git .env/dist
- ./env/dist/bin/worldserver --dry-run
@@ -46,7 +46,12 @@ class ConfigMgr

std::list<std::string> GetKeysByString(std::string const& name);

bool isDryRun() { return this->dryRun; }
void setDryRun(bool mode) { this->dryRun = mode; }

private:
bool dryRun = false;

bool GetValueHelper(const char* name, ACE_TString &result);
bool LoadData(char const* file);

@@ -1350,18 +1350,21 @@ void World::SetInitialWorldSettings()
///- Init highest guids before any table loading to prevent using not initialized guids in some code.
sObjectMgr->SetHighestGuids();

///- Check the existence of the map files for all races' startup areas.
if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
|| !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
|| !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
|| !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
|| !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
|| !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
|| (m_int_configs[CONFIG_EXPANSION] && (
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
exit(1);
if (!sConfigMgr->isDryRun())
{
///- Check the existence of the map files for all races' startup areas.
This conversation was marked as resolved by FrancescoBorzi

This comment has been minimized.

Copy link
@BarbzYHOOL

BarbzYHOOL Feb 4, 2019

Member

startup areas? rather starting zones, no ?

and just from reading the comment, what about using custom maps ? (i know we only do blizzlike but just curiosity)

This comment has been minimized.

Copy link
@Deku

Deku Feb 4, 2019

Contributor

I think it checks only starting areas because it's the minimum needed to run the game.

This comment has been minimized.

Copy link
@FrancescoBorzi

FrancescoBorzi Feb 4, 2019

Author Member

@BarbzYHOOL I haven't modified that comment, just moved it inside an if block. So this is not related with this PR. My change is just about to skip that check (whatever it does) because that check needs maps and we don't want it in the dry run.

This comment has been minimized.

Copy link
@BarbzYHOOL

BarbzYHOOL Feb 4, 2019

Member

can still improve it damnit, these comments are bad

Comments are holy or what xD

if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
|| !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
|| !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
|| !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
|| !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
|| !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
|| (m_int_configs[CONFIG_EXPANSION] && (
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
exit(1);
}
}

///- Initialize pool manager
@@ -1952,6 +1955,11 @@ void World::SetInitialWorldSettings()
sLog->outString("Enabling database logging...");
sLog->SetLogDB(true);
}

if (sConfigMgr->isDryRun()) {
sLog->outString("AzerothCore dry run completed, terminating.");
exit(0);
}
}

void World::DetectDBCLang()
@@ -65,6 +65,11 @@ extern int main(int argc, char** argv)
int c = 1;
while (c < argc)
{
if (strcmp(argv[c], "--dry-run") == 0)
{
sConfigMgr->setDryRun(true);
}

if (!strcmp(argv[c], "-c"))
{
if (++c >= argc)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.