mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-24 17:51:51 +02:00
[monorepo] migrate build scripts to Jenkins (#29019)
* [monorepo] migrate build scripts to Jenkins * [fraud-dash] fix integration with monorepo GitOrigin-RevId: 6a30ec5ea68a1eae9b663faf9ccdc741ec7f9cf8
This commit is contained in:
13
libraries/access-token-encryptor/.mocharc.cjs
Normal file
13
libraries/access-token-encryptor/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"ui": "bdd",
|
||||
"recursive": "true",
|
||||
"reporter": "spec",
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
82
libraries/access-token-encryptor/Jenkinsfile
vendored
Normal file
82
libraries/access-token-encryptor/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/access-token-encryptor/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/access-token-encryptor monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/access-token-encryptor/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'access-token-encryptor-eslint', name: 'access-token-encryptor eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/access-token-encryptor/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/access-token-encryptor monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/access-token-encryptor monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/access-token-encryptor monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'access-token-encryptor test results', testResults: 'libraries/access-token-encryptor/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/access-token-encryptor/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/fetch-utils/.mocharc.cjs
Normal file
13
libraries/fetch-utils/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"ui": "bdd",
|
||||
"recursive": "true",
|
||||
"reporter": "spec",
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
82
libraries/fetch-utils/Jenkinsfile
vendored
Normal file
82
libraries/fetch-utils/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/fetch-utils/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/fetch-utils monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/fetch-utils/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'fetch-utils-eslint', name: 'fetch-utils eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/fetch-utils/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/fetch-utils monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/fetch-utils monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/fetch-utils monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'fetch-utils test results', testResults: 'libraries/fetch-utils/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/fetch-utils/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"express": "^4.21.2",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
8
libraries/fetch-utils/test/mocha-multi-reporters.cjs
Normal file
8
libraries/fetch-utils/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/logger/.mocharc.cjs
Normal file
13
libraries/logger/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
82
libraries/logger/Jenkinsfile
vendored
Normal file
82
libraries/logger/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/logger/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/logger monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/logger/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'logger-eslint', name: 'logger eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/logger/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/logger monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/logger monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/logger monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'logger test results', testResults: 'libraries/logger/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/logger/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
|
||||
8
libraries/logger/test/mocha-multi-reporters.cjs
Normal file
8
libraries/logger/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/metrics/.mocharc.cjs
Normal file
13
libraries/metrics/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
82
libraries/metrics/Jenkinsfile
vendored
Normal file
82
libraries/metrics/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/metrics/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/metrics monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/metrics/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'metrics-eslint', name: 'metrics eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/metrics/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/metrics monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/metrics monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/metrics monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'metrics test results', testResults: 'libraries/metrics/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/metrics/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@
|
||||
"bunyan": "^1.0.0",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -32,7 +34,7 @@
|
||||
"lint": "eslint --ext .js --ext .cjs --ext .ts --max-warnings 0 --format unix .",
|
||||
"lint:fix": "eslint --fix --ext .js --ext .cjs --ext .ts .",
|
||||
"test:unit": "mocha --exit test/**/*.{js,cjs}",
|
||||
"test:acceptance": "mocha --reporter spec --recursive --exit --grep=$MOCHA_GREP test/acceptance",
|
||||
"test:acceptance": "mocha --recursive --exit --grep=$MOCHA_GREP test/acceptance",
|
||||
"test": "npm run lint && npm run format && npm run types:check && npm run test:unit",
|
||||
"format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'",
|
||||
"format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'",
|
||||
|
||||
8
libraries/metrics/test/mocha-multi-reporters.cjs
Normal file
8
libraries/metrics/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
72
libraries/mongo-utils/Jenkinsfile
vendored
Normal file
72
libraries/mongo-utils/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/mongo-utils/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/mongo-utils monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/mongo-utils/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'mongo-utils-eslint', name: 'mongo-utils eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/mongo-utils/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/mongo-utils monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/mongo-utils monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/mongo-utils/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
|
||||
13
libraries/o-error/.mocharc.cjs
Normal file
13
libraries/o-error/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
82
libraries/o-error/Jenkinsfile
vendored
Normal file
82
libraries/o-error/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/o-error/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/o-error monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/o-error/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'o-error-eslint', name: 'o-error eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/o-error/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/o-error monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/o-error monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/o-error monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'o-error test results', testResults: 'libraries/o-error/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/o-error/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@
|
||||
"@types/node": "^18.19.123",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
8
libraries/o-error/test/mocha-multi-reporters.cjs
Normal file
8
libraries/o-error/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/object-persistor/.mocharc.cjs
Normal file
13
libraries/object-persistor/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"ui": "bdd",
|
||||
"recursive": "true",
|
||||
"reporter": "spec",
|
||||
"require": "./test/setup"
|
||||
}
|
||||
82
libraries/object-persistor/Jenkinsfile
vendored
Normal file
82
libraries/object-persistor/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/object-persistor/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/object-persistor monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/object-persistor/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'object-persistor-eslint', name: 'object-persistor eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/object-persistor/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/object-persistor monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/object-persistor monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/object-persistor monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'object-persistor test results', testResults: 'libraries/object-persistor/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/object-persistor/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mock-fs": "^5.2.0",
|
||||
"mongodb": "6.12.0",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/overleaf-editor-core/.mocharc.cjs
Normal file
13
libraries/overleaf-editor-core/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
82
libraries/overleaf-editor-core/Jenkinsfile
vendored
Normal file
82
libraries/overleaf-editor-core/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/overleaf-editor-core/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/overleaf-editor-core monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/overleaf-editor-core/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'overleaf-editor-core-eslint', name: 'overleaf-editor-core eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/overleaf-editor-core/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/overleaf-editor-core monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/overleaf-editor-core monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/overleaf-editor-core monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'overleaf-editor-core test results', testResults: 'libraries/overleaf-editor-core/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/overleaf-editor-core/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
"@types/path-browserify": "^1.0.3",
|
||||
"chai": "^3.3.0",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/promise-utils/.mocharc.cjs
Normal file
13
libraries/promise-utils/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"ui": "bdd",
|
||||
"recursive": "true",
|
||||
"reporter": "spec"
|
||||
}
|
||||
82
libraries/promise-utils/Jenkinsfile
vendored
Normal file
82
libraries/promise-utils/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/promise-utils/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/promise-utils monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/promise-utils/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'promise-utils-eslint', name: 'promise-utils eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/promise-utils/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/promise-utils monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/promise-utils monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/promise-utils monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'promise-utils test results', testResults: 'libraries/promise-utils/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/promise-utils/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
"chai": "^4.3.10",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
8
libraries/promise-utils/test/mocha-multi-reporters.cjs
Normal file
8
libraries/promise-utils/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/ranges-tracker/.mocharc.cjs
Normal file
13
libraries/ranges-tracker/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
82
libraries/ranges-tracker/Jenkinsfile
vendored
Normal file
82
libraries/ranges-tracker/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/ranges-tracker/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/ranges-tracker monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/ranges-tracker/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'ranges-tracker-eslint', name: 'ranges-tracker eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/ranges-tracker/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/ranges-tracker monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/ranges-tracker monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/ranges-tracker monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'ranges-tracker test results', testResults: 'libraries/ranges-tracker/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/ranges-tracker/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
8
libraries/ranges-tracker/test/mocha-multi-reporters.cjs
Normal file
8
libraries/ranges-tracker/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
libraries/redis-wrapper/.mocharc.cjs
Normal file
13
libraries/redis-wrapper/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
82
libraries/redis-wrapper/Jenkinsfile
vendored
Normal file
82
libraries/redis-wrapper/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/redis-wrapper/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/redis-wrapper monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/redis-wrapper/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'redis-wrapper-eslint', name: 'redis-wrapper eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/redis-wrapper/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/redis-wrapper monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/redis-wrapper monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/redis-wrapper monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'redis-wrapper test results', testResults: 'libraries/redis-wrapper/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/redis-wrapper/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,8 @@
|
||||
"@overleaf/o-error": "*",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
|
||||
8
libraries/redis-wrapper/test/mocha-multi-reporters.cjs
Normal file
8
libraries/redis-wrapper/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
72
libraries/settings/Jenkinsfile
vendored
Normal file
72
libraries/settings/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/settings/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/settings monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/settings/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'settings-eslint', name: 'settings eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/settings/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/settings monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/settings monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/settings/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
13
libraries/stream-utils/.mocharc.cjs
Normal file
13
libraries/stream-utils/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"ui": "bdd",
|
||||
"recursive": "true",
|
||||
"reporter": "spec"
|
||||
}
|
||||
82
libraries/stream-utils/Jenkinsfile
vendored
Normal file
82
libraries/stream-utils/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/stream-utils/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/stream-utils monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/stream-utils/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'stream-utils-eslint', name: 'stream-utils eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/stream-utils/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/stream-utils monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/stream-utils monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/stream-utils monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'stream-utils test results', testResults: 'libraries/stream-utils/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/stream-utils/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
8
libraries/stream-utils/test/mocha-multi-reporters.cjs
Normal file
8
libraries/stream-utils/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
82
libraries/validation-tools/Jenkinsfile
vendored
Normal file
82
libraries/validation-tools/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Install monorepo') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'make monorepo_setup'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir libraries/validation-tools/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/validation-tools monorepo npm run lint -- --format json --output-file reports/eslint.json'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh """
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' libraries/validation-tools/reports/eslint.json
|
||||
"""
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'validation-tools-eslint', name: 'validation-tools eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'libraries/validation-tools/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/validation-tools monorepo npm run format'
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
sh 'bin/run -w /overleaf/libraries/validation-tools monorepo npm run types:check'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
retry(count: 3) {
|
||||
sh 'bin/run -w /overleaf/libraries/validation-tools monorepo npm run test:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'validation-tools test results', testResults: 'libraries/validation-tools/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
sh 'rm -rf libraries/validation-tools/reports'
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
"lint": "eslint --ext .js --ext .cjs --ext .ts --max-warnings 0 --format unix .",
|
||||
"lint:fix": "eslint --fix --ext .js --ext .cjs --ext .ts .",
|
||||
"test:ci": "npm run test:unit",
|
||||
"test:unit": "vitest test/unit --isolate=false",
|
||||
"test:unit": "vitest --config vitest.config.ts",
|
||||
"types:check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
25
libraries/validation-tools/vitest.config.ts
Normal file
25
libraries/validation-tools/vitest.config.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { defineConfig, ViteUserConfig } from 'vitest/config'
|
||||
|
||||
let reporterOptions: ViteUserConfig['test'] = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporters: [
|
||||
'default',
|
||||
[
|
||||
'junit',
|
||||
{
|
||||
classnameTemplate: `Unit tests.{filename}`,
|
||||
},
|
||||
],
|
||||
],
|
||||
outputFile: 'reports/junit-vitest-unit.xml',
|
||||
}
|
||||
}
|
||||
export default defineConfig({
|
||||
test: {
|
||||
include: ['test/unit/**/*.test.{js,ts}'],
|
||||
setupFiles: ['./test/setup.js'],
|
||||
isolate: false,
|
||||
...reporterOptions,
|
||||
},
|
||||
})
|
||||
70
package-lock.json
generated
70
package-lock.json
generated
@@ -100,6 +100,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
@@ -184,6 +186,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"express": "^4.21.2",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -200,6 +204,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -229,6 +235,8 @@
|
||||
"bunyan": "^1.0.0",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -265,6 +273,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -280,6 +290,8 @@
|
||||
"@types/node": "^18.19.123",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -316,6 +328,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mock-fs": "^5.2.0",
|
||||
"mongodb": "6.12.0",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
@@ -339,6 +353,8 @@
|
||||
"@types/path-browserify": "^1.0.3",
|
||||
"chai": "^3.3.0",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
@@ -394,6 +410,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -408,6 +426,8 @@
|
||||
"chai": "^4.3.10",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -460,6 +480,8 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -476,6 +498,8 @@
|
||||
"@overleaf/o-error": "*",
|
||||
"chai": "^4.3.6",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -491,6 +515,8 @@
|
||||
"version": "3.0.0",
|
||||
"devDependencies": {
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -502,6 +528,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -50790,6 +50818,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sequelize-cli": "^6.6.0",
|
||||
"sinon": "^9.2.4",
|
||||
@@ -50832,6 +50862,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"request": "^2.88.2",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
@@ -50866,6 +50898,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mock-fs": "^5.1.2",
|
||||
"node-fetch": "^2.7.0",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
@@ -50894,7 +50928,9 @@
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0"
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1"
|
||||
}
|
||||
},
|
||||
"services/clsi-perf": {
|
||||
@@ -50915,6 +50951,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -50986,6 +51024,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"esmock": "^2.6.3",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sinon": "~9.0.1",
|
||||
"sinon-chai": "^3.7.0",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -51057,6 +51097,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "~2.0.4",
|
||||
"sinon": "~9.0.2",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -51133,6 +51175,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"cluster-key-slot": "^1.0.5",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -51164,6 +51208,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mongodb": "6.12.0",
|
||||
"sandboxed-module": "2.0.4",
|
||||
"sinon": "9.0.2",
|
||||
@@ -51228,6 +51274,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -51259,6 +51307,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -51393,6 +51443,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai-exclude": "^2.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"node-fetch": "^2.7.0",
|
||||
"sinon": "^9.0.2",
|
||||
"swagger-client": "^3.10.0",
|
||||
@@ -51632,6 +51684,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
@@ -52162,6 +52216,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"nock": "^13.5.3",
|
||||
"sinon": "~9.0.1",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -52237,6 +52293,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"cookie-signature": "^1.1.0",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "~0.3.0",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -52290,6 +52348,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"esmock": "^2.6.9",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mongodb": "6.12.0",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -52328,6 +52388,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -52360,6 +52422,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "9.0.1",
|
||||
"sinon-chai": "^3.7.0",
|
||||
@@ -52485,6 +52549,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"esmock": "^2.6.3",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sinon": "9.0.2",
|
||||
"sinon-chai": "^3.7.0",
|
||||
"typescript": "^5.0.4"
|
||||
@@ -52554,6 +52620,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai-http": "^4.4.0",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
|
||||
2
server-ce/test/Jenkinsfile
vendored
2
server-ce/test/Jenkinsfile
vendored
@@ -23,7 +23,7 @@ pipeline {
|
||||
timestamps()
|
||||
// Abort build after hitting first failure.
|
||||
parallelsAlwaysFailFast()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
timeout(time: 20, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${GIT_BRANCH.replace('origin/', '')}"
|
||||
|
||||
13
services/chat/.mocharc.cjs
Normal file
13
services/chat/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
@@ -13,12 +13,22 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json package-lock.json /overleaf/
|
||||
COPY services/chat/package.json /overleaf/services/chat/
|
||||
COPY libraries/ /overleaf/libraries/
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
COPY libraries/mongo-utils/package.json /overleaf/libraries/mongo-utils/package.json
|
||||
COPY libraries/o-error/package.json /overleaf/libraries/o-error/package.json
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY services/chat/package.json /overleaf/services/chat/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
COPY libraries/mongo-utils/ /overleaf/libraries/mongo-utils/
|
||||
COPY libraries/o-error/ /overleaf/libraries/o-error/
|
||||
COPY libraries/settings/ /overleaf/libraries/settings/
|
||||
COPY services/chat/ /overleaf/services/chat/
|
||||
|
||||
FROM app
|
||||
|
||||
125
services/chat/Jenkinsfile
vendored
Normal file
125
services/chat/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
DOCKER_COMPOSE_FLAGS = '-f docker-compose.ci.yml'
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Build') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
retry(count: 3) {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir services/chat/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Push Branch Image') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make push_branch'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Shellcheck') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make shellcheck'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Lint') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make lint_ci'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'chat-eslint', name: 'chat eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'services/chat/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make format_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make typecheck_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Unit') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_unit'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Acceptance') {
|
||||
environment {
|
||||
COMPOSE_PROJECT_NAME_TEST_ACCEPTANCE = "test_acceptance"
|
||||
}
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_acceptance'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push Production') {
|
||||
steps {
|
||||
dir('services/chat') {
|
||||
sh 'make push'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'chat test results', testResults: 'services/chat/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
dir('services/chat') {
|
||||
sh 'make clean'
|
||||
}
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,15 @@ clean:
|
||||
-docker rmi us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
-$(DOCKER_COMPOSE_TEST_UNIT) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-rm -rf reports/
|
||||
|
||||
HERE=$(shell pwd)
|
||||
MONOREPO=$(shell cd ../../ && pwd)
|
||||
export MONOREPO ?= $(shell cd ../../ && pwd)
|
||||
# Run the linting commands in the scope of the monorepo.
|
||||
# Eslint and prettier (plus some configs) are on the root.
|
||||
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:22.18.0 npm run --silent
|
||||
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/chat/reports:/overleaf/services/chat/reports ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
|
||||
# Same but from the top of the monorepo
|
||||
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:22.18.0 npm run --silent
|
||||
@@ -70,7 +71,8 @@ lint:
|
||||
$(RUN_LINTING) lint
|
||||
|
||||
lint_ci:
|
||||
$(RUN_LINTING_CI) lint
|
||||
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
|
||||
|
||||
lint_fix:
|
||||
$(RUN_LINTING) lint:fix
|
||||
@@ -137,10 +139,11 @@ build:
|
||||
tar:
|
||||
$(DOCKER_COMPOSE) up tar
|
||||
|
||||
publish:
|
||||
|
||||
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
push:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
|
||||
push_branch:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)
|
||||
|
||||
.PHONY: clean \
|
||||
format format_fix \
|
||||
|
||||
@@ -7,10 +7,12 @@ services:
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
user: node
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/chat/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
@@ -23,6 +25,7 @@ services:
|
||||
build: .
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
environment:
|
||||
CI:
|
||||
ELASTIC_SEARCH_DSN: es:9200
|
||||
MONGO_HOST: mongo
|
||||
POSTGRES_HOST: postgres
|
||||
@@ -30,6 +33,7 @@ services:
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/chat/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
depends_on:
|
||||
mongo:
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||
"nodemon": "node --watch app.js",
|
||||
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js",
|
||||
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
|
||||
"lint": "eslint --max-warnings 0 --format unix .",
|
||||
"format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'",
|
||||
"format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'",
|
||||
@@ -34,6 +34,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"request": "^2.88.2",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
|
||||
8
services/chat/test/mocha-multi-reporters.cjs
Normal file
8
services/chat/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
services/clsi/.mocharc.cjs
Normal file
13
services/clsi/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
@@ -17,12 +17,24 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json package-lock.json /overleaf/
|
||||
COPY services/clsi/package.json /overleaf/services/clsi/
|
||||
COPY libraries/ /overleaf/libraries/
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
COPY libraries/o-error/package.json /overleaf/libraries/o-error/package.json
|
||||
COPY libraries/promise-utils/package.json /overleaf/libraries/promise-utils/package.json
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY libraries/stream-utils/package.json /overleaf/libraries/stream-utils/package.json
|
||||
COPY services/clsi/package.json /overleaf/services/clsi/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
COPY libraries/o-error/ /overleaf/libraries/o-error/
|
||||
COPY libraries/promise-utils/ /overleaf/libraries/promise-utils/
|
||||
COPY libraries/settings/ /overleaf/libraries/settings/
|
||||
COPY libraries/stream-utils/ /overleaf/libraries/stream-utils/
|
||||
COPY services/clsi/ /overleaf/services/clsi/
|
||||
|
||||
FROM app
|
||||
|
||||
125
services/clsi/Jenkinsfile
vendored
Normal file
125
services/clsi/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
DOCKER_COMPOSE_FLAGS = '-f docker-compose.ci.yml'
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Build') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
retry(count: 3) {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir services/clsi/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Push Branch Image') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make push_branch'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Shellcheck') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make shellcheck'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Lint') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make lint_ci'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'clsi-eslint', name: 'clsi eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'services/clsi/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make format_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make typecheck_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Unit') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_unit'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Acceptance') {
|
||||
environment {
|
||||
COMPOSE_PROJECT_NAME_TEST_ACCEPTANCE = "test_acceptance"
|
||||
}
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_acceptance'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push Production') {
|
||||
steps {
|
||||
dir('services/clsi') {
|
||||
sh 'make push'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'clsi test results', testResults: 'services/clsi/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
dir('services/clsi') {
|
||||
sh 'make clean'
|
||||
}
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,15 +27,16 @@ clean:
|
||||
-docker rmi us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
-$(DOCKER_COMPOSE_TEST_UNIT) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-rm -rf reports/
|
||||
-git clean -dfX cache compiles output
|
||||
|
||||
HERE=$(shell pwd)
|
||||
MONOREPO=$(shell cd ../../ && pwd)
|
||||
export MONOREPO ?= $(shell cd ../../ && pwd)
|
||||
# Run the linting commands in the scope of the monorepo.
|
||||
# Eslint and prettier (plus some configs) are on the root.
|
||||
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:22.18.0 npm run --silent
|
||||
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/clsi/reports:/overleaf/services/clsi/reports ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
|
||||
# Same but from the top of the monorepo
|
||||
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:22.18.0 npm run --silent
|
||||
@@ -71,7 +72,8 @@ lint:
|
||||
$(RUN_LINTING) lint
|
||||
|
||||
lint_ci:
|
||||
$(RUN_LINTING_CI) lint
|
||||
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
|
||||
|
||||
lint_fix:
|
||||
$(RUN_LINTING) lint:fix
|
||||
@@ -138,10 +140,11 @@ build:
|
||||
tar:
|
||||
$(DOCKER_COMPOSE) up tar
|
||||
|
||||
publish:
|
||||
|
||||
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
push:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
|
||||
push_branch:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)
|
||||
|
||||
.PHONY: clean \
|
||||
format format_fix \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e;
|
||||
MOCHA="node_modules/.bin/mocha --recursive --reporter spec --timeout 15000"
|
||||
MOCHA="node_modules/.bin/mocha --recursive --timeout 15000"
|
||||
$MOCHA "$@"
|
||||
|
||||
@@ -7,6 +7,7 @@ services:
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
@@ -16,6 +17,7 @@ services:
|
||||
build: .
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
environment:
|
||||
CI:
|
||||
ELASTIC_SEARCH_DSN: es:9200
|
||||
MONGO_HOST: mongo
|
||||
POSTGRES_HOST: postgres
|
||||
@@ -32,6 +34,7 @@ services:
|
||||
SANDBOXED_COMPILES_HOST_DIR_COMPILES: $PWD/compiles
|
||||
SANDBOXED_COMPILES_HOST_DIR_OUTPUT: $PWD/output
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/clsi/reports
|
||||
- ./compiles:/overleaf/services/clsi/compiles
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: npm run test:acceptance
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js",
|
||||
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
|
||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||
"nodemon": "node --watch app.js",
|
||||
"lint": "eslint --max-warnings 0 --format unix .",
|
||||
@@ -41,6 +41,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"mock-fs": "^5.1.2",
|
||||
"node-fetch": "^2.7.0",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
|
||||
8
services/clsi/test/mocha-multi-reporters.cjs
Normal file
8
services/clsi/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
services/contacts/.mocharc.cjs
Normal file
13
services/contacts/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
@@ -13,12 +13,22 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json package-lock.json /overleaf/
|
||||
COPY services/contacts/package.json /overleaf/services/contacts/
|
||||
COPY libraries/ /overleaf/libraries/
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
COPY libraries/mongo-utils/package.json /overleaf/libraries/mongo-utils/package.json
|
||||
COPY libraries/o-error/package.json /overleaf/libraries/o-error/package.json
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY services/contacts/package.json /overleaf/services/contacts/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
COPY libraries/mongo-utils/ /overleaf/libraries/mongo-utils/
|
||||
COPY libraries/o-error/ /overleaf/libraries/o-error/
|
||||
COPY libraries/settings/ /overleaf/libraries/settings/
|
||||
COPY services/contacts/ /overleaf/services/contacts/
|
||||
|
||||
FROM app
|
||||
|
||||
87
services/contacts/Jenkinsfile
vendored
87
services/contacts/Jenkinsfile
vendored
@@ -1,3 +1,5 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
@@ -7,16 +9,9 @@ pipeline {
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
parallelsAlwaysFailFast()
|
||||
retry(3)
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
IMAGE_NAME = 'contacts'
|
||||
PROJECT_NAME = 'contacts'
|
||||
IMAGE_REPO = 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/contacts'
|
||||
AR_REPO_LOCATION = 'us-east1'
|
||||
AR_URL = 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker'
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
@@ -25,61 +20,84 @@ pipeline {
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage ('Build') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Tests') {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage ('Push Branch Image') {
|
||||
stage('Build') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
sh 'docker push ${AR_URL}/${IMAGE_NAME}:${BRANCH_NAME}'
|
||||
dir('services/contacts') {
|
||||
retry(count: 3) {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Shellcheck') {
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
sh 'mkdir services/contacts/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Push Branch Image') {
|
||||
steps {
|
||||
dir('services/contacts') {
|
||||
sh 'make push_branch'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Shellcheck') {
|
||||
steps {
|
||||
dir('services/contacts') {
|
||||
sh 'make shellcheck'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Lint') {
|
||||
stage('Lint') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
dir('services/contacts') {
|
||||
sh 'make lint_ci'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'contacts-eslint', name: 'contacts eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'services/contacts/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Format') {
|
||||
stage('Format') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
dir('services/contacts') {
|
||||
sh 'make format_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Typecheck') {
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
dir('services/contacts') {
|
||||
sh 'make typecheck_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Test Unit') {
|
||||
stage('Test Unit') {
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
sh 'make test_unit'
|
||||
dir('services/contacts') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_unit'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Test Acceptance') {
|
||||
stage('Test Acceptance') {
|
||||
environment {
|
||||
COMPOSE_PROJECT_NAME_TEST_ACCEPTANCE = "test_acceptance"
|
||||
}
|
||||
steps {
|
||||
dir ('services/contacts') {
|
||||
sh 'make test_acceptance'
|
||||
dir('services/contacts') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_acceptance'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +106,15 @@ pipeline {
|
||||
stage('Push Production') {
|
||||
steps {
|
||||
dir('services/contacts') {
|
||||
sh 'docker push ${AR_URL}/${IMAGE_NAME}:${BRANCH_NAME}-${BUILD_NUMBER}'
|
||||
sh 'make push'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'contacts test results', testResults: 'services/contacts/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
dir('services/contacts') {
|
||||
sh 'make clean'
|
||||
|
||||
@@ -27,14 +27,15 @@ clean:
|
||||
-docker rmi us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
-$(DOCKER_COMPOSE_TEST_UNIT) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-rm -rf reports/
|
||||
|
||||
HERE=$(shell pwd)
|
||||
MONOREPO=$(shell cd ../../ && pwd)
|
||||
export MONOREPO ?= $(shell cd ../../ && pwd)
|
||||
# Run the linting commands in the scope of the monorepo.
|
||||
# Eslint and prettier (plus some configs) are on the root.
|
||||
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:22.18.0 npm run --silent
|
||||
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/contacts/reports:/overleaf/services/contacts/reports ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
|
||||
# Same but from the top of the monorepo
|
||||
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:22.18.0 npm run --silent
|
||||
@@ -70,7 +71,8 @@ lint:
|
||||
$(RUN_LINTING) lint
|
||||
|
||||
lint_ci:
|
||||
$(RUN_LINTING_CI) lint
|
||||
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
|
||||
|
||||
lint_fix:
|
||||
$(RUN_LINTING) lint:fix
|
||||
@@ -137,10 +139,11 @@ build:
|
||||
tar:
|
||||
$(DOCKER_COMPOSE) up tar
|
||||
|
||||
publish:
|
||||
|
||||
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
push:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
|
||||
push_branch:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)
|
||||
|
||||
.PHONY: clean \
|
||||
format format_fix \
|
||||
|
||||
@@ -7,10 +7,12 @@ services:
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
user: node
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/contacts/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
@@ -23,6 +25,7 @@ services:
|
||||
build: .
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
environment:
|
||||
CI:
|
||||
ELASTIC_SEARCH_DSN: es:9200
|
||||
MONGO_HOST: mongo
|
||||
POSTGRES_HOST: postgres
|
||||
@@ -30,6 +33,7 @@ services:
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/contacts/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
depends_on:
|
||||
mongo:
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test:acceptance:_run": "mocha --loader=esmock --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance:_run": "mocha --loader=esmock --recursive --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit:_run": "mocha --loader=esmock --recursive --reporter spec --exit $@ test/unit/js",
|
||||
"test:unit:_run": "mocha --loader=esmock --recursive --exit $@ test/unit/js",
|
||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||
"nodemon": "node --watch app.js",
|
||||
"lint": "eslint --max-warnings 0 --format unix .",
|
||||
@@ -35,6 +35,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"esmock": "^2.6.3",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sinon": "~9.0.1",
|
||||
"sinon-chai": "^3.7.0",
|
||||
"typescript": "^5.0.4"
|
||||
|
||||
8
services/contacts/test/mocha-multi-reporters.cjs
Normal file
8
services/contacts/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
services/docstore/.mocharc.cjs
Normal file
13
services/docstore/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
@@ -13,12 +13,28 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json package-lock.json /overleaf/
|
||||
COPY services/docstore/package.json /overleaf/services/docstore/
|
||||
COPY libraries/ /overleaf/libraries/
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
COPY libraries/mongo-utils/package.json /overleaf/libraries/mongo-utils/package.json
|
||||
COPY libraries/o-error/package.json /overleaf/libraries/o-error/package.json
|
||||
COPY libraries/object-persistor/package.json /overleaf/libraries/object-persistor/package.json
|
||||
COPY libraries/promise-utils/package.json /overleaf/libraries/promise-utils/package.json
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY libraries/stream-utils/package.json /overleaf/libraries/stream-utils/package.json
|
||||
COPY services/docstore/package.json /overleaf/services/docstore/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
COPY libraries/mongo-utils/ /overleaf/libraries/mongo-utils/
|
||||
COPY libraries/o-error/ /overleaf/libraries/o-error/
|
||||
COPY libraries/object-persistor/ /overleaf/libraries/object-persistor/
|
||||
COPY libraries/promise-utils/ /overleaf/libraries/promise-utils/
|
||||
COPY libraries/settings/ /overleaf/libraries/settings/
|
||||
COPY libraries/stream-utils/ /overleaf/libraries/stream-utils/
|
||||
COPY services/docstore/ /overleaf/services/docstore/
|
||||
|
||||
FROM app
|
||||
|
||||
125
services/docstore/Jenkinsfile
vendored
Normal file
125
services/docstore/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
DOCKER_COMPOSE_FLAGS = '-f docker-compose.ci.yml'
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Build') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
retry(count: 3) {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir services/docstore/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Push Branch Image') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make push_branch'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Shellcheck') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make shellcheck'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Lint') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make lint_ci'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'docstore-eslint', name: 'docstore eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'services/docstore/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make format_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make typecheck_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Unit') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_unit'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Acceptance') {
|
||||
environment {
|
||||
COMPOSE_PROJECT_NAME_TEST_ACCEPTANCE = "test_acceptance"
|
||||
}
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_acceptance'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push Production') {
|
||||
steps {
|
||||
dir('services/docstore') {
|
||||
sh 'make push'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'docstore test results', testResults: 'services/docstore/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
dir('services/docstore') {
|
||||
sh 'make clean'
|
||||
}
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,15 @@ clean:
|
||||
-docker rmi us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
-$(DOCKER_COMPOSE_TEST_UNIT) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-rm -rf reports/
|
||||
|
||||
HERE=$(shell pwd)
|
||||
MONOREPO=$(shell cd ../../ && pwd)
|
||||
export MONOREPO ?= $(shell cd ../../ && pwd)
|
||||
# Run the linting commands in the scope of the monorepo.
|
||||
# Eslint and prettier (plus some configs) are on the root.
|
||||
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:22.18.0 npm run --silent
|
||||
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/docstore/reports:/overleaf/services/docstore/reports ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
|
||||
# Same but from the top of the monorepo
|
||||
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:22.18.0 npm run --silent
|
||||
@@ -70,7 +71,8 @@ lint:
|
||||
$(RUN_LINTING) lint
|
||||
|
||||
lint_ci:
|
||||
$(RUN_LINTING_CI) lint
|
||||
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
|
||||
|
||||
lint_fix:
|
||||
$(RUN_LINTING) lint:fix
|
||||
@@ -137,10 +139,11 @@ build:
|
||||
tar:
|
||||
$(DOCKER_COMPOSE) up tar
|
||||
|
||||
publish:
|
||||
|
||||
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
push:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
|
||||
push_branch:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)
|
||||
|
||||
.PHONY: clean \
|
||||
format format_fix \
|
||||
|
||||
@@ -7,10 +7,12 @@ services:
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
user: node
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/docstore/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
@@ -23,6 +25,7 @@ services:
|
||||
build: .
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
environment:
|
||||
CI:
|
||||
ELASTIC_SEARCH_DSN: es:9200
|
||||
MONGO_HOST: mongo
|
||||
POSTGRES_HOST: postgres
|
||||
@@ -33,6 +36,7 @@ services:
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/docstore/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
depends_on:
|
||||
mongo:
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js",
|
||||
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
|
||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||
"nodemon": "node --watch app.js",
|
||||
"lint": "eslint --max-warnings 0 --format unix .",
|
||||
@@ -40,6 +40,8 @@
|
||||
"chai": "^4.3.6",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "~2.0.4",
|
||||
"sinon": "~9.0.2",
|
||||
"sinon-chai": "^3.7.0",
|
||||
|
||||
8
services/docstore/test/mocha-multi-reporters.cjs
Normal file
8
services/docstore/test/mocha-multi-reporters.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
mochaFile: `reports/junit-mocha-${process.env.MOCHA_GREP}.xml`,
|
||||
includePending: true,
|
||||
jenkinsMode: true,
|
||||
},
|
||||
}
|
||||
13
services/document-updater/.mocharc.cjs
Normal file
13
services/document-updater/.mocharc.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
let reporterOptions = {}
|
||||
if (process.env.CI) {
|
||||
reporterOptions = {
|
||||
reporter: '/overleaf/node_modules/mocha-multi-reporters',
|
||||
'reporter-options': ['configFile=./test/mocha-multi-reporters.cjs'],
|
||||
}
|
||||
}
|
||||
const all = {
|
||||
require: 'test/setup.js',
|
||||
...reporterOptions,
|
||||
}
|
||||
|
||||
module.exports = all
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"require": "test/setup.js"
|
||||
}
|
||||
@@ -13,12 +13,30 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json package-lock.json /overleaf/
|
||||
COPY services/document-updater/package.json /overleaf/services/document-updater/
|
||||
COPY libraries/ /overleaf/libraries/
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
COPY libraries/mongo-utils/package.json /overleaf/libraries/mongo-utils/package.json
|
||||
COPY libraries/o-error/package.json /overleaf/libraries/o-error/package.json
|
||||
COPY libraries/overleaf-editor-core/package.json /overleaf/libraries/overleaf-editor-core/package.json
|
||||
COPY libraries/promise-utils/package.json /overleaf/libraries/promise-utils/package.json
|
||||
COPY libraries/ranges-tracker/package.json /overleaf/libraries/ranges-tracker/package.json
|
||||
COPY libraries/redis-wrapper/package.json /overleaf/libraries/redis-wrapper/package.json
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY services/document-updater/package.json /overleaf/services/document-updater/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
COPY libraries/mongo-utils/ /overleaf/libraries/mongo-utils/
|
||||
COPY libraries/o-error/ /overleaf/libraries/o-error/
|
||||
COPY libraries/overleaf-editor-core/ /overleaf/libraries/overleaf-editor-core/
|
||||
COPY libraries/promise-utils/ /overleaf/libraries/promise-utils/
|
||||
COPY libraries/ranges-tracker/ /overleaf/libraries/ranges-tracker/
|
||||
COPY libraries/redis-wrapper/ /overleaf/libraries/redis-wrapper/
|
||||
COPY libraries/settings/ /overleaf/libraries/settings/
|
||||
COPY services/document-updater/ /overleaf/services/document-updater/
|
||||
|
||||
FROM app
|
||||
|
||||
125
services/document-updater/Jenkinsfile
vendored
Normal file
125
services/document-updater/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
// Autogenerated by build scripts. Do not edit.
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'jenkins-agent-web'
|
||||
customWorkspace '/workspace'
|
||||
}
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
timeout(time: 15, unit: 'MINUTES')
|
||||
}
|
||||
environment {
|
||||
BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
|
||||
JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
|
||||
BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
|
||||
DOCKER_COMPOSE_FLAGS = '-f docker-compose.ci.yml'
|
||||
COMMIT_SHA = "${GIT_COMMIT}"
|
||||
SHORT_SHA = "${GIT_COMMIT.take(7)}"
|
||||
}
|
||||
stages {
|
||||
stage('Stage 1') {
|
||||
parallel {
|
||||
stage('Build') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
retry(count: 3) {
|
||||
sh 'make build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create reports folder') {
|
||||
steps {
|
||||
sh 'mkdir services/document-updater/reports'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Stage 2') {
|
||||
parallel {
|
||||
stage('Push Branch Image') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make push_branch'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Shellcheck') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make shellcheck'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Lint') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make lint_ci'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'document-updater-eslint', name: 'document-updater eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'services/document-updater/reports/eslint.json')]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Format') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make format_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Typecheck') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make typecheck_ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Unit') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_unit'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test Acceptance') {
|
||||
environment {
|
||||
COMPOSE_PROJECT_NAME_TEST_ACCEPTANCE = "test_acceptance"
|
||||
}
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
retry(count: 3) {
|
||||
sh 'make test_acceptance'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push Production') {
|
||||
steps {
|
||||
dir('services/document-updater') {
|
||||
sh 'make push'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit checksName: 'document-updater test results', testResults: 'services/document-updater/reports/junit-*.xml'
|
||||
}
|
||||
cleanup {
|
||||
dir('services/document-updater') {
|
||||
sh 'make clean'
|
||||
}
|
||||
sh 'make clean_jenkins -j10'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,15 @@ clean:
|
||||
-docker rmi us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
-$(DOCKER_COMPOSE_TEST_UNIT) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-$(DOCKER_COMPOSE_TEST_ACCEPTANCE) down --remove-orphans --rmi local --timeout 0 --volumes
|
||||
-rm -rf reports/
|
||||
|
||||
HERE=$(shell pwd)
|
||||
MONOREPO=$(shell cd ../../ && pwd)
|
||||
export MONOREPO ?= $(shell cd ../../ && pwd)
|
||||
# Run the linting commands in the scope of the monorepo.
|
||||
# Eslint and prettier (plus some configs) are on the root.
|
||||
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:22.18.0 npm run --silent
|
||||
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/reports:/overleaf/services/document-updater/reports ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) npm run --silent
|
||||
|
||||
# Same but from the top of the monorepo
|
||||
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:22.18.0 npm run --silent
|
||||
@@ -70,7 +71,8 @@ lint:
|
||||
$(RUN_LINTING) lint
|
||||
|
||||
lint_ci:
|
||||
$(RUN_LINTING_CI) lint
|
||||
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
|
||||
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
|
||||
|
||||
lint_fix:
|
||||
$(RUN_LINTING) lint:fix
|
||||
@@ -137,10 +139,11 @@ build:
|
||||
tar:
|
||||
$(DOCKER_COMPOSE) up tar
|
||||
|
||||
publish:
|
||||
|
||||
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
push:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
|
||||
|
||||
push_branch:
|
||||
docker push us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME):$(BRANCH_NAME)
|
||||
|
||||
.PHONY: clean \
|
||||
format format_fix \
|
||||
|
||||
@@ -7,10 +7,12 @@ services:
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
user: node
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/document-updater/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
|
||||
command: npm run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
@@ -29,6 +31,7 @@ services:
|
||||
build: .
|
||||
image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER
|
||||
environment:
|
||||
CI:
|
||||
ELASTIC_SEARCH_DSN: es:9200
|
||||
REDIS_HOST: redis_test
|
||||
QUEUES_REDIS_HOST: redis_test
|
||||
@@ -40,6 +43,7 @@ services:
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/document-updater/reports
|
||||
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
|
||||
depends_on:
|
||||
mongo:
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js",
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js",
|
||||
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
|
||||
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
|
||||
"nodemon": "node --watch app.js",
|
||||
"benchmark:apply": "node benchmarks/apply",
|
||||
@@ -45,6 +45,8 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"cluster-key-slot": "^1.0.5",
|
||||
"mocha": "^11.1.0",
|
||||
"mocha-junit-reporter": "^2.2.1",
|
||||
"mocha-multi-reporters": "^1.5.1",
|
||||
"sandboxed-module": "^2.0.4",
|
||||
"sinon": "^9.2.4",
|
||||
"sinon-chai": "^3.7.0",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user