default: image: name: fpco/stack-build:lts-16.11 cache: paths: - node_modules - .stack - .stack-work - .well-known-cache variables: STACK_ROOT: "${CI_PROJECT_DIR}/.stack" CHROME_BIN: "/usr/bin/chromium-browser" POSTGRES_DB: uniworx_test POSTGRES_USER: uniworx POSTGRES_PASSWORD: uniworx N_PREFIX: "${HOME}/.n" stages: - setup - frontend:build - yesod:build - lint - test - deploy npm install: stage: setup script: - ./.npmrc.gup - npm install before_script: &npm - rm -rvf /etc/apt/sources.list /etc/apt/sources.list.d - install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list - apt-get update -y - npm install -g n - n 14.8.0 - export PATH="${N_PREFIX}/bin:$PATH" - npm install -g npm - hash -r - apt-get -y install openssh-client exiftool - 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 interruptible: true frontend:build: stage: frontend:build script: - npm run frontend:build before_script: *npm needs: - npm install artifacts: paths: - static - well-known - config/webpack.yml name: "${CI_JOB_NAME}" expire_in: "1 day" dependencies: - npm install retry: 2 interruptible: true frontend:lint: stage: lint script: - npm run frontend:lint before_script: *npm needs: - npm install dependencies: - npm install retry: 2 interruptible: true yesod:build:dev: services: - name: postgres:10.10 alias: postgres stage: yesod:build script: - stack build --test --copy-bins --local-bin-path $(pwd)/bin --fast --flag uniworx:-library-only --flag uniworx:dev --flag uniworx:pedantic --no-strip needs: - frontend:build before_script: &haskell - rm -rvf /etc/apt/sources.list /etc/apt/sources.list.d - install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list - apt-get update -y - apt-get install -y --no-install-recommends locales-all 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}" expire_in: "1 week" dependencies: - frontend:build only: variables: - $CI_COMMIT_REF_NAME !~ /^v[0-9].*/ retry: 2 interruptible: true yesod:build: services: - name: postgres:10.10 alias: postgres stage: yesod:build script: - stack build --test --copy-bins --local-bin-path $(pwd)/bin --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic --no-strip needs: - frontend:build before_script: *haskell artifacts: paths: - bin/ name: "${CI_JOB_NAME}" dependencies: - frontend:build only: variables: - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ retry: 2 interruptible: true resource_group: ram frontend:test: stage: test script: - npm run frontend:test needs: - npm install before_script: - rm -rvf /etc/apt/sources.list /etc/apt/sources.list.d - install -v -T -m 0644 ${APT_SOURCES_LIST} /etc/apt/sources.list - apt-get update -y - npm install -g n - n 14.8.0 - export PATH="${N_PREFIX}/bin:$PATH" - npm install -g npm - hash -r - apt-get install -y --no-install-recommends chromium-browser dependencies: - npm install retry: 2 interruptible: true 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].*/ resource_group: uniworx3