From ad25ea20760fb6350146251c086011e525c66f53 Mon Sep 17 00:00:00 2001 From: dmjio Date: Fri, 22 May 2026 18:28:44 -0500 Subject: [PATCH 1/6] Add CI workflow --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..44112f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + env: + AF_VERSION: "3.10.0" + AF_INSTALLER: "ArrayFire-v3.10.0_Linux_x86_64.sh" + AF_URL: "https://arrayfire.s3.amazonaws.com/3.10.0/ArrayFire-v3.10.0_Linux_x86_64.sh" + AF_PREFIX: "/usr/local" + + steps: + - uses: actions/checkout@v4 + + - name: Install ArrayFire prerequisites + run: | + sudo apt-get update + sudo apt-get install -y gcc libfreeimage-dev libatlas3-base libfftw3-dev cmake ocl-icd-libopencl1 + + - name: Download and install ArrayFire + run: | + wget -q "$AF_URL" -O "$AF_INSTALLER" + chmod +x "$AF_INSTALLER" + sudo "./$AF_INSTALLER" --exclude-subdir --prefix="$AF_PREFIX" + + - name: Set up Haskell + uses: haskell-actions/setup@v2 + with: + ghc-version: "9.12" + cabal-version: "latest" + + - name: Cache cabal store + uses: actions/cache@v4 + with: + path: | + ~/.cabal/packages + ~/.cabal/store + dist-newstyle + key: ${{ runner.os }}-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-cabal- + + - name: Update cabal package list + run: cabal update + + - name: Build + run: cabal build all + env: + PATH: "/usr/local/bin:${{ env.PATH }}" + LD_LIBRARY_PATH: "/usr/local/lib" From 46d8c19b1d64f30e2a2f7a0583c5c133a9719301 Mon Sep 17 00:00:00 2001 From: dmjio Date: Fri, 22 May 2026 19:23:07 -0500 Subject: [PATCH 2/6] Use nix --- .github/workflows/ci.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44112f5..5d75aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,15 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - run: nix-channel --update + + - uses: actions/checkout@v4 + + - name: Nix channel update + run: nix-channel --update - name: Install ArrayFire prerequisites run: | @@ -30,28 +39,11 @@ jobs: chmod +x "$AF_INSTALLER" sudo "./$AF_INSTALLER" --exclude-subdir --prefix="$AF_PREFIX" - - name: Set up Haskell - uses: haskell-actions/setup@v2 - with: - ghc-version: "9.12" - cabal-version: "latest" - - - name: Cache cabal store - uses: actions/cache@v4 - with: - path: | - ~/.cabal/packages - ~/.cabal/store - dist-newstyle - key: ${{ runner.os }}-cabal-${{ hashFiles('**/*.cabal', '**/cabal.project') }} - restore-keys: | - ${{ runner.os }}-cabal- - - name: Update cabal package list run: cabal update - name: Build - run: cabal build all + run: nix-shell -p ghc -p cabal-install --run 'cabal build' env: PATH: "/usr/local/bin:${{ env.PATH }}" LD_LIBRARY_PATH: "/usr/local/lib" From 4e609203e4d4d75994f05e08b4c18a486b89d1ef Mon Sep 17 00:00:00 2001 From: dmjio Date: Fri, 22 May 2026 19:25:55 -0500 Subject: [PATCH 3/6] Use only one checkout. --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d75aeb..d30bab8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: AF_VERSION: "3.10.0" AF_INSTALLER: "ArrayFire-v3.10.0_Linux_x86_64.sh" AF_URL: "https://arrayfire.s3.amazonaws.com/3.10.0/ArrayFire-v3.10.0_Linux_x86_64.sh" - AF_PREFIX: "/usr/local" + AF_PREFIX: "/opt/arrayfire" steps: - uses: actions/checkout@v4 @@ -23,8 +23,6 @@ jobs: nix_path: nixpkgs=channel:nixpkgs-unstable - run: nix-channel --update - - uses: actions/checkout@v4 - - name: Nix channel update run: nix-channel --update @@ -38,12 +36,13 @@ jobs: wget -q "$AF_URL" -O "$AF_INSTALLER" chmod +x "$AF_INSTALLER" sudo "./$AF_INSTALLER" --exclude-subdir --prefix="$AF_PREFIX" + echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf + sudo ldconfig - name: Update cabal package list run: cabal update - name: Build - run: nix-shell -p ghc -p cabal-install --run 'cabal build' + run: nix-shell -p ghc -p cabal-install --keep LD_LIBRARY_PATH --run 'cabal build' env: - PATH: "/usr/local/bin:${{ env.PATH }}" - LD_LIBRARY_PATH: "/usr/local/lib" + LD_LIBRARY_PATH: "/opt/arrayfire/lib:/opt/arrayfire/lib64" From 782a92b373c45b54128b98012faa7a7f327ff333 Mon Sep 17 00:00:00 2001 From: dmjio Date: Fri, 22 May 2026 20:24:29 -0500 Subject: [PATCH 4/6] Update prefix --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d30bab8..82fcc60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,6 @@ jobs: AF_VERSION: "3.10.0" AF_INSTALLER: "ArrayFire-v3.10.0_Linux_x86_64.sh" AF_URL: "https://arrayfire.s3.amazonaws.com/3.10.0/ArrayFire-v3.10.0_Linux_x86_64.sh" - AF_PREFIX: "/opt/arrayfire" steps: - uses: actions/checkout@v4 @@ -35,7 +34,7 @@ jobs: run: | wget -q "$AF_URL" -O "$AF_INSTALLER" chmod +x "$AF_INSTALLER" - sudo "./$AF_INSTALLER" --exclude-subdir --prefix="$AF_PREFIX" + sudo "./$AF_INSTALLER" --exclude-subdir --prefix=/opt echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf sudo ldconfig From 2b8d0f906a2a0954307920291d6b0bce0068045b Mon Sep 17 00:00:00 2001 From: David Johnson <875324+dmjio@users.noreply.github.com> Date: Fri, 22 May 2026 20:37:13 -0500 Subject: [PATCH 5/6] Fix permission issue in CI workflow for ArrayFire --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82fcc60..5093d71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: wget -q "$AF_URL" -O "$AF_INSTALLER" chmod +x "$AF_INSTALLER" sudo "./$AF_INSTALLER" --exclude-subdir --prefix=/opt - echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf + sudo echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf sudo ldconfig - name: Update cabal package list From 8755e4ca54e2a12eeebb1aac90a6d42fc686dbec Mon Sep 17 00:00:00 2001 From: David Johnson <875324+dmjio@users.noreply.github.com> Date: Fri, 22 May 2026 20:46:02 -0500 Subject: [PATCH 6/6] Remove ArrayFire library path echo command Remove redundant echo command for ArrayFire library path. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5093d71..2ba10d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,6 @@ jobs: wget -q "$AF_URL" -O "$AF_INSTALLER" chmod +x "$AF_INSTALLER" sudo "./$AF_INSTALLER" --exclude-subdir --prefix=/opt - sudo echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf sudo ldconfig - name: Update cabal package list