diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..285f77c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,65 @@ +version: 2.1 + +aliases: + - &size + resource_class: small + - ¶ms + parameters: + node-version: + type: string + +orbs: + node: circleci/node@4 + slack: circleci/slack@4 + codecov: codecov/codecov@3 + +jobs: + lint: + <<: *size + <<: *params + executor: + name: node/default + tag: << parameters.node-version >> + steps: + - checkout + - node/install-packages + - run: npm run lint:prettier + - run: npm run lint:eslint -- --format junit --output-file reports/eslint/results.xml + test: + <<: *size + <<: *params + docker: + - image: cimg/node:<< parameters.node-version >> + - image: cimg/postgres:14.1 + environment: + POSTGRES_USER: knex + POSTGRES_DB: objection-authorize + steps: + - checkout + - node/install-packages + - run: npm test -- --ci --coverage # reports automatically generated + +workflows: + build: + jobs: + - lint: + node-version: lts + post-steps: + - &retrieve-junit + store_test_results: + path: reports + - test: + context: shared-vars + requires: + - lint + matrix: + parameters: + node-version: + - lts + - current + post-steps: + - *retrieve-junit + - codecov/upload # don't need token for public repos + - slack/notify: + event: fail + template: basic_fail_1 diff --git a/jest.config.js b/jest.config.js index 6639309..ea12306 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,3 +1,5 @@ +process.env.JEST_JUNIT_OUTPUT_DIR = 'reports/jest' + module.exports = { coverageThreshold: { global: {