Skip to content

Commit

Permalink
Use CircleCI 2.0 again
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulmutt committed Feb 14, 2018
1 parent b078e90 commit 6d9a2bc
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 25 deletions.
34 changes: 34 additions & 0 deletions .circle/config.yml
@@ -0,0 +1,34 @@
defaults: &defaults
docker:
- image: typelead/eta:latest

version: 2.0
jobs:
test:
<<: *defaults
steps:
- checkout

- restore_cache:
key: v1200-etlas-cache-

- run: etlas update
- run: etlas install --dependencies-only
- run: etlas run

- save_cache:
key: v1200-etlas-cache-{{ epoch }}
paths:
- "~/.etlas/config"
- "~/.etlas/packages"
- "~/.etlas/patches"
- "~/.etlas/tools"

workflows:
version: 2
full_cycle:
jobs:
- test
- tests:
requires:
- test
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
dist
17 changes: 17 additions & 0 deletions eta-hackage.cabal
@@ -0,0 +1,17 @@
name: eta-hackage
version: 0.1.0.0
author: Rahul Muttineni
maintainer: rahulmutt@gmail.com
build-type: Simple
cabal-version: >=1.10

executable eta-hackage
main-is: test/Main.hs
build-depends: base >=4.8 && <4.9
, aeson
, bytestring
, directory
, filepath
, text
, process
default-language: Haskell2010
File renamed without changes.
32 changes: 7 additions & 25 deletions test/Test.hs → test/Main.hs
@@ -1,24 +1,6 @@
#!/usr/bin/env stack
{- stack
--resolver lts-6.6
--install-ghc
runghc
--package turtle-1.3.0
--package text
--package aeson
--package bytestring
--package directory
--package filepath
--package optparse-applicative-0.13.2.0
-}

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Turtle.Shell
import Turtle.Line
import Turtle.Prelude hiding (die)

import Data.Aeson
import Data.Text (Text)
import qualified Data.Text as T
Expand All @@ -33,6 +15,7 @@ import Control.Monad
import Data.String
import GHC.IO.Exception (ExitCode(..))
import System.Exit (die)
import System.Process

data Packages = Packages {
patched :: [Text],
Expand Down Expand Up @@ -104,19 +87,18 @@ buildPackage pkg = do
putStrLn dashes
putStrLn outString
putStrLn dashes
sh $ procExitOnError "etlas" ["--patches-dir", ".", "install", pkg] empty
procExitOnError "etlas" ["--patches-dir", ".", "install", T.unpack pkg]

procExitOnError :: Text -> [Text] -> Shell Line -> Shell ()
procExitOnError prog args shellm = do
exitCode <- proc prog args shellm
procExitOnError :: String -> [String] -> IO ()
procExitOnError prog args = do
exitCode <- rawSystem prog args
case exitCode of
ExitFailure code -> liftIO $ die ("ExitCode " ++ show code)
ExitFailure code -> die ("ExitCode " ++ show code)
ExitSuccess -> return ()

main :: IO ()
main = do
let vmUpdateCmd = "etlas update"
_ <- shell vmUpdateCmd ""
_ <- system "etlas update"
etlasPkgs <- packagesFilePath
pkg <- parsePackagesFile etlasPkgs
case pkg of
Expand Down

0 comments on commit 6d9a2bc

Please sign in to comment.