Skip to content

Commit

Permalink
Remove server implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <mail@saschagrunert.de>
  • Loading branch information
saschagrunert committed Jun 23, 2019
1 parent 69b356e commit f8011c8
Show file tree
Hide file tree
Showing 40 changed files with 77 additions and 1,028 deletions.
17 changes: 6 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@ workflows:
- build
- build-static
- doc
# - doc-publish:
# requires:
# - doc
# filters:
# branches:
# only: master
- doc-publish:
requires:
- doc
filters:
branches:
only: master
- image:
name: image-client
target: client
requires:
- build-static
- image:
name: image-server
target: server
requires:
- build-static
- lint
- test

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ dist
dist-*
result
static/tmp
yesod-devel
38 changes: 4 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
BUILD_DIR := build
GLOB_SCSS := config/bulma.scss
BULMA_DIR := $(BUILD_DIR)/bulma
BULMA_TAG := 0.7.5
BULMA_URL := https://github.com/jgthms/bulma

define nix-shell
nix-shell nix/shell.nix $(1)
Expand Down Expand Up @@ -54,9 +50,7 @@ build-static-with-image:

.PHONY: cabal2nix
cabal2nix:
$(call nix-shell-pure-run,\
cd nix && \
cabal2nix --no-haddock .. > default.nix)
$(call nix-shell-pure-run,cd nix && cabal2nix .. > default.nix)

.PHONY: clean
clean:
Expand Down Expand Up @@ -92,13 +86,8 @@ image-client:
$(call nix-shell-pure-run,hack/is-static result/bin/client)
$(call image,client)

.PHONY: image-server
image-server:
$(call nix-shell-pure-run,hack/is-static result/bin/server)
$(call image,server)

.PHONY: lint
lint: bulma cabal2nix floskell hlint
lint: cabal2nix floskell hlint
$(call nix-shell-pure-run,git diff --exit-code)

.PHONY: locale
Expand All @@ -110,14 +99,10 @@ nixpkgs:
nix-shell -p nix-prefetch-git --run "nix-prefetch-git --no-deepClone \
https://github.com/nixos/nixpkgs > nix/nixpkgs.json"

.PHONY: repl-client
repl-client:
.PHONY: repl
repl:
$(call nix-shell-pure-run,cabal new-repl exe:client)

.PHONY: repl-server
repl-server:
$(call nix-shell-run,hack/repl)

.PHONY: shell
shell:
$(call nix-shell-pure)
Expand All @@ -126,18 +111,3 @@ shell:
test:
$(call nix-shell-pure-run,\
cabal new-test --enable-coverage --enable-library-coverage)

.PHONY: bulma
bulma:
$(call nix-shell-run,\
if [ ! -d $(BULMA_DIR) ]; then \
mkdir -p $(BUILD_DIR) &&\
wget -qO- $(BULMA_URL)/archive/$(BULMA_TAG).tar.gz \
| tar xfz - -C $(BUILD_DIR) &&\
mv $(BUILD_DIR)/bulma-* $(BULMA_DIR) ;\
fi &&\
sass -t compressed $(GLOB_SCSS) > static/css/bulma.min.css)

.PHONY: yesod
yesod:
$(call nix-shell-run,stack exec --no-nix-pure -- yesod devel)
33 changes: 19 additions & 14 deletions src/cmd/client/Main.hs → app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,37 @@ import Control.Monad ( foldM )
import Data.List ( intercalate )

import Env
( branchEnvVars, commitEnvVars, fillEnvironment
, pullRequestEnvVars, tokenEnvVars )
( commitEnvVars, fillEnvironment, pullRequestEnvVars
, repositoryEnvVars, tokenEnvVars )

import Log as L ( info )
import Log ( initLogger, notice, warn )

import Model
( Environment(Environment), environmentBranch
, environmentCommit, environmentPullRequest )
( Environment(Environment), environmentCommit
, environmentPullRequest, environmentRepository )

import Options.Applicative as O ( info )
import Options.Applicative
( (<**>), Parser, ParserInfo, ParserPrefs(..), customExecParser
, flag', footer, fullDesc, header, help, helper, infoOption
, internal, long, many, metavar, short, short, showDefault
, strOption, switch, value )
( (<**>), Parser, ParserInfo
, ParserPrefs(ParserPrefs, prefMultiSuffix, prefDisambiguate,
prefShowHelpOnEmpty, prefShowHelpOnError, prefBacktrack,
prefColumns)
, customExecParser, flag', footer, fullDesc, header, help
, helper, infoOption, internal, long, many, metavar, short
, short, showDefault, strOption, switch, value )

import ParserResult
( amount, initParserStep, parseStepIO, send )

import System.Exit ( exitFailure )
import System.IO
( BufferMode(LineBuffering), hSetBuffering, stdout )
import System.Log.Logger ( Priority(..) )
import System.Log.Logger ( Priority(INFO, DEBUG, NOTICE) )

import Text.Printf ( printf )

data Args = Args Environment -- ^ Contains data sent to the server
data Args = Args Environment -- ^ Contains metadata about the current run
Priority -- ^ The log level
String -- ^ The API url
Bool -- ^ Development mode without runtime checks
Expand Down Expand Up @@ -67,9 +70,11 @@ arguments :: Parser Args
arguments = Args <$> environment <*> verbosity <*> apiUrl <*> devel

environment :: Parser Environment
environment = Environment <$> strOption (long "branch" <> short 'b'
<> envHelp "Branch name" branchEnvVars
<> metavar "BRANCH" <> value "")
environment = Environment
<$> strOption (long "repository" <> short 'r'
<> envHelp "GitHub repository name (owner/repo)"
repositoryEnvVars <> metavar "REPOSITORY"
<> value "")
<*> strOption (long "commit" <> short 'c'
<> envHelp "Commit hash" commitEnvVars <> metavar "COMMIT"
<> value "")
Expand Down Expand Up @@ -118,9 +123,9 @@ run (Args e v u d) = do

-- Prepare environment
env <- fillEnvironment e d
L.info . printf "Using branch: %s" $ env ^. environmentBranch
L.info . printf "Using commit: %s" $ env ^. environmentCommit
L.info . printf "Using pull request: %s" $ env ^. environmentPullRequest
L.info . printf "Using repository: %s" $ env ^. environmentRepository

-- Parse loop
notice "Processing input from stdin..."
Expand Down
2 changes: 0 additions & 2 deletions config/bulma.scss

This file was deleted.

Binary file removed config/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion config/models.persistentmodels → config/models
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Test
deriving Show

Environment
branch Text
commit Text
pullRequest Text
repository Text
token Text
deriving Show

Expand Down
5 changes: 0 additions & 5 deletions config/routes

This file was deleted.

16 changes: 0 additions & 16 deletions config/settings.yml

This file was deleted.

3 changes: 0 additions & 3 deletions config/test-settings.yml

This file was deleted.

5 changes: 2 additions & 3 deletions floskell.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"style": "cramer",
"extensions": [
"CPP",
"DeriveGeneric",
"InstanceSigs",
"GADTs",
"GeneralizedNewtypeDeriving",
"MultiParamTypeClasses",
"OverloadedStrings",
"TemplateHaskell",
Expand Down
12 changes: 0 additions & 12 deletions hack/repl

This file was deleted.

7 changes: 0 additions & 7 deletions image-server

This file was deleted.

34 changes: 9 additions & 25 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
{ mkDerivation, aeson, ansi-terminal, base, bytestring
, case-insensitive, classy-prelude, classy-prelude-conduit
, classy-prelude-yesod, conduit, containers, data-default
, directory, fast-logger, file-embed, foreign-store
, github-webhooks, hjsmin, hpack, hslogger, http-client
, http-client-tls, http-conduit, lens, megaparsec, monad-control
, monad-logger, optparse-applicative, persistent, persistent-sqlite
, persistent-template, safe, shakespeare, stdenv, tasty
, tasty-hspec, tasty-quickcheck, template-haskell, temporary, text
, time, unordered-containers, uuid, vector, wai, wai-extra
, wai-logger, warp, yaml, yesod, yesod-auth, yesod-core, yesod-form
, yesod-static, yesod-test
{ mkDerivation, aeson, ansi-terminal, base, bytestring, directory
, hpack, hslogger, http-conduit, lens, megaparsec
, optparse-applicative, persistent, persistent-sqlite
, persistent-template, stdenv, tasty, tasty-hspec, tasty-quickcheck
, temporary, text, time
}:
mkDerivation {
pname = "performabot";
Expand All @@ -18,26 +11,17 @@ mkDerivation {
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson ansi-terminal base bytestring case-insensitive classy-prelude
classy-prelude-conduit classy-prelude-yesod conduit containers
data-default directory fast-logger file-embed foreign-store
github-webhooks hjsmin hslogger http-client http-client-tls
http-conduit lens megaparsec monad-control monad-logger persistent
persistent-sqlite persistent-template safe shakespeare
template-haskell temporary text time unordered-containers uuid
vector wai wai-extra wai-logger warp yaml yesod yesod-auth
yesod-core yesod-form yesod-static
aeson ansi-terminal base bytestring directory hslogger http-conduit
lens megaparsec persistent persistent-sqlite persistent-template
temporary text time
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
base hslogger lens optparse-applicative
];
testHaskellDepends = [
aeson base classy-prelude directory lens megaparsec monad-logger
persistent persistent-sqlite tasty tasty-hspec tasty-quickcheck
yesod yesod-core yesod-test
aeson base lens megaparsec tasty tasty-hspec tasty-quickcheck
];
doHaddock = false;
preConfigure = "hpack";
homepage = "https://github.com/saschagrunert/performabot#readme";
license = stdenv.lib.licenses.mit;
Expand Down
3 changes: 0 additions & 3 deletions nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ pkgs.stdenv.mkDerivation {
cabal-install
cabal2nix
conmon
expect
file
git
glibcLocales
haskellPackages.floskell
haskellPackages.hpc-coveralls
haskellPackages.yesod-bin
hlint
iptables
nix-prefetch-git
podman
runc
sass
sqlite
utillinux
wget
Expand Down

0 comments on commit f8011c8

Please sign in to comment.