build workflows - reuse cache_dependencies.py

This commit is contained in:
Andrej730
2026-02-23 12:42:50 +05:00
parent 00cd0b76f9
commit 7909997d42
5 changed files with 17 additions and 18 deletions
+3 -5
View File
@@ -49,8 +49,8 @@ jobs:
- name: Unpack Dependencies - name: Unpack Dependencies
run: | run: |
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) cd build
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true python ../nix/cache_dependencies.py unpack
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
@@ -95,9 +95,7 @@ jobs:
- name: Pack Dependencies - name: Pack Dependencies
run: | run: |
cd build cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do python ../nix/cache_dependencies.py pack
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
- name: Commit and Push Changes to Build Repository - name: Commit and Push Changes to Build Repository
run: | run: |
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- name: Unpack Dependencies - name: Unpack Dependencies
run: | run: |
cd ifcopenshell_build cd ifcopenshell_build
python ../IfcOpenShell/pyodide/cache_dependencies.py unpack python ../IfcOpenShell/nix/cache_dependencies.py unpack
- name: ccache - name: ccache
uses: hendrikmuhs/ccache-action@v1.2 uses: hendrikmuhs/ccache-action@v1.2
@@ -65,7 +65,7 @@ jobs:
- name: Pack Dependencies - name: Pack Dependencies
run: | run: |
cd ifcopenshell_build 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 - name: Commit and Push Changes to Build Repository
run: | run: |
+3 -5
View File
@@ -44,8 +44,8 @@ jobs:
- name: Unpack Dependencies - name: Unpack Dependencies
run: | run: |
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) cd build
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true python3 ../nix/cache_dependencies.py unpack
- name: ccache - name: ccache
# TODO: Use tag after 1.2.20 releases. # TODO: Use tag after 1.2.20 releases.
@@ -72,9 +72,7 @@ jobs:
- name: Pack Dependencies - name: Pack Dependencies
run: | run: |
cd build cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do python3 ../nix/cache_dependencies.py pack
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
- name: Commit and Push Changes to Build Repository - name: Commit and Push Changes to Build Repository
run: | run: |
+3 -5
View File
@@ -44,8 +44,8 @@ jobs:
- name: Unpack Dependencies - name: Unpack Dependencies
run: | run: |
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true) cd build
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true python3 ../nix/cache_dependencies.py unpack
- name: ccache - name: ccache
# TODO: Use tag after 1.2.20 releases. # TODO: Use tag after 1.2.20 releases.
@@ -72,9 +72,7 @@ jobs:
- name: Pack Dependencies - name: Pack Dependencies
run: | run: |
cd build cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do python3 ../nix/cache_dependencies.py pack
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
- name: Commit and Push Changes to Build Repository - name: Commit and Push Changes to Build Repository
run: | run: |
@@ -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] Usage: python cache_dependencies.py [pack|unpack]
""" """
import platform
import sys import sys
import tarfile import tarfile
from pathlib import Path from pathlib import Path
@@ -19,7 +20,11 @@ CACHE_PREFIX = "cache-"
def get_install_dir() -> Path: 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 return data
raise Exception("No install dir found") raise Exception("No install dir found")