Ver código fonte

chore: add frontend build step

Joao Andre 1 ano atrás
pai
commit
b74dd3fbaa

+ 10 - 3
.github/workflows/build-and-release-dev.yml

@@ -110,11 +110,15 @@ jobs:
         run: |
           cp tools/gui/generate_pyi.py pyi_temp.py && pipenv run python pyi_temp.py && rm pyi_temp.py
 
+      - name: Build frontends
+        if: matrix.package == 'gui'
+        run: |
+          python tools/frontend/bundle_build.py
+
       - name: Build Package Structure
         working-directory: ${{ steps.set-variables.outputs.package_dir }}
         run: |
           python tools/release/build_package_structure.py ${{ matrix.package }}
-          ls -lah
 
       - name: Build package
         working-directory: ${{ steps.set-variables.outputs.package_dir }}
@@ -138,8 +142,6 @@ jobs:
         uses: pypa/gh-action-pypi-publish@release/v1
 
   build-and-release-taipy-dev:
-    permissions:
-      id-token: write  # IMPORTANT: this permission is mandatory for trusted publishing
     runs-on: ubuntu-latest
     needs: [ build-and-release-taipy-dev-packages, fetch-versions ]
     timeout-minutes: 20
@@ -169,6 +171,11 @@ jobs:
             ${{needs.fetch-versions.outputs.templates_VERSION}} \
             ${{ github.event.inputs.publish_on_pypi }}
 
+      - name: Replace setup.py
+        run: |
+          mv setup.py setup.old.py
+          cp tools/packages/taipy/setup.py .
+
       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip

+ 1 - 1
taipy/gui/MANIFEST.in

@@ -1,7 +1,7 @@
 recursive-include tools *
 
 # Package taipy-gui
-recursive-include webapp *
+recursive-include taipy/gui/webapp *
 include version.json
 include viselements.json
 include *.pyi

+ 3 - 3
tools/gui/generate_pyi.py

@@ -38,9 +38,9 @@ replaced_content = ""
 with open(gui_pyi_file, "r") as file:
     for line in file:
         if "def run(" in line:
-            line = line.replace(
-                ", run_server: bool = ..., run_in_thread: bool = ..., async_mode: str = ..., **kwargs", gui_config
-            )
+            replace_str = line[line.index(", run_server") : (line.index("**kwargs") + len("**kwargs"))]
+            # ", run_server: bool = ..., run_in_thread: bool = ..., async_mode: str = ..., **kwargs"
+            line = line.replace(replace_str, gui_config)
         replaced_content = replaced_content + line
 
 with open(gui_pyi_file, "w") as write_file:

+ 0 - 5
tools/release/build_package_structure.py

@@ -27,8 +27,3 @@ if __name__ == "__main__":
         if file_name.lower().endswith((".md", ".json")) or file_name in __SKIP:
             continue
         shutil.move(file_name, _package_path)
-
-    for file_name in os.listdir("../"):
-        if os.path.isdir(file_name):
-            continue
-        shutil.move(file_name, ".")

+ 14 - 3
tools/release/update_setup_requirements.py

@@ -1,3 +1,14 @@
+# Copyright 2021-2024 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations under the License.
+
 import os
 import sys
 from typing import Dict
@@ -8,7 +19,7 @@ BASE_PATH = "./tools/packages"
 def __build_taipy_package_line(line: str, version: str, publish_on_py_pi: bool) -> str:
     _line = line.strip()
     if publish_on_py_pi:
-        return f"{_line}=={version}"
+        return f"{_line}=={version}\n"
     return f"{_line} @ https://github.com/Avaiga/taipy/releases/download/{version}/{version}.tar.gz\n"
 
 
@@ -21,7 +32,7 @@ def update_setup_requirements(package: str, versions: Dict, publish_on_py_pi: bo
                 line = __build_taipy_package_line(line, v, publish_on_py_pi)
             lines.append(line)
 
-    with open(_path, 'w') as file:
+    with open(_path, "w") as file:
         file.writelines(lines)
 
 
@@ -34,6 +45,6 @@ if __name__ == "__main__":
         "taipy-rest": sys.argv[5],
         "taipy-templates": sys.argv[6],
     }
-    _publish_on_py_pi = bool(sys.argv[7])
+    _publish_on_py_pi = True if sys.argv[7] == "true" else False
 
     update_setup_requirements(_package, _versions, _publish_on_py_pi)