diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ab5c90e..ea51a24 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,16 +20,16 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.8' # Set the Python version you need + python-version: '3.11' # Set the Python version you need - name: Install dependencies run: | - python -m pip install --upgrade pip GitPython packaging lxml emit xmltodict + python -m pip install --upgrade pip GitPython packaging lxml emit xmltodict pymavlink # Add any other dependencies here - name: Run Python script run: | - python scripts/run_param_parse.py + python scripts/run_parsers.py python scripts/json_from_xml.py - name: Commit and push if changed diff --git a/scripts/run_param_parse.py b/scripts/run_parsers.py similarity index 88% rename from scripts/run_param_parse.py rename to scripts/run_parsers.py index 3fe9f71..113aa29 100755 --- a/scripts/run_param_parse.py +++ b/scripts/run_parsers.py @@ -70,6 +70,9 @@ def run(self): tag_names = [tag.path[len('refs/tags/'):] for tag in self.repository.tags] last_ground_change = Groundskeeper.get_last_ground_change(git.Repo(Path(__file__).parent.parent)) + # Prepare for MAVLink parsing - always use the latest script (since it might cover new messages) + shutil.copy(f'{self.repository_path}/Tools/scripts/mavlink_parse.py', self.temp_folder) + # Get only valid tag names tags = [ { @@ -128,6 +131,8 @@ def run(self): if last_ground_change > tag_date: print(f"Version already generated for {tag_date}") continue + + # Run parameters parser try: subprocess.run([f'{self.repository_path}/Tools/autotest/param_metadata/param_parse.py', '--vehicle', vehicle_type], cwd=self.repository_path) except Exception as exception: @@ -146,7 +151,15 @@ def run(self): shutil.copy2(data, dest) os.remove(data) + # Run MAVLink messages parser + vehicle = f'{"Ardu" if vehicle_type != "Rover" else ""}{vehicle_type}' + try: + subprocess.run([f'{self.temp_folder}/mavlink_parse.py', '-cguq', '--header', 'ardupilot_wiki', '--format', 'rst', + '--filename', f'{dest}/MAVLinkMessages.rst', '--branch', folder_name, '--vehicle', vehicle], + cwd=f'{self.repository_path}/Tools/scripts/') + except Exception as exception: + print(exception) G = Groundskeeper() -G.run() \ No newline at end of file +G.run()