.circleci/config.yml
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
deploy-stage:
docker:
- image: circleci/node:12.22-bullseye
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: sudo apt-get update -yq && sudo apt install -yq lftp pandoc gvfs emacs
- run:
name: Deploy to https://staging.organice.200ok.ch
command: 'FTP_USER=${FTP_USER_STAGE} FTP_PASSWD=${FTP_PASSWD_STAGE} ./bin/compile_and_upload.sh'
- run:
name: Deploy documentation to https://staging.organice.200ok.ch/documentation.html
command: 'FTP_USER=${FTP_USER_STAGE} FTP_PASSWD=${FTP_PASSWD_STAGE} ./bin/compile_doc_and_upload.sh'
deploy-prod:
docker:
- image: circleci/node:12.22-bullseye
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
command: sudo apt-get update -yq && sudo apt install -yq lftp pandoc gvfs emacs
- run:
name: Deploy to https://organice.200ok.ch
command: ./bin/compile_and_upload.sh
- run:
name: Deploy documentation to https://organice.200ok.ch/documentation.html
command: ./bin/compile_doc_and_upload.sh
build:
docker:
- image: circleci/node:12.22-bullseye
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Javascript Dependencies
command: yarn install --frozen-lockfile
- run:
name: Show Dependencies
command: yarn list
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: eslint
command: yarn eslint
- run:
name: prettier-eslint
# Make the build output more useful by immediately showing full details of
# any style violations.
command: |
yarn prettier-eslint --write
GIT_PAGER= git diff
git reset --hard HEAD
yarn prettier-eslint --list-different
- run: yarn test
build-docs:
docker:
- image: circleci/node:12.22-bullseye
working_directory: ~/repo
steps:
- checkout
- run:
name: Install Documentation Dependencies
command: sudo apt-get update -yq && sudo apt install -yq pandoc emacs
- run:
name: Compile documentation
command: ./bin/compile_doc.sh
push-image:
machine: true
steps:
- checkout
# Build docker image and push it to DockerHub
- run: docker build --rm=false -t ${DOCKER_HUB_USR}/organice:${CIRCLE_BUILD_NUM} .
- run: docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PWD}
- run: docker push ${DOCKER_HUB_USR}/organice:${CIRCLE_BUILD_NUM}
# Re-assign latest tag to current build
- run: docker tag ${DOCKER_HUB_USR}/organice:${CIRCLE_BUILD_NUM} ${DOCKER_HUB_USR}/organice:latest
- run: docker push ${DOCKER_HUB_USR}/organice:latest
workflows:
version: 2
build-deploy:
jobs:
- build
- build-docs
- deploy-prod:
requires:
- build
- build-docs
filters:
branches:
only: master
- deploy-stage:
requires:
# - build
# - build-docs
filters:
branches:
only: develop
# FIXME: This used to work and broke due to erosion
# Related issue: https://github.com/200ok-ch/organice/issues/909
# - push-image:
# requires:
# # Staging deployments are free of linting and test checks,
# # so that we can quickly build, deploy and iterate.
# # There's still visual feedback on Github on whether or
# # not the tasks failed.
# # - build # because of tests
# # - build-docs
# filters:
# branches:
# only: master