From f33edf1c3d71d8f2b602ddc2a4e747fa1ad7a9fd Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Wed, 4 Feb 2026 10:25:36 +0000 Subject: [PATCH] fix: resolved CI/CD issues and module structure --- .gitea/workflows/ci.yml | 103 +++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 37 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8c5a46b..07db25e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,51 +2,80 @@ name: CI on: push: - branches: [ main, master ] + branches: [main] pull_request: - branches: [ main, master ] - -permissions: - contents: read + branches: [main] jobs: - check: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - - - name: Check build - run: cargo check --no-default-features 2>&1 || true - test: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable + - name: Setup Rust + run: | + rustup install stable + rustup default stable + + - name: Install system dependencies + run: | + apt-get update + apt-get install -y --no-install-recommends libssl-dev libssh2-1-dev pkg-config cmake + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build + run: cargo build --features full - name: Run tests - run: cargo test --no-default-features 2>&1 || true - - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy - - - name: Check formatting - run: cargo fmt --check --no-default-features 2>&1 || true + run: cargo test --features full - name: Run clippy - run: cargo clippy --no-default-features -- -D warnings 2>&1 || true \ No newline at end of file + run: cargo clippy --features full -- -D warnings + + - name: Check formatting + run: cargo fmt --check + + release: + needs: test + runs-on: ubuntu-latest + if: startsWith(gitea.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + run: | + rustup install stable + rustup default stable + + - name: Install system dependencies + run: | + apt-get update + apt-get install -y --no-install-recommends libssl-dev libssh2-1-dev pkg-config cmake + + - name: Build release + run: cargo build --release --features full + + - name: Create Release + run: | + curl -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "${{ gitea.ref_name }}", + "name": "${{ gitea.ref_name }}", + "body": "Release ${{ gitea.ref_name }}" + }' + env: + GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}