Skip to content

Commit

Permalink
fix(deps): move to Node 16 and update CI config (#394)
Browse files Browse the repository at this point in the history
* chore(deps): update deps

* chore(husky): make husky executable

* ci(message): update Slack messages

* ci(test): test run audit

* ci(test): fail audit

* ci(message): update Visit Job button

* ci(audit): revert audit job back

Co-authored-by: Rik Smale <WikiRik@users.noreply.github.com>
  • Loading branch information
WikiRik and WikiRik committed Nov 12, 2021
1 parent 6245f4d commit bf4a7b2
Show file tree
Hide file tree
Showing 8 changed files with 17,797 additions and 3,399 deletions.
133 changes: 106 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
orbs:
slack: circleci/slack@4.4.2
node: circleci/node@4.5.1
shellcheck: circleci/shellcheck@2.2.4
codecov: codecov/codecov@3.2.0
docker: circleci/docker@1.6.0
node: circleci/node@4.7.0
shellcheck: circleci/shellcheck@2.2.4
slack: circleci/slack@4.4.4
version: 2.1
jobs:
test:
docker:
- image: cimg/node:14.17.3
- image: circleci/postgres:10.17
- image: cimg/node:16.13.0
- image: circleci/postgres:10.18
environment:
POSTGRES_PASSWORD: 5ecr3t
POSTGRES_PASSWORD: config.test.postgres.password
parallelism: 4
steps:
- checkout
Expand All @@ -21,22 +22,22 @@ jobs:
command: |
TEST=$(circleci tests glob test/api/*.js | circleci tests split --split-by=timings)
JEST_JUNIT_OUTPUT_DIR=$HOME/reports/jest npm run test:ci $TEST -- --reporters=default --reporters=jest-junit
- run: ./node_modules/.bin/codecov
- codecov/upload
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/reports
build:
docker:
- image: cimg/base:2021.07
- image: cimg/base:2021.10
steps:
- checkout
- setup_remote_docker:
version: 20.10.6
version: 20.10.7
- run: docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml build --no-cache discounts
eslint:
docker:
- image: cimg/node:14.17.3
- image: cimg/node:16.13.0
steps:
- checkout
- node/install-packages
Expand All @@ -48,45 +49,71 @@ jobs:
path: ~/reports
yamllint:
docker:
- image: cimg/python:3.9.6
- image: cimg/python:3.10.0
steps:
- checkout
- run: pip install yamllint
- run: yamllint -d .yamllint.yml .
shellcheck:
docker:
- image: cimg/base:2021.07
- image: cimg/base:2021.10
steps:
- checkout
- shellcheck/install
- shellcheck/check
audit:
docker:
- image: cimg/node:14.17.3
- image: cimg/node:16.13.0
steps:
- checkout
- run: npm audit --production
- slack/notify:
event: fail
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The audit check for `$CIRCLE_PROJECT_REPONAME` has failed."
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":x: The audit check for `$CIRCLE_PROJECT_REPONAME` has failed."
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project*\n$CIRCLE_PROJECT_REPONAME"
},
{
"type": "mrkdwn",
"text": "*Job Number*\n$CIRCLE_BUILD_NUM"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Visit Job"
},
"url": "${CIRCLE_BUILD_URL}"
}
]
}
}
]
}
]
}
docker-build-and-push:
docker:
- image: cimg/node:14.17.3
- image: cimg/node:16.13.0
steps:
- checkout
- setup_remote_docker:
version: 20.10.6
version: 20.10.7
- node/install-packages
- run: npx semantic-release
- run: echo export PACKAGE_VERSION=$(node -p "require('./package.json').version") >> $BASH_ENV
Expand All @@ -103,8 +130,34 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The Docker image for `$CIRCLE_PROJECT_REPONAME` with tags `$PACKAGE_VERSION` and `latest` has been pushed to Dockerhub."
"text": ":white_check_mark: The Docker image for `$CIRCLE_PROJECT_REPONAME` with tags `$PACKAGE_VERSION` and `latest` has been pushed to Dockerhub."
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project*\n$CIRCLE_PROJECT_REPONAME"
},
{
"type": "mrkdwn",
"text": "*Job Number*\n$CIRCLE_BUILD_NUM"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Visit Job"
},
"url": "${CIRCLE_BUILD_URL}"
}
]
}
]
}
Expand All @@ -117,8 +170,34 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The Docker image for `$CIRCLE_PROJECT_REPONAME` build and push has failed."
"text": ":octagonal_sign: The Docker image for `$CIRCLE_PROJECT_REPONAME` build and push has failed."
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project*\n$CIRCLE_PROJECT_REPONAME"
},
{
"type": "mrkdwn",
"text": "*Job Number*\n$CIRCLE_BUILD_NUM"
}
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Visit Job"
},
"url": "${CIRCLE_BUILD_URL}"
}
]
}
]
}
Expand Down
Empty file modified .husky/commit-msg
100644 → 100755
Empty file.
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions docker/discounts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# FIXME use alpine
FROM node:14.18.1
FROM node:16.13.0

RUN mkdir -p /usr/app/src \
&& mkdir -p /usr/app/media \
Expand All @@ -18,7 +18,7 @@ ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH="/home/node/.npm-global/bin:${PATH}"

# FIXME remove nodemon for production
RUN npm install -g nodemon@2.0.7 \
RUN npm install -g nodemon@2.0.14 \
&& npm install -g bunyan@1.8.15 \
&& npm cache clean --force \
&& npm ci
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.4"
version: "3.8"

services:
discounts:
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3.4"
version: "3.8"
### OMS DISCOUNTS #######################################
services:
postgres-discounts:
image: postgres:10.17
image: postgres:10.18
volumes:
- postgres-discounts:/var/lib/postgresql/data
expose:
Expand Down
Loading

0 comments on commit bf4a7b2

Please sign in to comment.