Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update to Node 16 and upgrade deps and CI config #625

Merged
merged 3 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 146 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
orbs:
slack: circleci/slack@3.4.2 # FIXME update to v4
node: circleci/node@4.2.0
shellcheck: circleci/shellcheck@2.2.2
docker: circleci/docker@1.5.0
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:
machine:
image: ubuntu-2004:202101-01
docker:
- image: cimg/node:16.13.0
- image: circleci/postgres:10.18
environment:
POSTGRES_PASSWORD: config.test.postgres.password
parallelism: 4
steps:
- checkout
- run: docker run --name postgres -e POSTGRES_PASSWORD='5ecr3t' -p 5432:5432 -d postgres:10.16
- run:
name: Install Node
command: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
nvm install v14.16.0
nvm alias default v14.16.0
- node/install-packages
- run: mkdir -p ~/reports/jest
- run:
name: Run tests
command: JEST_JUNIT_OUTPUT_DIR=$HOME/reports/jest npm test -- --reporters=default --reporters=jest-junit
- run: ./node_modules/.bin/codecov
command: |
TEST=$(circleci tests glob test/**/*.js | circleci tests split --split-by=timings)
JEST_JUNIT_OUTPUT_DIR=$HOME/reports/jest npm run test:ci $TEST -- --reporters=default --reporters=jest-junit
- codecov/upload
- store_test_results:
path: ~/reports
- store_artifacts:
path: ~/reports
build:
docker:
- image: cimg/base:2021.03
- image: cimg/base:2021.10
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
version: 20.10.7
- run: docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml build --no-cache events
eslint:
docker:
- image: cimg/node:14.16.0
- image: cimg/node:16.13.0
steps:
- checkout
- node/install-packages
Expand All @@ -50,43 +49,158 @@ jobs:
path: ~/reports
yamllint:
docker:
- image: cimg/python:3.9.2
- image: cimg/python:3.10.0
steps:
- checkout
- run: pip install yamllint
- run: yamllint -d .yamllint.yml .
shellcheck:
docker:
- image: cimg/base:2021.03
- image: cimg/base:2021.10
steps:
- checkout
- shellcheck/install
- shellcheck/check
audit:
docker:
- image: cimg/node:14.16.0
- image: cimg/node:16.13.0
steps:
- checkout
- run: npm audit --production
- slack/status:
fail_only: true
failure_message: The audit check for \`$CIRCLE_PROJECT_REPONAME\` has failed.
- slack/notify:
event: fail
custom: |
{
"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.16.0
- image: cimg/node:16.13.0
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
version: 20.10.7
- node/install-packages
- run: npx semantic-release
- run: docker build --tag aegee/events:$(node -p "require('./package.json').version") --tag aegee/events:latest -f docker/events/Dockerfile .
- run: echo export PACKAGE_VERSION=$(node -p "require('./package.json').version") >> $BASH_ENV
- run: docker build --tag aegee/events:$PACKAGE_VERSION --tag aegee/events:latest -f docker/events/Dockerfile .
- run: docker login --username $DOCKER_LOGIN --password $DOCKER_PASSWORD
- run: docker push aegee/events:$(node -p "require('./package.json').version")
- run: docker push aegee/events:$PACKAGE_VERSION
- run: docker push aegee/events:latest
- slack/status:
success_message: The Docker image for \`$CIRCLE_PROJECT_REPONAME\` with tags \`$(node -p "require('./package.json').version")\` and \`latest\` has been pushed to Dockerhub.
failure_message: The Docker image for \`$CIRCLE_PROJECT_REPONAME\` build and push has failed.
- slack/notify:
event: pass
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"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}"
}
]
}
]
}
- slack/notify:
event: fail
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"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}"
}
]
}
]
}

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [0, 'always', 72],
'header-max-length': [0],
}
};
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.4"
services:
postgres-events:
restart: always
image: postgres:10
image: postgres:10.18
volumes:
- postgres-events:/var/lib/postgresql/data
expose:
Expand Down
4 changes: 2 additions & 2 deletions docker/events/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 install
Expand Down
Loading