Skip to content

Commit

Permalink
ci: cache Guix folders
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Nov 23, 2023
1 parent 6db3c13 commit ff09f79
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/guix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,25 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Restore Guix cache
id: guix-cache-restore
uses: actions/cache/restore@v3
with:
path: |
/var/cache/guix
~/.cache/guix
~/.config/guix
key: ${{ runner.os }}-guix

- name: Run Guix build
run: |
docker run --privileged -d --rm -t \
--name guix-daemon \
-e ADDITIONAL_GUIX_COMMON_FLAGS="--max-jobs=$(nproc --all)" \
-v ${{ github.workspace }}:/src/dash \
-v /var/cache/guix:/var/cache/guix \
-v ~/.cache/guix:/home/ubuntu/.cache/guix \
-v ~/.config/guix:/home/ubuntu/.config/guix \
-w /src/dash \
guix_ubuntu:latest && \
docker exec guix-daemon bash -c '/usr/local/bin/guix-start'
Expand All @@ -57,6 +70,16 @@ jobs:
exit 1
fi
- name: Save Guix cache
id: guix-cache-save
uses: actions/cache/save@v3
with:
path: |
/var/cache/guix
~/.cache/guix
~/.config/guix
key: ${{ steps.guix-cache-restore.outputs.cache-primary-key }}

- name: Compute SHA256 checksums
run: |
./contrib/containers/guix/scripts/guix-check ${{ github.workspace }}
8 changes: 7 additions & 1 deletion contrib/containers/guix/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ COPY --from=docker_root ./scripts/guix-start /usr/local/bin/guix-start

# Create directory for mounting and grant necessary permissions
RUN mkdir -p /src/dash && \
chown -R ${USER_ID}:${GROUP_ID} /src
mkdir -p /var/cache/guix && \
mkdir -p /home/${USERNAME}/.cache/guix && \
mkdir -p /home/${USERNAME}/.config/guix && \
chown -R ${USER_ID}:${GROUP_ID} /src && \
chown -R ${USER_ID}:${GROUP_ID} /var/cache/guix && \
chown -R ${USER_ID}:${GROUP_ID} /home/${USERNAME}/.cache/guix && \
chown -R ${USER_ID}:${GROUP_ID} /home/${USERNAME}/.config/guix
WORKDIR "/src/dash"

# Switch to unprivileged context
Expand Down

0 comments on commit ff09f79

Please sign in to comment.