From 60e24dd264c81757a2384b3fcfe7622718a4f664 Mon Sep 17 00:00:00 2001 From: Aleksandr Mikhailov Date: Sat, 10 Aug 2024 22:03:11 +0300 Subject: [PATCH 1/2] Fix weekly CI action - Change a way to call guix binary with sudo (take this idea from guix-install-action) - Replace substitute-urls inside guix-daemon unit file (not hapy with this solution, but it works) - Add rudimentary cache --- .github/workflows/build.yaml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8a38d98..164201e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,6 +18,14 @@ jobs: steps: - name: Git checkout uses: actions/checkout@v4 + - name: Guix cache + uses: actions/cache@v3 + with: + path: ~/.cache/guix + # use a key that (almost) never matches + key: guix-cache-${{ github.sha }} + restore-keys: | + guix-cache- - name: Install Guix uses: PromyLOPh/guix-install-action@v1.5 @@ -38,21 +46,35 @@ jobs: # This is necessary to authorize the substitute server wget https://substitutes.nonguix.org/signing-key.pub mv signing-key.pub nonguix-signing-key.pub - sudo guix archive --authorize < nonguix-signing-key.pub + sudo /var/guix/profiles/per-user/root/current-guix/bin/guix archive --authorize < nonguix-signing-key.pub + - name: Set daemon level Substitutes + run: | + SUBSTITUTE_URLS="https://ci.guix.gnu.org https://bordeaux.guix.gnu.org https://substitutes.nonguix.org" + + sudo sed -i "s|--substitute-urls='https://bordeaux.guix.gnu.org https://ci.guix.gnu.org'|--substitute-urls='$SUBSTITUTE_URLS'|g" /etc/systemd/system/guix-daemon.service + + sudo systemctl daemon-reload + sudo systemctl restart guix-daemon.service + - name: Build ISO run: | - SUBSTITUTE_URLS="--substitute-urls='https://ci.guix.gnu.org https://bordeaux.guix.gnu.org https://substitutes.nonguix.org'" + # Write out the channels file so it can be included - guix time-machine -C './guix/base-channels.scm' -- describe -f channels > './guix/channels.scm' - + guix time-machine -C ./guix/base-channels.scm -- describe -f channels > ./guix/channels.scm + # Build the image - image=$(guix time-machine -C './guix/channels.scm' $SUBSTITUTE_URLS -- system image -t iso9660 $SUBSTITUTE_URLS './guix/installer.scm') + image=$(guix time-machine -C ./guix/channels.scm -- system image -t iso9660 ./guix/installer.scm) # Copy the image to the local folder with a better name export RELEASE_TAG=$(date +"%Y%m%d%H%M") echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV cp $image ./guix-installer-$RELEASE_TAG.iso + - uses: actions/cache/save@v3 + if: always() + with: + path: ~/.cache/guix + key: guix-cache-${{ github.sha }} - name: Prepare Release Notes run: | From 863bf9475f78d2227f4cb026a39ee3833feaf6ca Mon Sep 17 00:00:00 2001 From: Aleksandr Mikhailov Date: Sat, 10 Aug 2024 22:10:13 +0300 Subject: [PATCH 2/2] Boring attempt to fix a cache --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 164201e..4b2cc36 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: - name: Git checkout uses: actions/checkout@v4 - name: Guix cache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: ~/.cache/guix # use a key that (almost) never matches