Skip to content

Commit

Permalink
Merge pull request #2409 from LuccaSA/master
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz committed Nov 10, 2023
2 parents 494219f + b66082d commit 4922c24
Show file tree
Hide file tree
Showing 66 changed files with 2,897 additions and 877 deletions.
108 changes: 46 additions & 62 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
@Library('Lucca@v0.62.0') _
@Library('Lucca@v0.63.6') _

import hudson.Util
import fr.lucca.CI

ciBuildProperties script:this

node(label: CI.getSelectedNode(script:this)) {
notifyStartStats()

node(label: CI.getSelectedLinuxNode(script:this)) {
def projectTechnicalName = 'lucca-front'
def repoName = "lucca-front"

Expand All @@ -24,80 +22,66 @@ node(label: CI.getSelectedNode(script:this)) {

try {
timeout(time: 10, unit: 'MINUTES') {
loggableStage('Cleanup') {
// storybook static
if (fileExists('storybook')) {
dir('storybook') {
deleteDir()
}
}
}

loggableStage('Checkout') {
scmVars = checkout scm
}

loggableStage('Restore') {
npmCi()
}

if (!isPR) {
loggableStage('Qualif') {
// it must be buildable
bat "npm run build"
// it must break no test
bat "npm run jenkins-test"
// it must be lint compliant
bat "npm run lint"
npmCi()

npmScript(script: 'build')
npmScript(script: 'jenkins-test', skip: isPR)
npmScript(script: 'lint', skip: isPR)

def shouldDeploy = isPR || isRc || isMaster;

loggableStage('Deploy', !shouldDeploy) {
echo "deploying ${branchName}"
npmScript(script: 'build-storybook')
npmScript(script: 'build-compodoc')

// FIXME Deploy with windows node for now
stash(name: "storybook-static", includes: "storybook-static/**")
stash(name: "compodoc-static", includes: "compodoc-static/**")
node("windows") {
unstash(name: "storybook-static")
powershell "Remove-Item \\\\RBX1-SH1-TECH\\lucca-front\\${env.BRANCH_NAME}\\storybook -Recurse"
powershell "Copy-Item storybook-static \\\\RBX1-SH1-TECH\\lucca-front\\${env.BRANCH_NAME}\\storybook -Recurse"
unstash(name: "compodoc-static")
powershell "Remove-Item \\\\RBX1-SH1-TECH\\lucca-front\\${env.BRANCH_NAME}\\compodoc -Recurse"
powershell "Copy-Item compodoc-static \\\\RBX1-SH1-TECH\\lucca-front\\${env.BRANCH_NAME}\\compodoc -Recurse"
}
}

if (isPR || isRc || isMaster) {
loggableStage('Deploy') {
echo "deploying ${branchName}"
bat "npm run build-storybook"
bat "npm run build-compodoc"
powershell "Remove-Item \\\\RBX1-SH1-TECH\\lucca-front\\${branchName}\\storybook -Recurse"
powershell "Remove-Item \\\\RBX1-SH1-TECH\\lucca-front\\${branchName}\\compodoc -Recurse"
powershell "Copy-Item storybook-static \\\\RBX1-SH1-TECH\\lucca-front\\${branchName}\\storybook -Recurse"
powershell "Copy-Item compodoc-static \\\\RBX1-SH1-TECH\\lucca-front\\${branchName}\\compodoc -Recurse"
}

loggableStage('e2e') {
publishE2e(loggableStageName: 'e2e', slnFilepath: 'e2e\\LuccaFront.e2e.sln', framework: "net6.0")
archiveElements(e2e: true)
}

commentOnPR(
credentialsId: 'ux-comment-token',
body: ":woman_cook: https://lucca-front.lucca.tech/${branchName}/storybook",
repoName: projectTechnicalName,
skip: !isPR
)
loggableStage('e2e', !shouldDeploy) {
publishE2e(loggableStageName: 'e2e', slnFilepath: 'e2e/LuccaFront.e2e.sln', framework: "net6.0")
archiveElements(e2e: true)
}

if (!isPR) {
loggableStage('Publish') {
def version = env.BRANCH_NAME
commentOnPR(
credentialsId: 'ux-comment-token',
body: ":woman_cook: https://lucca-front.lucca.tech/${branchName}/storybook",
repoName: projectTechnicalName,
skip: !isPR
)

def iconsPackageJson = readFile(file: 'dist/icons/package.json');
def scssPackageJson = readFile(file: 'dist/scss/package.json');
def ngPackageJson = readFile(file: 'dist/ng/package.json');
loggableStage('Publish', isPR) {
def version = env.BRANCH_NAME

writeFile(file: 'dist/icons/package.json', text: iconsPackageJson.replaceAll('"\\*"', "\"${version}\""));
writeFile(file: 'dist/scss/package.json', text: scssPackageJson.replaceAll('"\\*"', "\"${version}\""));
writeFile(file: 'dist/ng/package.json', text: ngPackageJson.replaceAll('"\\*"', "\"${version}\""));
def iconsPackageJson = readFile(file: 'dist/icons/package.json');
def scssPackageJson = readFile(file: 'dist/scss/package.json');
def ngPackageJson = readFile(file: 'dist/ng/package.json');

publishNpmOnReleaseTag(publishFolder: 'dist/icons')
publishNpmOnReleaseTag(publishFolder: 'dist/scss')
publishNpmOnReleaseTag(publishFolder: 'dist/ng')
}
writeFile(file: 'dist/icons/package.json', text: iconsPackageJson.replaceAll('"\\*"', "\"${version}\""));
writeFile(file: 'dist/scss/package.json', text: scssPackageJson.replaceAll('"\\*"', "\"${version}\""));
writeFile(file: 'dist/ng/package.json', text: ngPackageJson.replaceAll('"\\*"', "\"${version}\""));

publishNpmOnReleaseTag(publishFolder: 'dist/icons')
publishNpmOnReleaseTag(publishFolder: 'dist/scss')
publishNpmOnReleaseTag(publishFolder: 'dist/ng')
}
}
} catch(err) {
println err
currentBuild.result = 'failure'
}

notifyEndStats()
}
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ runTask('Lucca Front compilation', async () => {
output: OUTPUT_ICONS,
});
copyFiles({
patterns: ['lucca-icon.d.ts', 'package.json', 'src/**'],
patterns: ['index.d.ts', 'package.json', 'src/**'],
context: ICONS,
output: OUTPUT_ICONS,
});
Expand Down
Loading

0 comments on commit 4922c24

Please sign in to comment.