From 7ca705cc0a19d5e684f45354b9f71325bdf3b4c4 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Mon, 3 Jun 2024 23:57:34 +0100 Subject: [PATCH] ci: improvements to teh build process --- .gitlab-ci.yml | 25 +++++++++++++------------ Cargo.toml | 2 +- flake.nix | 5 +++++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6260837..a7caf5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,15 +6,14 @@ stages: - build - deploy -cache: - key: "$CI_JOB_NAME" - paths: - - target/ - # Set any required environment variables here variables: RUST_BACKTRACE: FULL +.scripts_cache: &scripts_cache + - nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client + - attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY + - attic use skynet-cache # clippy and fmt are magic # runs on all commits/branches @@ -30,7 +29,7 @@ lint-clippy: when: never - changes: - src/**/* - - cargo.* + - Cargo.* when: always lint-fmt: @@ -45,24 +44,26 @@ lint-fmt: when: never - changes: - src/**/* - - cargo.* + - Cargo.* when: always # has to actually compile build: stage: build + tags: + - nix + before_script: + - *scripts_cache script: - - rustc --version - - cargo version - - cargo build --verbose - - RUST_BACKTRACE=1 cargo test --verbose + - attic watch-store skynet-cache & + - nix --extra-experimental-features "nix-command flakes" build --verbose rules: - if: $CI_COMMIT_TAG when: never - changes: - src/**/* - - cargo.* + - Cargo.* when: on_success diff --git a/Cargo.toml b/Cargo.toml index a54eb15..ce6cb9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,4 +39,4 @@ lettre = "0.10.4" maud = "0.25.0" # verifying ssh keys -ssh-key = { version = "0.6.1", features = ["crypto", "dsa"] } +ssh-key = { version = "0.6.1", features = ["crypto", "dsa"] } \ No newline at end of file diff --git a/flake.nix b/flake.nix index e62d839..2e8ea6c 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,11 @@ naersk.url = "github:nix-community/naersk"; utils.url = "github:numtide/flake-utils"; }; + + nixConfig = { + extra-substituters = "https://nix-cache.skynet.ie/skynet-cache"; + extra-trusted-public-keys = "skynet-cache:zMFLzcRZPhUpjXUy8SF8Cf7KGAZwo98SKrzeXvdWABo="; + }; outputs = { self, nixpkgs, utils, naersk }: utils.lib.eachDefaultSystem (system: let