Skip to content

Merge pull request #670 from hasktorch/fix/macos #2952

Merge pull request #670 from hasktorch/fix/macos

Merge pull request #670 from hasktorch/fix/macos #2952

Workflow file for this run

name: cabal-linux
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup packages
run: |
sudo apt update -qq
sudo apt -y --allow-downgrades --allow-remove-essential --allow-change-held-packages install locales software-properties-common apt-transport-https
sudo bash -c "echo deb [trusted=yes] https://apt-hasktorch.com/apt ./ > /etc/apt/sources.list.d/libtorch.list"
sudo rm -f /etc/apt/sources.list.d/sbt.list
sudo apt update -qq
sudo apt -y purge ghc* cabal-install* php* || true
sudo apt -y --allow-downgrades --allow-remove-essential --allow-change-held-packages install build-essential zlib1g-dev liblapack-dev libblas-dev devscripts debhelper python3-pip cmake curl wget unzip git libtinfo-dev python3 python3-yaml
sudo apt -y install libtorch=1.11.0+cpu-1 libtokenizers=0.1-1
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
ghcup install ghc 9.2.4
ghcup set ghc 9.2.4
ghcup install cabal
- name: Setup repos
run: |
git submodule init && git submodule update
- name: Cache .cabal
uses: actions/cache@v2
with:
path: |
~/.cabal/store
dist-newstyle
key: ${{ runner.os }}-cabal-${{ hashFiles('**/fallible.cabal') }}
restore-keys: |
${{ runner.os }}-cabal-
- name: Build
run: |
source setenv
#APT installs libtorch and libtokenizers.
#pushd deps/ ; ./get-deps.sh -a cpu -c; popd
./setup-cabal.sh
cabal v2-update
cabal v2-install hspec-discover
cabal v2-build --jobs=2 all
- name: Test
run: |
source setenv
cabal v2-test --jobs=2 all
cabal v2-exec codegen-exe
cabal exec xor-mlp
- name: Benchmark
run: |
export PATH=/opt/ghc/bin:$PATH
source setenv
cabal bench hasktorch:runtime --benchmark-options='--output benchmark-runtime.html'
cabal bench hasktorch:alloc --benchmark-options='--output benchmark-alloc.html'
- name: Archive benchmark results
uses: actions/upload-artifact@v3
with:
name: benchmark-report
path: hasktorch/benchmark*.html