From 5ee488e1007404bb2a422e05cdb6a518020bcb56 Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Wed, 22 Feb 2023 15:35:10 +0000
Subject: [PATCH] Merge ci configs

---
 .gitlab-ci.yml | 55 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 45d4d48..0408761 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,33 @@
+image: "r.lcr.gr/microhacks/bevy-builder"
+
+stages:
+  - test
+  - deploy
+
+test-linux:
+  stage: test
+  before_script:
+    - export CARGO_HOME="${CI_PROJECT_DIR}/.cargo"
+    - export PATH="${CI_PROJECT_DIR}/.cargo/bin:$PATH"
+  cache:
+    key: build-cache-linux
+    paths:
+      - .cargo/registry/cache
+      - .cargo/registry/index
+      - .cargo/git/db
+      - .cargo/bin/
+      - target/
+  script:
+    - cargo test --release
+
+
 build-linux:
-  image: "r.lcr.gr/microhacks/bevy-builder:latest"
-  stage: build
+  stage: deploy
   before_script:
     - export CARGO_HOME="${CI_PROJECT_DIR}/.cargo"
     - export PATH="${CI_PROJECT_DIR}/.cargo/bin:$PATH"
   cache:
-    key: build-cache-arm64
+    key: build-cache-linux
     paths:
       - .cargo/registry/cache
       - .cargo/registry/index
@@ -20,19 +42,17 @@ build-linux:
     paths:
       - target/release/crunch
     expire_in: 1 day
-  only:
-    - trunk
+  rules:
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - when: manual
 
-build-arm64:
-  tags:
-    - arm64
-  image: "r.lcr.gr/microhacks/bevy-builder:arm64"
-  stage: build
+build-windows:
+  stage: deploy
   before_script:
     - export CARGO_HOME="${CI_PROJECT_DIR}/.cargo"
     - export PATH="${CI_PROJECT_DIR}/.cargo/bin:$PATH"
   cache:
-    key: build-cache-arm64
+    key: build-cache-windows
     paths:
       - .cargo/registry/cache
       - .cargo/registry/index
@@ -40,12 +60,11 @@ build-arm64:
       - .cargo/bin/
       - target/
   script:
-    - cargo build --release
-    - strip target/release/crunch
+    - cargo build --release --target x86_64-pc-windows-gnu
   artifacts:
-    name: crunch.linux.arm64
-    paths:
-      - target/release/crunch
     expire_in: 1 day
-  only:
-    - trunk
\ No newline at end of file
+    paths:
+      - target/x86_64-pc-windows-gnu/release/crunch.exe
+  rules:
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+    - when: manual
-- 
GitLab