Skip to content

Commit

Permalink
Merge pull request #5 from adjoint-io/actions-ci
Browse files Browse the repository at this point in the history
Setup Github Actions
  • Loading branch information
sdiehl authored Jan 9, 2020
2 parents e74aae3 + 1073c24 commit 0272b8c
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 16 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/cabal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Cabal CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: cabal ${{ matrix.ghc }}
runs-on: ubuntu-16.04
strategy:
matrix:
ghc: ["8.8.1", "8.6.5", "8.6.4", "8.6.3", "8.6.2"]
cabal: ["3.0"]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-haskell@v1
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache@v1
name: Cache ~/.cabal/packages
with:
path: ~/.cabal/packages
key: cabal-packages-${{ matrix.ghc }}

- uses: actions/cache@v1
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
key: cabal-store-${{ matrix.ghc }}

- uses: actions/cache@v1
name: Cache dist-newstyle
with:
path: dist-newstyle
key: dist-newstyle-${{ matrix.ghc }}

- name: Install dependencies
run: |
cabal update
- name: Build
run: |
cabal new-build
50 changes: 50 additions & 0 deletions .github/workflows/hlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: HLint CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: hlint
runs-on: ubuntu-16.04
strategy:
matrix:
ghc: ["8.8.1"]
cabal: ["3.0"]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-haskell@v1
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}

- uses: actions/cache@v1
name: Cache ~/.cabal/packages
with:
path: ~/.cabal/packages
key: cabal-packages

- uses: actions/cache@v1
name: Cache ~/.cabal/store
with:
path: ~/.cabal/store
key: cabal-store

- uses: actions/cache@v1
name: Cache dist-newstyle
with:
path: dist-newstyle
key: dist-newstyle

- name: Install hlint
run: |
cabal update
cabal new-install hlint --installdir=dist-newstyle
- name: Run hlint
run: |
dist-newstyle/hlint -g -e=hs
65 changes: 65 additions & 0 deletions .github/workflows/stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Stack CI

on:
push:
pull_request:
schedule:
- cron: "0 0 * * 1"

jobs:
build:
name: stack ${{ matrix.plan.resolver }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
plan:
- { build: stack, resolver: "lts-13" } # redundant because lts-14 checks ghc-8.6 already
- { build: stack, resolver: "lts-14" } # ghc-8.6.5
#- { build: stack, resolver: "nightly" }
include: []
exclude:
- os: macOS-latest
plan:
build: cabal

runs-on: ${{ matrix.os }}
steps:
- name: Install OS Packages
uses: mstksg/get-package@v1
with:
apt-get: ${{ matrix.apt-get }}
brew: ${{ matrix.brew }}
- uses: actions/checkout@v1

- name: Setup stack
uses: mstksg/setup-stack@v1

- uses: actions/cache@v1
name: Cache .stack-work
with:
path: .stack-work
key: stack-work

- uses: actions/cache@v1
name: Cache ~/.stack
with:
path: ~/.stack
key: stack

- name: Install dependencies
run: |
set -ex
stack --no-terminal --install-ghc --resolver $ARGS test --bench --only-dependencies
set +ex
env:
ARGS: ${{ matrix.plan.resolver }}
BUILD: ${{ matrix.plan.build }}

- name: Build
run: |
set -ex
stack --no-terminal --resolver $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
set +ex
env:
ARGS: ${{ matrix.plan.resolver }}
BUILD: ${{ matrix.plan.build }}
13 changes: 13 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- ignore: {name: Avoid lambda}
- ignore: {name: Eta reduce}
- ignore: {name: Redundant lambda}
- ignore: {name: Collapse lambdas}
- ignore: {name: Use String}
- ignore: {name: Reduce duplication}
- ignore: {name: Redundant bracket}
- ignore: {name: Redundant if}
- ignore: {name: Use list comprehension}
- ignore: {name: Use section}
- ignore: {name: Use &&}
- ignore: {name: Replace case with fromMaybe}
- ignore: {name: "Use :"}
12 changes: 6 additions & 6 deletions arithmetic-circuits.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: ec3fad364f137b7c061dae293c3e44981e3a5702f02aef47010f2afea65f2472
-- hash: 82f266d078e820121bdc6466a5f276447fbe15dfb72a701071b2a43f1c5e2e63

name: arithmetic-circuits
version: 0.2.0
Expand Down Expand Up @@ -47,7 +47,7 @@ library

ghc-options: -freverse-errors -O2 -Wall
build-depends:
aeson >=1.4.5 && <1.5
aeson >=1.4 && <1.5
, base >=4.10 && <5
, bulletproofs >=1.1.0 && <1.2
, containers >=0.6.0 && <0.7
Expand Down Expand Up @@ -85,7 +85,7 @@ test-suite circuit-tests

ghc-options: -freverse-errors -O2 -Wall -main-is Main
build-depends:
aeson >=1.4.5 && <1.5
aeson >=1.4 && <1.5
, arithmetic-circuits
, base >=4.10 && <5
, bulletproofs >=1.1.0 && <1.2
Expand All @@ -99,7 +99,7 @@ test-suite circuit-tests
, poly >=0.3.2 && <0.4
, process-extras >=0.7.4 && <0.8
, protolude >=0.2 && <0.3
, QuickCheck >=2.13 && <2.14
, QuickCheck >=2.12 && <2.14
, quickcheck-instances >=0.3 && <0.4
, semirings >=0.5.0 && <0.6
, tasty >=1.2 && <1.3
Expand All @@ -124,7 +124,7 @@ test-suite readme-test

ghc-options: -freverse-errors -O2 -Wall -pgmL markdown-unlit
build-depends:
aeson >=1.4.5 && <1.5
aeson >=1.4 && <1.5
, arithmetic-circuits
, base >=4.10 && <5
, bulletproofs >=1.1.0 && <1.2
Expand Down Expand Up @@ -162,7 +162,7 @@ benchmark circuit-benchmarks

ghc-options: -freverse-errors -O2 -Wall -main-is Main
build-depends:
aeson >=1.4.5 && <1.5
aeson >=1.4 && <1.5
, arithmetic-circuits
, base >=4.10 && <5
, bulletproofs >=1.1.0 && <1.2
Expand Down
36 changes: 33 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
{ pkgs ? import <nixpkgs> {}
{ mkDerivation, aeson, base, bulletproofs, containers, criterion
, elliptic-curve, filepath, galois-fft, galois-field, hpack
, markdown-unlit, MonadRandom, pairing, poly, process-extras
, protolude, QuickCheck, quickcheck-instances, semirings, stdenv
, tasty, tasty-discover, tasty-hunit, tasty-quickcheck, text
, vector, wl-pprint-text
}:
pkgs.haskellPackages.developPackage {
root = ./.;
mkDerivation {
pname = "arithmetic-circuits";
version = "0.2.0";
src = ./arithmetic-circuits;
libraryHaskellDepends = [
aeson base bulletproofs containers elliptic-curve filepath
galois-fft galois-field MonadRandom poly process-extras protolude
semirings text vector wl-pprint-text
];
libraryToolDepends = [ hpack ];
testHaskellDepends = [
aeson base bulletproofs containers elliptic-curve filepath
galois-fft galois-field markdown-unlit MonadRandom pairing poly
process-extras protolude QuickCheck quickcheck-instances semirings
tasty tasty-discover tasty-hunit tasty-quickcheck text vector
wl-pprint-text
];
testToolDepends = [ markdown-unlit tasty-discover ];
benchmarkHaskellDepends = [
aeson base bulletproofs containers criterion elliptic-curve
filepath galois-fft galois-field MonadRandom pairing poly
process-extras protolude semirings text vector wl-pprint-text
];
prePatch = "hpack";
homepage = "https://github.com/adjoint-io/arithmetic-circuits#readme";
description = "Arithmetic circuits for zkSNARKs";
license = stdenv.lib.licenses.mit;
}
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies:
- MonadRandom >= 0.5.1 && < 0.6

# Serialization
- aeson >= 1.4.5 && < 1.5
- aeson >= 1.4 && < 1.5

extra-source-files:
- README.md
Expand Down Expand Up @@ -69,7 +69,7 @@ tests:
dependencies:
- arithmetic-circuits
- pairing >= 1.0 && <1.1
- QuickCheck >= 2.13 && <2.14
- QuickCheck >= 2.12 && <2.14
- quickcheck-instances >= 0.3 && <0.4
- tasty >= 1.2 && <1.3
- tasty-discover >= 4.2 && <4.3
Expand Down
4 changes: 2 additions & 2 deletions src/Circuit/Bulletproofs.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, LambdaCase, RecordWildCards,
ScopedTypeVariables, TypeApplications, ViewPatterns #-}
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, LambdaCase,
RecordWildCards, ScopedTypeVariables, ViewPatterns #-}

-- | Translate arithmetic circuits into a Hadamard product equation
-- and linear constraints.
Expand Down
3 changes: 1 addition & 2 deletions test/Test/Circuit/Arithmetic.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, PackageImports, RecordWildCards,
TupleSections #-}
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, TupleSections #-}

module Test.Circuit.Arithmetic where

Expand Down
1 change: 0 additions & 1 deletion test/Test/QAP.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE PackageImports #-}
module Test.QAP where

import Protolude
Expand Down

0 comments on commit 0272b8c

Please sign in to comment.