Ver Fonte

github action does not support subprocess

Fred Lefévère-Laoide há 1 ano atrás
pai
commit
2160d85c41
1 ficheiros alterados com 12 adições e 8 exclusões
  1. 12 8
      tools/frontend/bundle_build.py

+ 12 - 8
tools/frontend/bundle_build.py

@@ -9,7 +9,7 @@
 # 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 subprocess
+import os
 import sys
 from pathlib import Path
 
@@ -20,11 +20,14 @@ def build_gui(root_path: Path):
     if already_exists:
         print(f'Found taipy-gui frontend bundle in {root_path  / "taipy" / "gui" / "webapp"}.')
     else:
-        subprocess.run(["npm", "ci"], cwd=root_path / "frontend" / "taipy-gui" / "dom", check=True, shell=True)
-        subprocess.run(
-            ["npm", "ci", "--omit=optional"], cwd=root_path / "frontend" / "taipy-gui", check=True, shell=True
-        )
-        subprocess.run(["npm", "run", "build"], cwd=root_path / "frontend" / "taipy-gui", check=True, shell=True)
+        # does not work in GH Action :-(
+        # subprocess.run(["npm", "ci"], cwd=root_path / "frontend" / "taipy-gui" / "dom", check=True, shell=True)
+        os.system(f'cd {root_path / "frontend" / "taipy-gui" / "dom"}; npm ci')
+        # subprocess.run(
+        #     ["npm", "ci", "--omit=optional"], cwd=root_path / "frontend" / "taipy-gui", check=True, shell=True
+        # )
+        # subprocess.run(["npm", "run", "build"], cwd=root_path / "frontend" / "taipy-gui", check=True, shell=True)
+        os.system(f'cd {root_path / "frontend" / "taipy-gui"}; npm ci --omit=optional && npm run build')
 
 
 def build_taipy(root_path: Path):
@@ -38,8 +41,9 @@ def build_taipy(root_path: Path):
         if not env_file_path.exists():
             with open(env_file_path, "w") as env_file:
                 env_file.write(f"TAIPY_GUI_DIR={root_path}\n")
-        subprocess.run(["npm", "ci"], cwd=root_path / "frontend" / "taipy", check=True, shell=True)
-        subprocess.run(["npm", "run", "build"], cwd=root_path / "frontend" / "taipy", check=True, shell=True)
+        # subprocess.run(["npm", "ci"], cwd=root_path / "frontend" / "taipy", check=True, shell=True)
+        # subprocess.run(["npm", "run", "build"], cwd=root_path / "frontend" / "taipy", check=True, shell=True)
+        os.system(f'cd {root_path / "frontend" / "taipy"}; npm ci && npm run build')
 
 
 if __name__ == "__main__":