Skip to content

Commit bdb5ef4

Browse files
committed
ci: update cache Graphviz
1 parent b439f00 commit bdb5ef4

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

.github/workflows/ci-test.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,39 @@ jobs:
3535
- name: Install dependencies
3636
run: poetry install --no-interaction --no-ansi
3737

38-
- name: Cache apt packages
39-
id: cache-apt
38+
- name: Cache Graphviz installation
39+
id: cache-graphviz
4040
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
4141
with:
42-
path: /var/cache/apt/archives
43-
key: apt-${{ runner.os }}-graphviz-v1
44-
restore-keys: |
45-
apt-${{ runner.os }}-graphviz-
42+
path: ~/graphviz-cache
43+
key: graphviz-installed-${{ runner.os }}-v3
4644

4745
- name: Install Graphviz and Debug
4846
run: |
4947
# ---- DEBUG - REMOVE AFTER FIXING ----
5048
echo "=== CACHE STATUS ==="
51-
echo "APT Cache hit: ${{ steps.cache-apt.outputs.cache-hit }}"
49+
echo "Graphviz Cache hit: ${{ steps.cache-graphviz.outputs.cache-hit }}"
5250
5351
echo "\n=== BEFORE INSTALL ==="
5452
which dot && echo "dot already exists" || echo "dot not found"
5553
56-
echo "\n=== INSTALLING GRAPHVIZ ==="
57-
sudo apt-get update
58-
sudo apt-get install -y graphviz
54+
if [ "${{ steps.cache-graphviz.outputs.cache-hit }}" = "true" ]; then
55+
echo "\n=== RESTORING CACHED GRAPHVIZ ==="
56+
sudo cp -r ~/graphviz-cache/bin/* /usr/bin/ 2>/dev/null || echo "No binaries to restore"
57+
sudo cp -r ~/graphviz-cache/lib/* /usr/lib/ 2>/dev/null || echo "No libraries to restore"
58+
sudo cp -r ~/graphviz-cache/share/* /usr/share/ 2>/dev/null || echo "No shared files to restore"
59+
sudo ldconfig
60+
else
61+
echo "\n=== INSTALLING GRAPHVIZ ==="
62+
sudo apt-get update
63+
sudo apt-get install -y graphviz
64+
65+
echo "\n=== CACHING GRAPHVIZ ==="
66+
mkdir -p ~/graphviz-cache/{bin,lib,share}
67+
cp /usr/bin/dot /usr/bin/neato /usr/bin/twopi /usr/bin/circo /usr/bin/fdp /usr/bin/sfdp /usr/bin/patchwork /usr/bin/osage ~/graphviz-cache/bin/ 2>/dev/null || echo "Some binaries not found"
68+
cp -r /usr/lib/x86_64-linux-gnu/*graphviz* ~/graphviz-cache/lib/ 2>/dev/null || echo "No graphviz libs found"
69+
cp -r /usr/share/graphviz ~/graphviz-cache/share/ 2>/dev/null || echo "No graphviz share found"
70+
fi
5971
6072
echo "\n=== AFTER INSTALL ==="
6173
which dot && dot -V || echo "dot command not found"

0 commit comments

Comments
 (0)