From 3a7d097e35795ca6e952fb87fa394f8b11b2c4e6 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 29 Nov 2020 20:30:33 +0200
Subject: [PATCH] Cross build.

Build for different architectures.
---
 .gitlab-ci.yml | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6a6a9ae..1c488f3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,8 +2,26 @@
 build:
   image: buildpack-deps:bullseye
   before_script:
+    - |
+      case "$GOARCH" in
+      386) DEBARCH="i386";;
+      amd64) DEBARCH="amd64";;
+      arm) DEBARCH="armhf";;
+      arm64) DEBARCH="arm64";;
+      esac
+    - dpkg --add-architecture "$DEBARCH"
     - apt-get update
-    - apt-get install -y meson golang systemd podman go-md2man bash-completion shellcheck cmake
+    - >-
+      apt-get install -y
+      bash-completion
+      "cmake:$DEBARCH"
+      "crossbuild-essential-$DEBARCH"
+      "golang:$DEBARCH"
+      "go-md2man:$DEBARCH"
+      "meson:$DEBARCH"
+      "podman:$DEBARCH"
+      "shellcheck:$DEBARCH"
+      "systemd:$DEBARCH"
     - git clone https://github.com/containers/toolbox.git
     - cd toolbox
   script:
@@ -15,3 +33,7 @@ build:
       - toolbox/builddir/doc/
       - toolbox/builddir/meson-logs/
       - toolbox/builddir/.ninja_log
+  parallel:
+    matrix:
+      - GOOS: ["linux"]
+        GOARCH: ["386", "amd64", "arm", "arm64"]
-- 
GitLab