Compare commits
10 Commits
951018bb96
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f8b44d9cdf | |||
| 64b80518d4 | |||
| c3adf8aedb | |||
| 393f4d44af | |||
| d40e9b18ee | |||
| 106f29cfb9 | |||
| d8214dd7eb | |||
| 095da3a601 | |||
| 1d1c45d777 | |||
| 10b59769f9 |
120
Jenkinsfile
vendored
120
Jenkinsfile
vendored
@@ -1,120 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image 'rust:1.75' // Use official Rust Docker image
|
|
||||||
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 {
|
|
||||||
// Rust environment variables
|
|
||||||
CARGO_HOME = '/root/.cargo'
|
|
||||||
RUSTUP_HOME = '/root/.rustup'
|
|
||||||
// Optional: Set specific Rust version
|
|
||||||
// RUST_VERSION = '1.75.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Checkout') {
|
|
||||||
steps {
|
|
||||||
// Checkout source code
|
|
||||||
checkout scm
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Rust Info') {
|
|
||||||
steps {
|
|
||||||
// Display Rust and Cargo versions
|
|
||||||
sh 'rustc --version'
|
|
||||||
sh 'cargo --version'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Cache Dependencies') {
|
|
||||||
steps {
|
|
||||||
// Update Cargo index and cache dependencies
|
|
||||||
sh 'cargo fetch'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Lint') {
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Security Audit') {
|
|
||||||
steps {
|
|
||||||
// Optional: Run security audit
|
|
||||||
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') {
|
|
||||||
steps {
|
|
||||||
// Archive build artifacts
|
|
||||||
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 {
|
|
||||||
always {
|
|
||||||
// Clean workspace after build
|
|
||||||
cleanWs()
|
|
||||||
}
|
|
||||||
|
|
||||||
success {
|
|
||||||
echo 'Rust build completed successfully!'
|
|
||||||
}
|
|
||||||
|
|
||||||
failure {
|
|
||||||
echo 'Rust build failed!'
|
|
||||||
// Optional: Send notifications
|
|
||||||
}
|
|
||||||
|
|
||||||
unstable {
|
|
||||||
echo 'Rust build completed with warnings!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,7 +32,7 @@ pub struct Args {
|
|||||||
value_name = "CONFIG_FILE",
|
value_name = "CONFIG_FILE",
|
||||||
help = "OAuth configuration file (JSON)",
|
help = "OAuth configuration file (JSON)",
|
||||||
default_value = "~/.client_secrets.json",
|
default_value = "~/.client_secrets.json",
|
||||||
required = true
|
required = false
|
||||||
)]
|
)]
|
||||||
oauth_config: String,
|
oauth_config: String,
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
// Upload videos
|
// Upload videos
|
||||||
println!("\nUploading videos...");
|
println!("\nUploading videos...");
|
||||||
for (i, (video_file, video_metadata)) in video_files.iter().zip(metadata.iter()).enumerate() {
|
for (i, (video_file, video_metadata)) in video_files.iter().zip(metadata.iter()).enumerate() {
|
||||||
|
if (i+1) % 8 == 0 {
|
||||||
|
println!("refreshing token");
|
||||||
|
uploader.authenticate().await?;
|
||||||
|
}
|
||||||
println!("Uploading {} ({}/{})", video_file, i + 1, video_files.len());
|
println!("Uploading {} ({}/{})", video_file, i + 1, video_files.len());
|
||||||
|
|
||||||
match uploader.upload_video(video_file, video_metadata).await {
|
match uploader.upload_video(video_file, video_metadata).await {
|
||||||
|
|||||||
@@ -256,7 +256,10 @@ impl YouTubeUploader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_default_metadata(video_files: &[String], description_file: &str) -> Vec<VideoMetadata> {
|
pub fn create_default_metadata(
|
||||||
|
video_files: &[String],
|
||||||
|
description_file: &str,
|
||||||
|
) -> Vec<VideoMetadata> {
|
||||||
let expanded_path = expand_tilde(description_file);
|
let expanded_path = expand_tilde(description_file);
|
||||||
video_files
|
video_files
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
Reference in New Issue
Block a user