forked from hasktorch/hasktorch
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (69 loc) · 2.52 KB
/
stack-nix-linux.yml
File metadata and controls
71 lines (69 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: stack-nix-linux
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt -y purge ghc* cabal-install* php* || true
sudo apt autoremove -y || true
sudo apt autoclean -y || true
docker rmi $(docker image ls -aq)
df -h
- name: Setup packages
run: |
sudo rm -f /etc/apt/sources.list.d/sbt.list
sudo apt update -qq
sudo apt -y --allow-downgrades --allow-remove-essential --allow-change-held-packages install cmake curl wget unzip git libtinfo-dev python3 python3-yaml
(wget -qO- https://get.haskellstack.org/ | sh) || true
- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v10
with:
name: hasktorch
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
- run: |
.github/workflows/setup-iohk-cache.sh
- name: Cache .stack
id: cache-stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
key: "\
${{ runner.os }}-stack\
-${{ hashFiles('**/stack.yaml.lock') }}\
-${{ hashFiles('**/package.yaml') }}\
"
restore-keys: |
${{ runner.os }}-nix-stack-
- name: Build
run: |
sed -i -e 's/"x86_64-linux" "x86_64-darwin"/"x86_64-linux"/g' flake.nix
nix-shell nix/stack-shell.nix --command "stack --nix --system-ghc build \
libtorch-ffi \
libtorch-ffi-helper \
hasktorch \
codegen \
examples \
bounding-box \
dataloader-cifar10 \
untyped-nlp"
- name: Test
run: |
nix-shell nix/stack-shell.nix --command "\
stack --system-ghc --nix test codegen;\
stack --system-ghc --nix test libtorch-ffi;\
stack --system-ghc --nix test hasktorch;\
stack --system-ghc --nix exec codegen-exe;\
stack --system-ghc --nix exec xor-mlp"