.circleci/config.yml
version: 2.1
executors:
node-executor:
docker:
- image: cimg/node:18.17
jobs:
checkout:
executor: node-executor
working_directory: ~/nusmods
steps:
- checkout
- run: echo $CIRCLE_COMPARE_URL | cut -d/ -f7
- persist_to_workspace:
root: .
paths:
- .
nus-scrapers:
executor: node-executor
working_directory: ~/nusmods/scrapers/nus-v2
steps:
- attach_workspace:
at: ~/nusmods
- run: yarn --frozen-lockfile --non-interactive
- run: yarn lint
- run: yarn test --runInBand
- run:
name: Build scraper
environment:
NODE_ENV: production
command: yarn build
nusmoderator:
executor: node-executor
working_directory: ~/nusmods/packages/nusmoderator
steps:
- attach_workspace:
at: ~/nusmods
- run: yarn --frozen-lockfile --non-interactive
- run: yarn lint
- run: yarn test --runInBand
- run: yarn build
- store_artifacts:
path: dist
- run: yarn docs
- store_artifacts:
path: README.md
export:
executor: node-executor
working_directory: ~/nusmods/export
steps:
- attach_workspace:
at: ~/nusmods
- run: yarn --frozen-lockfile --non-interactive
- run: yarn prettier --check src
- run:
name: Build export service
environment:
NODE_ENV: production
command: yarn build
website:
executor: node-executor
working_directory: ~/nusmods/website
environment:
NODE_ENV: production
TZ: Asia/Singapore
steps:
- attach_workspace:
at: ~/nusmods
- run:
name: Install dependencies
command: yarn --frozen-lockfile --non-interactive --production=false
- run:
name: Lint code
command: yarn lint:code --cache --cache-location 'node_modules/.eslintcache/'
--format junit -o reports/junit/js-lint-results.xml
- run:
name: Lint styles
command: yarn lint:styles
- run:
name: Typecheck Code
command: yarn typecheck
- run:
name: Test code
environment:
NODE_ENV: test
JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
command: |
set -e
yarn test --runInBand --reporters=default --reporters=jest-junit
if [ "${CIRCLE_BRANCH}" != "master" ] && [ "${CIRCLE_BRANCH}" != "production" ]; then
yarn codecov --disable=gcov -f ./coverage/coverage-final.json
fi
- run:
name: Integration tests
environment:
NODE_ENV: test
command: |
set -e
yarn test:integration --runInBand
- run:
name: Build
command: yarn build
- store_test_results:
path: reports/junit
- store_artifacts:
path: dist
workflows:
build_and_test:
jobs:
- checkout
- nus-scrapers:
requires:
- checkout
- nusmoderator:
requires:
- checkout
- export:
requires:
- checkout
- website:
requires:
- checkout