diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..974ea9b --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "rust_realease" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..cb57c81 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "rust_realease" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] diff --git a/Jenkinsfile b/Jenkinsfile index dd8ba52..b51a8e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,189 +1,60 @@ // Add this webhook in Gitea: // http://192.168.1.37:8080/gitea-webhook/post +// Skeleton checks only; release behavior remains in the Python implementation. pipeline { agent { label 'rust_no_docker' } environment { - VENV = '.venv' - - // Make Python output immediately visible in Jenkins. - PYTHONUNBUFFERED = '1' - - // Ensure the local worker package is imported. - PYTHONPATH = "${WORKSPACE}" + CARGO_TERM_COLOR = 'never' } stages { stage('Checkout') { steps { checkout scm + } + } + stage('Rust Toolchain') { + steps { sh ''' set -eu - - git submodule sync --recursive - git submodule update --init --recursive + rustc --version + cargo --version + cargo fmt --version + cargo clippy --version ''' } } - stage('Setup Python') { + stage('Format') { steps { - sh ''' - set -eu - - # --------------------------------------------------------- - # uv - # --------------------------------------------------------- - - if ! command -v uv >/dev/null 2>&1; then - echo "uv not found — installing it..." - - if ! command -v cargo-binstall >/dev/null 2>&1; then - echo "cargo-binstall not found — installing it..." - cargo install cargo-binstall - fi - - cargo binstall --no-confirm uv - else - echo "uv already installed." - fi - - echo - echo "uv:" - uv --version - - # --------------------------------------------------------- - # Python virtual environment - # --------------------------------------------------------- - - rm -rf "${VENV}" - - echo - echo "Creating Python virtual environment..." - - uv venv \ - --python 3.11 \ - "${VENV}" - - echo - echo "Installing dependencies..." - - uv pip install \ - --python "${VENV}/bin/python" \ - -r requirements.txt - - echo - echo "Python:" - "${VENV}/bin/python" --version - - echo - echo "Installed dependencies:" - uv pip list \ - --python "${VENV}/bin/python" - ''' + sh 'cargo fmt --check' } } - stage('Python Syntax') { + stage('Clippy') { steps { - sh ''' - set -eu - - echo "Checking Python syntax..." - - "${VENV}/bin/python" \ - -m compileall \ - -q \ - worker \ - tests - - echo "Python syntax OK." - ''' - } - } - - stage('Shell Syntax') { - steps { - sh ''' - set -eu - - echo "Checking release.sh syntax..." - - bash -n release.sh - - echo "Shell syntax OK." - ''' - } - } - - stage('CLI Smoke Test') { - steps { - sh ''' - set -eu - - echo "Testing worker CLI import..." - - "${VENV}/bin/python" \ - -P \ - -m worker \ - --help >/dev/null - - echo "Testing release.sh wrapper..." - - VIRTUAL_ENV="${WORKSPACE}/${VENV}" \ - ./release.sh --help >/dev/null - - echo "CLI smoke tests passed." - ''' + sh 'cargo clippy --locked --offline --all-targets --all-features -- -D warnings' } } stage('Tests') { steps { - sh ''' - set -eu - - echo "Running rust_realease test suite..." - echo - - "${VENV}/bin/python" \ - -m unittest discover \ - -s tests \ - -p 'test_*.py' \ - -v - ''' + sh 'cargo test --locked --offline --all' } } - stage('Repository Sanity') { + stage('Build') { steps { - sh ''' - set -eu + sh 'cargo build --locked --offline --release' + } + } - echo "Checking expected project files..." - - for file in \ - release.sh \ - requirements.txt \ - config.toml \ - worker/__init__.py \ - worker/__main__.py - do - if [ ! -e "${file}" ]; then - echo "ERROR: expected file is missing: ${file}" >&2 - exit 1 - fi - done - - if [ ! -x release.sh ]; then - echo "ERROR: release.sh is not executable." >&2 - exit 1 - fi - - echo "Repository sanity checks passed." - ''' + stage('Skeleton Smoke Test') { + steps { + sh 'cargo run --locked --offline --release' } } } @@ -192,45 +63,31 @@ pipeline { success { publishChecks( conclusion: 'SUCCESS', - name: 'Python CI', - summary: 'rust_realease passed all CI checks.', - text: 'Python syntax, shell syntax, CLI smoke tests, repository checks, and the complete unittest suite passed.', + name: 'Rust CI', + summary: 'Rust skeleton passed all CI checks.', + text: 'Formatting, strict Clippy, Cargo tests, release build, and skeleton startup passed. Release functionality is not implemented yet.', title: 'CI Successful' ) - - echo '✅ rust_realease passed all CI checks.' } failure { publishChecks( conclusion: 'FAILURE', - name: 'Python CI', - summary: 'rust_realease failed CI.', - text: 'Python syntax, shell validation, CLI startup, repository sanity checks, or tests failed. Check the Jenkins log.', + name: 'Rust CI', + summary: 'Rust skeleton failed CI.', + text: 'Check the Jenkins log for toolchain, formatting, Clippy, test, build, or startup failures.', title: 'CI Failed' ) - - echo '❌ rust_realease CI failed.' } unstable { publishChecks( conclusion: 'ACTION_REQUIRED', - name: 'Python CI', - summary: 'rust_realease CI is unstable.', + name: 'Rust CI', + summary: 'Rust skeleton CI is unstable.', text: 'The Jenkins build completed with an unstable status.', title: 'CI Unstable' ) - - echo '⚠️ rust_realease CI is unstable.' - } - - always { - sh ''' - echo "Cleaning CI environment..." - rm -rf .venv - find . -type d -name '__pycache__' -prune -exec rm -rf {} + 2>/dev/null || true - ''' } } -} \ No newline at end of file +} diff --git a/src/build.rs b/src/build.rs new file mode 100644 index 0000000..61288d0 --- /dev/null +++ b/src/build.rs @@ -0,0 +1 @@ +//! Placeholder for the future build implementation. diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..b8139a2 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1 @@ +//! Placeholder for the future cli implementation. diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..a2cfe66 --- /dev/null +++ b/src/config.rs @@ -0,0 +1 @@ +//! Placeholder for the future config implementation. diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..4ff2090 --- /dev/null +++ b/src/error.rs @@ -0,0 +1 @@ +//! Placeholder for the future error implementation. diff --git a/src/gitea.rs b/src/gitea.rs new file mode 100644 index 0000000..794c4e9 --- /dev/null +++ b/src/gitea.rs @@ -0,0 +1 @@ +//! Placeholder for the future gitea implementation. diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..c906d98 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,16 @@ +//! Rust rewrite skeleton. Release functionality is not implemented yet. + +mod build; +mod cli; +mod config; +mod error; +mod gitea; +mod manifest; +mod model; +mod package; +mod prepare; +mod project; +mod runner; +mod verify; + +fn main() {} diff --git a/src/manifest.rs b/src/manifest.rs new file mode 100644 index 0000000..d7c6002 --- /dev/null +++ b/src/manifest.rs @@ -0,0 +1 @@ +//! Placeholder for the future manifest implementation. diff --git a/src/model.rs b/src/model.rs new file mode 100644 index 0000000..154e860 --- /dev/null +++ b/src/model.rs @@ -0,0 +1 @@ +//! Placeholder for the future model implementation. diff --git a/src/package.rs b/src/package.rs new file mode 100644 index 0000000..022d67d --- /dev/null +++ b/src/package.rs @@ -0,0 +1 @@ +//! Placeholder for the future package implementation. diff --git a/src/prepare.rs b/src/prepare.rs new file mode 100644 index 0000000..a66c90f --- /dev/null +++ b/src/prepare.rs @@ -0,0 +1 @@ +//! Placeholder for the future prepare implementation. diff --git a/src/project.rs b/src/project.rs new file mode 100644 index 0000000..4d9d06b --- /dev/null +++ b/src/project.rs @@ -0,0 +1 @@ +//! Placeholder for the future project implementation. diff --git a/src/runner.rs b/src/runner.rs new file mode 100644 index 0000000..66a05c7 --- /dev/null +++ b/src/runner.rs @@ -0,0 +1 @@ +//! Placeholder for the future runner implementation. diff --git a/src/verify.rs b/src/verify.rs new file mode 100644 index 0000000..a01391b --- /dev/null +++ b/src/verify.rs @@ -0,0 +1 @@ +//! Placeholder for the future verify implementation.