Skip to content

Commit 7909997

Browse files
committed
build workflows - reuse cache_dependencies.py
1 parent 00cd0b7 commit 7909997

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

.github/workflows/build_osx.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949
5050
- name: Unpack Dependencies
5151
run: |
52-
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true)
53-
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true
52+
cd build
53+
python ../nix/cache_dependencies.py unpack
5454
5555
- name: ccache
5656
uses: hendrikmuhs/ccache-action@v1.2
@@ -95,9 +95,7 @@ jobs:
9595
- name: Pack Dependencies
9696
run: |
9797
cd build
98-
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
99-
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");
100-
done
98+
python ../nix/cache_dependencies.py pack
10199
102100
- name: Commit and Push Changes to Build Repository
103101
run: |

.github/workflows/build_pyodide.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Unpack Dependencies
2727
run: |
2828
cd ifcopenshell_build
29-
python ../IfcOpenShell/pyodide/cache_dependencies.py unpack
29+
python ../IfcOpenShell/nix/cache_dependencies.py unpack
3030
3131
- name: ccache
3232
uses: hendrikmuhs/ccache-action@v1.2
@@ -65,7 +65,7 @@ jobs:
6565
- name: Pack Dependencies
6666
run: |
6767
cd ifcopenshell_build
68-
python ../IfcOpenShell/pyodide/cache_dependencies.py pack
68+
python ../IfcOpenShell/nix/cache_dependencies.py pack
6969
7070
- name: Commit and Push Changes to Build Repository
7171
run: |

.github/workflows/build_rocky.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444

4545
- name: Unpack Dependencies
4646
run: |
47-
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true)
48-
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true
47+
cd build
48+
python3 ../nix/cache_dependencies.py unpack
4949
5050
- name: ccache
5151
# TODO: Use tag after 1.2.20 releases.
@@ -72,9 +72,7 @@ jobs:
7272
- name: Pack Dependencies
7373
run: |
7474
cd build
75-
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
76-
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");
77-
done
75+
python3 ../nix/cache_dependencies.py pack
7876
7977
- name: Commit and Push Changes to Build Repository
8078
run: |

.github/workflows/build_rocky_arm.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444

4545
- name: Unpack Dependencies
4646
run: |
47-
install_root=$(find ./build -maxdepth 4 -type d -name install 2>/dev/null | head -n 1 || true)
48-
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true
47+
cd build
48+
python3 ../nix/cache_dependencies.py unpack
4949
5050
- name: ccache
5151
# TODO: Use tag after 1.2.20 releases.
@@ -72,9 +72,7 @@ jobs:
7272
- name: Pack Dependencies
7373
run: |
7474
cd build
75-
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
76-
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");
77-
done
75+
python3 ../nix/cache_dependencies.py pack
7876
7977
- name: Commit and Push Changes to Build Repository
8078
run: |
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Usage: python cache_dependencies.py [pack|unpack]
1111
"""
1212

13+
import platform
1314
import sys
1415
import tarfile
1516
from pathlib import Path
@@ -19,7 +20,11 @@
1920

2021

2122
def get_install_dir() -> Path:
22-
for data in Path.cwd().glob("*/*/install"):
23+
if platform.system() == "Darwin":
24+
pattern = "Darwin/*/*/install"
25+
else:
26+
pattern = "*/*/install"
27+
for data in Path.cwd().glob(pattern):
2328
return data
2429
raise Exception("No install dir found")
2530

0 commit comments

Comments
 (0)