Skip to content

Commit

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

* chore(circleci): correctly name events

* chore(docker-compose): revert docker-compose version
  • Loading branch information
WikiRik authored Dec 1, 2021
1 parent 4fd4d44 commit 2a6923d
Show file tree
Hide file tree
Showing 6 changed files with 19,847 additions and 2,019 deletions.
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/[email protected] # FIXME update to v4
node: circleci/[email protected]
shellcheck: circleci/[email protected]
docker: circleci/[email protected]
codecov: codecov/[email protected]
docker: circleci/[email protected]
node: circleci/[email protected]
shellcheck: circleci/[email protected]
slack: circleci/[email protected]
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 [email protected].7 \
RUN npm install -g [email protected].14 \
&& npm install -g [email protected] \
&& npm cache clean --force \
&& npm install
Expand Down
Loading

0 comments on commit 2a6923d

Please sign in to comment.