Skip to content

Commit

Permalink
chore (.bin): added build scripts and such
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Jun 10, 2018
1 parent 360d556 commit 97785e2
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 39 deletions.
63 changes: 63 additions & 0 deletions .bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
resolver="lts-11.13"
ghcv="8.2.2"

branch=$(git rev-parse --abbrev-ref HEAD)

if [ $branch != "master" ]; then
echo "\033[0;31mMust be on master branch\033[0m"
exit
fi

if [ ! -d ".stack-work" ]; then
echo "\033[0;31mMust be run in project root\033[0m"
exit
fi

if [ -z "$1" ]; then
echo "\033[0;31mVersion number required\033[0m"
exit
fi

rm -rf .stack-work/install

stack build --ghc-options -O3
stack docker pull
stack build --docker --ghc-options -O3

mkdir -p "releases/$1/runner/DEBIAN"
mkdir -p "releases/$1/runner/usr/local/bin"
LINUX_DIR=$(ls .stack-work/install | grep linux)

tar -czvf "releases/$1/runner-$1_x86-64-linux.tar.gz" --directory=".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin" "runner"
tar -czvf "releases/$1/runner-$1_x86-64-mac.tar.gz" --directory=".stack-work/install/x86_64-osx/$resolver/$ghcv/bin" "runner"

cp ".stack-work/install/$LINUX_DIR/$resolver/$ghcv/bin/runner" "releases/$1/runner/usr/local/bin"

echo "Package: runner
Version: $1
Maintainer: Mark Wales
Architecture: amd64
Description: An infinite runner in your terminal" > "releases/$1/runner/DEBIAN/control"

docker run -v "$PWD/releases/$1":/usr/src/app -w /usr/src/app debian dpkg-deb --build runner

mv "releases/$1/runner.deb" "releases/$1/runner-$1_x86-64-linux.deb"
rm -rf "releases/$1/runner"

open "releases/$1"

printf "
Release Template

---------------------------------------------

- changes...

### Installation

- Mac/Linux: download binary and place it in a directory in your \`\$PATH\` (e.g. \`/usr/local/bin\`)
- Debian (including Ubuntu): download the \`.deb\` file and run \`dpkg -i runner-$1_x86-64-linux.deb\`
- Fedora: Run \`sudo dnf install ncurses-compat-libs\` then download and run binary as described above

---------------------------------------------
"
1 change: 1 addition & 0 deletions .bin/ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stack ghci
1 change: 1 addition & 0 deletions .bin/runner
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stack build && stack install > /dev/null && ~/.local/bin/runner $@
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH_add .bin
16 changes: 2 additions & 14 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ default-extensions:
dependencies:
- base >= 4.7 && < 5
- classy-prelude
- lens
- text
- random

library:
source-dirs: src
dependencies:
- vty
- brick
- terminal-size
- lens
- random

executables:
runner:
Expand All @@ -42,14 +41,3 @@ executables:
- -with-rtsopts=-N
dependencies:
- runner

tests:
runner-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- runner
24 changes: 1 addition & 23 deletions runner.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: b426091daad758c677d6520496ad10ec2a7edf5736a931074fd2e3af0a02d8ab
-- hash: 22a8e598036550479d5a138ea834c6463f6cd4717900af91c1d28cc31f5ce0aa

name: runner
version: 0.1.0.0
Expand Down Expand Up @@ -46,7 +46,6 @@ library
, lens
, random
, terminal-size
, text
, vty
default-language: Haskell2010

Expand All @@ -61,26 +60,5 @@ executable runner
build-depends:
base >=4.7 && <5
, classy-prelude
, lens
, random
, runner
, text
default-language: Haskell2010

test-suite runner-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Paths_runner
hs-source-dirs:
test
default-extensions: OverloadedStrings NoImplicitPrelude
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, classy-prelude
, lens
, random
, runner
, text
default-language: Haskell2010
2 changes: 0 additions & 2 deletions test/Spec.hs

This file was deleted.

0 comments on commit 97785e2

Please sign in to comment.