Add empty Rust rewrite skeleton and Rust CI
This commit is contained in:
parent
0f93408e9b
commit
9dcf33da18
|
|
@ -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"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "rust_realease"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
|
@ -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
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future build implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future cli implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future config implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future error implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future gitea implementation.
|
||||
|
|
@ -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() {}
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future manifest implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future model implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future package implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future prepare implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future project implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future runner implementation.
|
||||
|
|
@ -0,0 +1 @@
|
|||
//! Placeholder for the future verify implementation.
|
||||
Loading…
Reference in New Issue