mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +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:
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,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user