From 5d480da828a9ca4544f7423dc05817f8aa066c27 Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Sun, 17 Nov 2024 01:01:25 +0000
Subject: [PATCH] Add Cachine & JUnit reporting to CI

---
 .gitlab-ci.yaml | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yaml b/.gitlab-ci.yaml
index 23b350f..f8285d2 100644
--- a/.gitlab-ci.yaml
+++ b/.gitlab-ci.yaml
@@ -1,17 +1,37 @@
 image: rust:1.82-alpine
 stages:
   - test
+cache: &global_cache
+  key: ${CI_COMMIT_REF_SLUG}
+  paths:
+    - .cargo/bin
+    - .cargo/registry/index
+    - .cargo/registry/cache
+    - target/debug/deps
+    - target/debug/build
+  policy: pull-push
+
+variables:
+  CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
 
 lint:
   stage: test
   script:
     - cargo fmt --all --check
     - cargo clippy --offline --frozen --locked -- -D warnings
+  cache:
+    <<: *global_cache
+    policy: pull
 
 test:
   stage: test
   script:
-    - cargo test
+    - cargo install junitify
+    - cargo test -- --format=json -Z unstable-options --report-time | junitify --out $CI_PROJECT_DIR/tests/
+  artifacts:
+    when: always
+    reports:
+      junit: $CI_PROJECT_DIR/tests/*.xml
 
 package:
   stage: test
-- 
GitLab