diff --git a/.github/workflows/build_osx.yml b/.github/workflows/build_osx.yml index eb680e54c1..6cabc97578 100644 --- a/.github/workflows/build_osx.yml +++ b/.github/workflows/build_osx.yml @@ -49,8 +49,8 @@ jobs: - name: Unpack Dependencies run: | - install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) - [ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true + cd build + python ../nix/cache_dependencies.py unpack - name: ccache uses: hendrikmuhs/ccache-action@v1.2 @@ -95,9 +95,7 @@ jobs: - name: Pack Dependencies run: | cd build - for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do - test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir"); - done + python ../nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/.github/workflows/build_pyodide.yml b/.github/workflows/build_pyodide.yml index 744bd9e772..d0feb08a8b 100644 --- a/.github/workflows/build_pyodide.yml +++ b/.github/workflows/build_pyodide.yml @@ -26,7 +26,7 @@ jobs: - name: Unpack Dependencies run: | cd ifcopenshell_build - python ../IfcOpenShell/pyodide/cache_dependencies.py unpack + python ../IfcOpenShell/nix/cache_dependencies.py unpack - name: ccache uses: hendrikmuhs/ccache-action@v1.2 @@ -65,7 +65,7 @@ jobs: - name: Pack Dependencies run: | cd ifcopenshell_build - python ../IfcOpenShell/pyodide/cache_dependencies.py pack + python ../IfcOpenShell/nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/.github/workflows/build_rocky.yml b/.github/workflows/build_rocky.yml index 217620987a..3f608ab5f6 100644 --- a/.github/workflows/build_rocky.yml +++ b/.github/workflows/build_rocky.yml @@ -44,8 +44,8 @@ jobs: - name: Unpack Dependencies run: | - install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) - [ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true + cd build + python3 ../nix/cache_dependencies.py unpack - name: ccache # TODO: Use tag after 1.2.20 releases. @@ -72,9 +72,7 @@ jobs: - name: Pack Dependencies run: | cd build - for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do - test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir"); - done + python3 ../nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/.github/workflows/build_rocky_arm.yml b/.github/workflows/build_rocky_arm.yml index d195b7b868..e08cf2c78f 100644 --- a/.github/workflows/build_rocky_arm.yml +++ b/.github/workflows/build_rocky_arm.yml @@ -44,8 +44,8 @@ jobs: - name: Unpack Dependencies run: | - install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) - [ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true + cd build + python3 ../nix/cache_dependencies.py unpack - name: ccache # TODO: Use tag after 1.2.20 releases. @@ -72,9 +72,7 @@ jobs: - name: Pack Dependencies run: | cd build - for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do - test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir"); - done + python3 ../nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | diff --git a/pyodide/cache_dependencies.py b/nix/cache_dependencies.py similarity index 92% rename from pyodide/cache_dependencies.py rename to nix/cache_dependencies.py index b01b552f8c..d03bda3dbc 100644 --- a/pyodide/cache_dependencies.py +++ b/nix/cache_dependencies.py @@ -10,6 +10,7 @@ Expected to be executed from 'build' directory (e.g. that might contain 'Linux/x Usage: python cache_dependencies.py [pack|unpack] """ +import platform import sys import tarfile from pathlib import Path @@ -19,7 +20,11 @@ CACHE_PREFIX = "cache-" def get_install_dir() -> Path: - for data in Path.cwd().glob("*/*/install"): + if platform.system() == "Darwin": + pattern = "Darwin/*/*/install" + else: + pattern = "*/*/install" + for data in Path.cwd().glob(pattern): return data raise Exception("No install dir found")