2023-05-16 05:15:34 +02:00
|
|
|
name: Guix Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [ labeled ]
|
2023-07-28 18:43:31 +02:00
|
|
|
workflow_dispatch:
|
2023-05-16 05:15:34 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-07-28 18:43:31 +02:00
|
|
|
runs-on: [ "self-hosted", "linux", "x64", "ubuntu-core" ]
|
2023-05-16 05:15:34 +02:00
|
|
|
if: contains(github.event.pull_request.labels.*.name, 'guix-build')
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-08-01 19:17:40 +02:00
|
|
|
uses: actions/checkout@v3
|
2023-06-07 05:30:12 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2023-05-16 05:15:34 +02:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-07-07 23:04:22 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2023-05-16 05:15:34 +02:00
|
|
|
|
2023-06-25 21:22:27 +02:00
|
|
|
- name: Commit variables
|
2023-05-16 05:15:34 +02:00
|
|
|
id: dockerfile
|
|
|
|
run: |
|
2023-07-07 23:04:22 +02:00
|
|
|
echo "hash=$(sha256sum ./contrib/containers/guix/Dockerfile | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
|
|
|
|
echo "host_user_id=$(id -u)" >> $GITHUB_OUTPUT
|
|
|
|
echo "host_group_id=$(id -g)" >> $GITHUB_OUTPUT
|
2023-05-16 05:15:34 +02:00
|
|
|
|
|
|
|
- name: Cache Docker layers
|
2023-08-01 19:17:40 +02:00
|
|
|
uses: actions/cache@v3
|
2023-05-16 05:15:34 +02:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ steps.dockerfile.outputs.hash }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
- name: Build Docker image
|
2023-07-07 23:04:22 +02:00
|
|
|
uses: docker/build-push-action@v4
|
2023-05-16 05:15:34 +02:00
|
|
|
with:
|
2023-06-25 21:22:27 +02:00
|
|
|
context: ${{ github.workspace }}
|
|
|
|
build-args: |
|
|
|
|
USER_ID=${{ steps.dockerfile.outputs.host_user_id }}
|
|
|
|
GROUP_ID=${{ steps.dockerfile.outputs.host_group_id }}
|
|
|
|
build-contexts: |
|
|
|
|
docker_root=${{ github.workspace }}/contrib/containers/guix
|
|
|
|
file: ./contrib/containers/guix/Dockerfile
|
2023-05-16 05:15:34 +02:00
|
|
|
load: true
|
2023-06-25 21:22:27 +02:00
|
|
|
tags: guix_ubuntu:latest
|
2023-05-16 05:15:34 +02:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
|
|
|
|
|
|
- name: Run Guix build
|
|
|
|
run: |
|
2023-06-25 21:22:27 +02:00
|
|
|
docker run --privileged -d --rm -t \
|
|
|
|
--name guix-daemon \
|
2023-06-28 20:59:16 +02:00
|
|
|
-e ADDITIONAL_GUIX_COMMON_FLAGS="--max-jobs=$(nproc --all)" \
|
2023-06-25 21:22:27 +02:00
|
|
|
-v ${{ github.workspace }}:/src/dash \
|
|
|
|
-w /src/dash \
|
|
|
|
guix_ubuntu:latest && \
|
2023-06-28 20:59:16 +02:00
|
|
|
docker exec guix-daemon bash -c '/usr/local/bin/guix-start'
|
2023-05-16 05:15:34 +02:00
|
|
|
|
|
|
|
- name: Ensure build passes
|
|
|
|
run: |
|
|
|
|
if [[ $? != 0 ]]; then
|
|
|
|
echo "Guix build failed!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-06-28 20:59:16 +02:00
|
|
|
|
|
|
|
- name: Compute SHA256 checksums
|
2023-05-16 05:15:34 +02:00
|
|
|
run: |
|
2023-06-28 20:59:16 +02:00
|
|
|
./contrib/containers/guix/scripts/guix-check ${{ github.workspace }}
|