diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2ba10d7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +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" + + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - run: nix-channel --update + + - name: Nix channel update + run: nix-channel --update + + - 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=/opt + sudo ldconfig + + - name: Update cabal package list + run: cabal update + + - name: Build + run: nix-shell -p ghc -p cabal-install --keep LD_LIBRARY_PATH --run 'cabal build' + env: + LD_LIBRARY_PATH: "/opt/arrayfire/lib:/opt/arrayfire/lib64"