diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c87e6da --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,87 @@ +pipeline { + agent any + + tools { + nodejs 'NodeJS-18' + } + + environment { + PROJECT_NAME = 'react-app' + BUILD_DIR = 'build' + } + + stages { + stage('Checkout') { + steps { + echo '==== Checking out code from Gitea ====' + checkout scm + } + } + + stage('Install Dependencies') { + steps { + echo '==== Installing npm dependencies ====' + sh ''' + node --version + npm --version + npm ci + ''' + } + } + + stage('Lint') { + steps { + echo '==== Running ESLint ====' + sh 'npm run lint || true' + } + } + + stage('Test') { + steps { + echo '==== Running tests ====' + sh 'CI=true npm test -- --passWithNoTests' + } + } + + stage('Build') { + steps { + echo '==== Building React application ====' + sh ''' + npm run build + ls -lah ${BUILD_DIR} + ''' + } + } + + stage('Archive Artifacts') { + steps { + echo '==== Archiving build artifacts ====' + archiveArtifacts artifacts: 'build/**/*', fingerprint: true + } + } + + stage('Deploy Info') { + steps { + echo '==== Build completed successfully ====' + echo "Project: ${PROJECT_NAME}" + echo "Build Number: ${BUILD_NUMBER}" + echo "Build Artifacts are ready for deployment" + } + } + } + + post { + success { + echo '✅ Pipeline completed successfully!' + // 추가: 슬랙 알림, 이메일 등 + } + failure { + echo '❌ Pipeline failed!' + // 추가: 실패 알림 + } + always { + echo '==== Cleaning up workspace ====' + cleanWs() + } + } +}