]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ci] Cache downloaded packages for GitHub actions
authorMichael Brown <mcb30@ipxe.org>
Mon, 6 Feb 2023 18:30:06 +0000 (18:30 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 6 Feb 2023 19:59:04 +0000 (19:59 +0000)
Speed up the "Install packages" step for each CI run by caching the
downloaded packages in /var/cache/apt.

Do not include libc6-dbg:i386 within the cache, since apt seems to
complain if asked to download both gcc-aarch64-linux-gnu and
libc6-dbg:i386 at the same time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
.github/workflows/build.yml

index b6e18e31057f53567da110f31f73098b9fbc9647..72a1234b6597695cdbf1a17f9ef140d6ff677ff7 100644 (file)
@@ -4,14 +4,45 @@ on: push
 
 jobs:
 
+  cache:
+    name: Cache
+    runs-on: ubuntu-22.04
+    steps:
+      - name: Cache permissions
+        run: |
+          sudo chown $(id -un) /var/cache/apt/archives
+      - name: Cache packages
+        uses: actions/cache@v3
+        with:
+          path: /var/cache/apt/archives/*.deb
+          key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
+          restore-keys: |
+            apt-cache-
+      - name: Download packages
+        run: |
+          sudo apt update
+          sudo apt install -y -d -o Acquire::Retries=50 \
+                           mtools syslinux isolinux \
+                           libc6-dev-i386 valgrind \
+                           gcc-arm-none-eabi gcc-aarch64-linux-gnu
+
   x86:
     name: x86
     runs-on: ubuntu-22.04
+    needs: cache
     steps:
       - name: Check out code
         uses: actions/checkout@v3
         with:
           fetch-depth: 0
+      - name: Cache permissions
+        run: |
+          sudo chown $(id -un) /var/cache/apt/archives
+      - name: Cache packages
+        uses: actions/cache/restore@v3
+        with:
+          path: /var/cache/apt/archives/*.deb
+          key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
       - name: Install packages
         run: |
           sudo dpkg --add-architecture i386
@@ -33,11 +64,20 @@ jobs:
   arm32:
     name: ARM32
     runs-on: ubuntu-22.04
+    needs: cache
     steps:
       - name: Check out code
         uses: actions/checkout@v3
         with:
           fetch-depth: 0
+      - name: Cache permissions
+        run: |
+          sudo chown $(id -un) /var/cache/apt/archives
+      - name: Cache packages
+        uses: actions/cache/restore@v3
+        with:
+          path: /var/cache/apt/archives/*.deb
+          key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
       - name: Install packages
         run: |
           sudo apt update
@@ -53,11 +93,20 @@ jobs:
   arm64:
     name: ARM64
     runs-on: ubuntu-22.04
+    needs: cache
     steps:
       - name: Check out code
         uses: actions/checkout@v3
         with:
           fetch-depth: 0
+      - name: Cache permissions
+        run: |
+          sudo chown $(id -un) /var/cache/apt/archives
+      - name: Cache packages
+        uses: actions/cache/restore@v3
+        with:
+          path: /var/cache/apt/archives/*.deb
+          key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
       - name: Install packages
         run: |
           sudo apt update