From c525eb47c9be5b51fc37a80f2493f4c9c07ef25f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 2 Aug 2021 08:26:37 -0400 Subject: [PATCH] sanity-checks: Make it run locally trilom/file-changes-action action has issues and it prevents running sanity checks locally. Instead of relying on the changed files to know which wraps are modified by a PR, rely on the added release tags. Fixes: #121. --- .github/workflows/sanity_checks.yml | 2 -- tools/sanity_checks.py | 19 +++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/sanity_checks.yml b/.github/workflows/sanity_checks.yml index 1d1edd982..90bba664f 100644 --- a/.github/workflows/sanity_checks.yml +++ b/.github/workflows/sanity_checks.yml @@ -16,8 +16,6 @@ jobs: sudo apt-get -y install build-essential python3-pip ninja-build pip install meson - - uses: trilom/file-changes-action@v1.2.3 - - name: Sanity Checks run: | ./tools/sanity_checks.py diff --git a/tools/sanity_checks.py b/tools/sanity_checks.py index 177dc4ca5..edebe95c6 100755 --- a/tools/sanity_checks.py +++ b/tools/sanity_checks.py @@ -46,17 +46,16 @@ def test_releases(self): # Verify keys are sorted self.assertEqual(sorted(releases.keys()), list(releases.keys())) - # Get the list of wraps that has modified packagefiles - with open(Path.home() / 'files.json', 'r') as f: - changed_files = json.load(f) - self.changed_wraps = set() - for f in changed_files: - if f.startswith('subprojects/packagefiles'): - self.changed_wraps.add(f.split('/')[2]) - for name, info in releases.items(): print('Checking', name) + # We do extra checks in the case a new release is being made. This + # is because some wraps are not passing all tests but we force making + # them compliant next time we do a release. + versions = info['versions'] + latest_tag = f'{name}_{versions[0]}' + extra_checks = latest_tag not in tags + # Make sure we can load wrap file config = configparser.ConfigParser() config.read(f'subprojects/{name}.wrap') @@ -73,7 +72,7 @@ def test_releases(self): self.assertIn('source_hash', wrap_section) # FIXME: Not all wraps currently complies, only check for wraps we modify. - if name in self.changed_wraps: + if extra_checks: self.assertIn('provide', config.sections()) patch_directory = wrap_section.get('patch_directory') @@ -81,7 +80,7 @@ def test_releases(self): patch_path = Path('subprojects', 'packagefiles', patch_directory) self.assertTrue(patch_path.is_dir()) # FIXME: Not all wraps currently complies, only check for wraps we modify. - if name in self.changed_wraps: + if extra_checks: self.assertTrue(Path(patch_path, 'LICENSE.build').is_file()) self.check_files(patch_path)