Skip to content

Commit

Permalink
ci/package_checks: Add check for monitoring.yml
Browse files Browse the repository at this point in the history
**Summary**

Add a check that errors when `monitoring.yml` does not exist.
  • Loading branch information
silkeh committed Oct 25, 2024
1 parent 34d5cba commit f495849
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/CI/package_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ def _read(self, path: str) -> str:
with self._open(path) as f:
return str(f.read())

def _exists(self, path: str) -> bool:
return os.path.exists(self._path(path))

def load_package_yml(self, file: str) -> PackageYML:
with self._open(file) as f:
return PackageYML(f)
Expand Down Expand Up @@ -417,6 +420,19 @@ def _includes_homepage(self, file: str) -> bool:
return 'homepage' in yaml.load(f)


class Monitoring(PullRequestCheck):
_error = '`monitoring.yml` is missing'
_level = Level.WARNING

def run(self) -> List[Result]:
return [Result(message=self._error, file=f, level=self._level)
for f in self.package_files
if not self._has_monitoring_yml(f)]

def _has_monitoring_yml(self, file: str) -> bool:
return self._exists(os.path.join(os.path.dirname(file), 'monitoring.yml'))


class PackageBumped(PullRequestCheck):
_msg = 'Package release is not incremented by 1'
_msg_new = 'Package release is not 1'
Expand Down Expand Up @@ -782,6 +798,7 @@ class Checker:
CommitMessage,
FrozenPackage,
Homepage,
Monitoring,
PackageBumped,
PackageDependenciesOrder,
PackageDirectory,
Expand Down

0 comments on commit f495849

Please sign in to comment.