ci: removed some things

This commit is contained in:
2025-07-13 20:43:50 +03:00
parent 10b59769f9
commit 1d1c45d777

81
Jenkinsfile vendored
View File

@@ -1,120 +1,65 @@
pipeline { pipeline {
agent { agent {
dockerContainer { dockerContainer {
image 'rust:1.75' // Use official Rust Docker image image 'rust:1.75'
args '-v $HOME/.cargo:/root/.cargo' // Cache Cargo dependencies
} }
} }
triggers {
// Trigger build on SCM changes (pushes)
pollSCM('H/5 * * * *') // Poll SCM every 5 minutes
}
environment { environment {
// Rust environment variables CARGO_HOME = '/usr/local/cargo'
CARGO_HOME = '/root/.cargo' RUSTUP_HOME = '/usr/local/rustup'
RUSTUP_HOME = '/root/.rustup'
// Optional: Set specific Rust version
// RUST_VERSION = '1.75.0'
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
// Checkout source code
checkout scm checkout scm
} }
} }
stage('Rust Info') { stage('Setup Environment') {
steps { steps {
// Display Rust and Cargo versions
sh 'rustc --version'
sh 'cargo --version' sh 'cargo --version'
sh 'rustc --version'
sh 'mkdir -p target'
sh 'mkdir -p ~/.cargo/registry'
} }
} }
stage('Cache Dependencies') { stage('Build Dependencies') {
steps { steps {
// Update Cargo index and cache dependencies
sh 'cargo fetch' sh 'cargo fetch'
} }
} }
stage('Lint') { stage('Run Tests') {
steps { steps {
// Run clippy for linting
sh 'cargo clippy -- -D warnings'
}
}
stage('Format Check') {
steps {
// Check code formatting
sh 'cargo fmt -- --check'
}
}
stage('Build') {
steps {
// Build the project
sh 'cargo build --release'
}
}
stage('Test') {
steps {
// Run tests
sh 'cargo test --release' sh 'cargo test --release'
} }
} }
stage('Security Audit') { stage('Build Binary') {
steps { steps {
// Optional: Run security audit sh 'cargo build --release'
script {
try {
sh 'cargo install cargo-audit || true'
sh 'cargo audit'
} catch (Exception e) {
echo "Security audit failed or not available: ${e.getMessage()}"
}
}
} }
} }
stage('Archive Artifacts') { stage('Archive') {
steps { steps {
// Archive build artifacts archiveArtifacts artifacts: 'target/release/**', allowEmptyArchive: true
script {
// Find and archive binary files
sh 'find target/release -maxdepth 1 -type f -executable -not -name "*.so" -not -name "*.d" | head -10'
// Archive the main binary (adjust name as needed)
archiveArtifacts artifacts: 'target/release/*', allowEmptyArchive: true, fingerprint: true
}
} }
} }
} }
post { post {
always { always {
// Clean workspace after build
cleanWs() cleanWs()
} }
success { success {
echo 'Rust build completed successfully!' echo 'Rust build completed successfully!'
} }
failure { failure {
echo 'Rust build failed!' echo 'Rust build failed!'
// Optional: Send notifications
}
unstable {
echo 'Rust build completed with warnings!'
} }
} }
} }