Skip to content

Commit

Permalink
Speedup static build by utilizing CI cache on /nix folder
Browse files Browse the repository at this point in the history
Signed-off-by: Wong Hoi Sing Edison <[email protected]>
  • Loading branch information
hswong3i committed Jul 26, 2020
1 parent 3c396d4 commit 3a08038
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,36 @@ static_binary_task:
depends_on:
- 'config'
- 'fmt'

gce_instance:
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
cpu: 8
memory: 12
disk: 200
script: |

init_script: |
set -ex
setenforce 0
growpart /dev/sda 1 || true
resize2fs /dev/sda1 || true
yum -y install podman
nix_cache:
folder: '.cache'
reupload_on_changes: true
fingerprint_script: |
echo "nix-v8-$(sha1sum nix/nixpkgs.json | head -c 40)"
populate_script: |
mkdir -p .cache
build_script: |
set -ex
mkdir -p /nix
podman run --rm --privileged -ti -v /:/mnt nixos/nix cp -rfT /nix /mnt/nix
podman run --rm --privileged -ti -v /nix:/nix -v ${PWD}:${PWD} -w ${PWD} nixos/nix nix --print-build-logs --option cores 8 --option max-jobs 8 build --file nix/
if [[ ! -z $(ls -A .cache) ]]; then rsync -aq --delete .cache/ /nix; else podman run --rm --privileged -v /:/mnt nixos/nix cp -rfT /nix /mnt/nix; fi
podman run --rm --privileged -v /nix:/nix -v ${PWD}:${PWD} -w ${PWD} nixos/nix nix --option cores 8 --option max-jobs 8 build --file nix/
mkdir -p .cache
rsync -aq --delete /nix/ .cache
chown -Rf $(whoami) .cache
binaries_artifacts:
path: "result/bin/conmon"

0 comments on commit 3a08038

Please sign in to comment.