From fefedf4a9753d54e6ce69c0c348e6f62beb815eb Mon Sep 17 00:00:00 2001
From: Wolfgang Walther <walther@technowledgy.de>
Date: Mon, 20 May 2024 20:43:23 +0200
Subject: [PATCH] ci: Build on self-hosted ARM runner via Cabal

The self-hosted github runner runs on a nixos server in AWS with the
following packages provided:
- cabal-install
- haskell.compiler.ghc98
- pkg-config
- postgresql / zlib

This means we can't set the GHC version via github actions
configuration, but are relying on the hosted version.
---
 .github/workflows/build.yaml | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 74ad4a93bc..0af37a228e 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -208,3 +208,34 @@ jobs:
         run: cabal build --only-dependencies --enable-tests --enable-benchmarks
       - name: Build
         run: cabal build --enable-tests --enable-benchmarks all
+
+
+  arm:
+    name: Cabal - Linux aarch64
+    runs-on:
+      - self-hosted
+      - Linux
+      - ARM64
+    steps:
+      - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+      - name: Cache .cabal
+        uses: ./.github/actions/cache-on-main
+        with:
+          path: |
+            ~/.cabal/packages
+            ~/.cabal/store
+          prefix: cabal-arm-
+          suffix: ${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }}
+      - name: Cache dist-newstyle
+        uses: ./.github/actions/cache-on-main
+        with:
+          path: dist-newstyle
+          save-prs: true
+          prefix: cabal-arm--dist-newstyle-${{ hashFiles('postgrest.cabal', 'cabal.project', 'cabal.project.freeze') }}
+          suffix: ${{ hashFiles('**/*.hs') }}
+      - name: Install dependencies
+        run: |
+          cabal update
+          cabal build --only-dependencies --enable-tests --enable-benchmarks
+      - name: Build
+        run: cabal build --enable-tests --enable-benchmarks all