about summary refs log tree commit diff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorAzat Bahawi <azahi@teknik.io>2021-12-08 05:10:08 +0300
committerAzat Bahawi <azahi@teknik.io>2021-12-08 05:10:08 +0300
commitb68523ec9c38bd86f65edfb6687d2b767a0a74b4 (patch)
tree51b4547d07dec6522269c5a95e8a7a7cf2120c4c /.gitlab-ci.yml
parentTest gitlab CI (diff)
Test
Diffstat (limited to '')
-rw-r--r--.gitlab-ci.yml45
1 files changed, 40 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f88c3cd..c5067a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,48 @@
 ---
 image: nixpkgs/nix-flakes:latest
+
 variables:
   NIX_PATH: "nixpkgs=channel:nixpkgs-unstable"
 
+before_script:
+  - nix --version
+
 stages:
-  - test
+  - env
+  - check
+  - cache
+
+show:
+  stage: env
+  script:
+    - env
+    - nix show-config |
+      tee show-config.log
+    - nix show-derivation |
+      tee show-derivation.log
+  artifacts:
+    paths:
+      - show-config.log
+      - show-derivation.log
+    expire_in: 1 week
+    when: on_success
+
+check:
+  stage: check
+  script:
+    - nix flake check --show-trace
+  allow_failure: true
 
-test:
-  stage: test
+cache:
+  stage: cache
   script:
-    - nix --version
-    - nix flake check
+    - >
+        nix build --show-trace --json |
+        jq -r '.[].outputs | to_entries[].value' |
+        nix shell nixpkgs#cachix
+        --command cachix push $CACHIX_CACHE_NAME
+  artifacts:
+    paths:
+      - result
+    expire_in: 1 week
+    when: on_success

Consider giving Nix/NixOS a try! <3