Files
quoter/.gitea/workflows/main.yml
Untone 8483938220
Some checks failed
CI / test (push) Failing after 21m52s
Deploy / deploy (push) Has been skipped
CI / lint (push) Successful in 22s
build-reconfig3
2025-09-02 11:04:27 +03:00

138 lines
3.7 KiB
YAML

name: CI
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build with extreme memory optimization
run: |
# Check available memory
echo "Available memory:"
free -h || echo "Memory info not available"
# Apply extreme memory optimizations for CI environment
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export CARGO_NET_RETRY=2
export CARGO_NET_TIMEOUT=30
export CARGO_HTTP_TIMEOUT=30
export RUSTC_FORCE_INCREMENTAL=0
# Extreme memory conservation
export CARGO_BUILD_JOBS=1
export CARGO_TARGET_DIR=$PWD/target
export RUSTFLAGS="-C opt-level=s -C codegen-units=1 -C panic=abort -C strip=symbols -C link-arg=-Wl,--no-keep-memory"
# Clear any existing artifacts to save space
cargo clean || true
# Try building with release profile first (may use less memory)
echo "Starting build with release optimizations..."
cargo build --verbose --release
- name: Install cargo-llvm-cov
run: |
mkdir -p $HOME/.cargo/bin
curl -LO https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
tar xf cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
chmod +x cargo-llvm-cov
mv cargo-llvm-cov $HOME/.cargo/bin/
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
rm cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
- name: Run tests
run: cargo test --verbose --tests
- name: Generate code coverage
run: |
cargo llvm-cov --lcov --output-path lcov.info
cargo llvm-cov --html
- name: Extract Coverage Percentage
id: coverage
run: |
COVERAGE=$(cargo llvm-cov --summary | grep -oP 'coverage: \K[0-9.]+%' || echo "0%")
echo "total_coverage=$COVERAGE" >> $GITHUB_OUTPUT
echo "Coverage: $COVERAGE"
- name: Upload coverage HTML
uses: actions/upload-artifact@v3
with:
name: code-coverage
path: target/llvm-cov/html
- name: Upload LCOV report
uses: actions/upload-artifact@v3
with:
name: lcov-report
path: lcov.info
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy with memory optimization
run: |
# Apply same memory optimizations for clippy
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export RUSTC_FORCE_INCREMENTAL=0
# Run clippy with our allow list for collapsible_if
cargo clippy -- -D warnings -A clippy::collapsible-if