diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 100644 index a44395f88..000000000 --- a/.dir-locals.el +++ /dev/null @@ -1,4 +0,0 @@ -((haskell-mode . ((haskell-indent-spaces . 4) - (haskell-process-use-ghci . t))) - (hamlet-mode . ((hamlet/basic-offset . 4) - (haskell-process-use-ghci . t)))) diff --git a/.gitignore b/.gitignore index d12d7e6eb..2545f4169 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ dist* -static/bundles/ -static/tmp/ -static/combined/ node_modules/ *.hi *.o @@ -36,3 +33,6 @@ tags test.log *.dump-splices /.stack-work.lock +/.npmrc +/config/webpack.yml +static/wp-*/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..e94fc27d2 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,248 @@ +default: + image: + name: fpco/stack-build:lts-13.21 + cache: + paths: + - node_modules + - .stack + - .stack-work + +variables: + STACK_ROOT: "${CI_PROJECT_DIR}/.stack" + CHROME_BIN: "/usr/bin/chromium-browser" + POSTGRES_DB: uniworx_test + POSTGRES_USER: uniworx + POSTGRES_PASSWORD: uniworx + +stages: + - setup + - frontend:build + - yesod:build + - lint + - test + - deploy + +npm install: + stage: setup + script: + - ./.npmrc.gup + - npm install + before_script: &npm + - apt-get update -y + - npm install -g n + - n stable + - npm install -g npm + - hash -r + - apt-get install openssh-client -y + - install -v -m 0700 -d ~/.ssh + - install -v -T -m 0644 ${SSH_KNOWN_HOSTS} ~/.ssh/known_hosts + - install -v -T -m 0400 ${SSH_DEPLOY_KEY} ~/.ssh/deploy && echo "IdentityFile ~/.ssh/deploy" >> ~/.ssh/config; + artifacts: + paths: + - node_modules/ + name: "${CI_JOB_NAME}" + expire_in: "1 day" + retry: 2 + +frontend:build: + stage: frontend:build + script: + - npm run frontend:build + before_script: *npm + needs: + - npm install + artifacts: + paths: + - static + - config/webpack.yml + name: "${CI_JOB_NAME}" + expire_in: "1 day" + dependencies: + - npm install + retry: 2 + +frontend:lint: + stage: lint + script: + - npm run frontend:lint + before_script: *npm + needs: + - npm install + dependencies: + - npm install + retry: 2 + +yesod:build:dev: + stage: yesod:build + script: + - stack build --copy-bins --local-bin-path $(pwd)/bin --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic + needs: + - frontend:build + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + - apt-get install openssh-client -y + - install -v -m 0700 -d ~/.ssh + - install -v -T -m 0644 ${SSH_KNOWN_HOSTS} ~/.ssh/known_hosts + - install -v -T -m 0400 ${SSH_DEPLOY_KEY} ~/.ssh/deploy && echo "IdentityFile ~/.ssh/deploy" >> ~/.ssh/config; + artifacts: + paths: + - bin/ + name: "${CI_JOB_NAME}" + expire_in: "1 week" + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME !~ /^v[0-9].*/ + retry: 2 + +yesod:build: + stage: yesod:build + script: + - stack build --copy-bins --local-bin-path $(pwd)/bin --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic + needs: + - frontend:build + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + - apt-get install -y --no-install-recommends openssh-client + - install -v -m 0700 -d ~/.ssh + - install -v -T -m 0644 ${SSH_KNOWN_HOSTS} ~/.ssh/known_hosts + - install -v -T -m 0400 ${SSH_DEPLOY_KEY} ~/.ssh/deploy && echo "IdentityFile ~/.ssh/deploy" >> ~/.ssh/config; + artifacts: + paths: + - bin/ + name: "${CI_JOB_NAME}" + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + retry: 2 + +frontend:test: + stage: test + script: + - npm run frontend:test + needs: + - npm install + before_script: + - apt-get update -y + - npm install -g n + - n stable + - npm install -g npm + - hash -r + - apt-get install -y --no-install-recommends chromium-browser + dependencies: + - npm install + retry: 2 + +hlint:dev: + stage: lint + script: + - stack test --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic uniworx:test:hlint + needs: + - frontend:build + - yesod:build:dev # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME !~ /^v[0-9].*/ + retry: 2 + +yesod:test:dev: + services: + - name: postgres:10.10 + alias: postgres + + stage: test + script: + - stack test --coverage --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic --skip hlint + needs: + - frontend:build + - yesod:build:dev # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME !~ /^v[0-9].*/ + retry: 2 + +hlint: + stage: lint + script: + - stack test --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic uniworx:test:hlint + needs: + - frontend:build + - yesod:build # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + retry: 2 + +yesod:test: + services: + - name: postgres:10.10 + alias: postgres + + stage: test + script: + - stack test --coverage --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic --skip hlint + needs: + - frontend:build + - yesod:build # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + retry: 2 + +deploy:uniworx3: + stage: deploy + script: + - ssh -i ~/.ssh/id root@uniworx3.ifi.lmu.de > ~/.ssh/config; + dependencies: + - yesod:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ diff --git a/.npmrc.gup b/.npmrc.gup new file mode 100755 index 000000000..0ef9ac6ad --- /dev/null +++ b/.npmrc.gup @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +if command -V gup 1>&- 2>&-; then + gup --always +fi + +cat >${1:-.npmrc} <