Merge pull request #13 from u5surf/cleanup/remove-unused-functions #106
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: | |
| - stable | |
| #- beta | |
| #- nightly | |
| nginx: | |
| - "1.28.0" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/cache | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-${{ matrix.rust }}- | |
| ${{ runner.os }}-cargo- | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libpcre3-dev zlib1g-dev libssl-dev | |
| - name: Download and build Nginx | |
| run: | | |
| wget http://nginx.org/download/nginx-${{ matrix.nginx }}.tar.gz | |
| tar -xzf nginx-${{ matrix.nginx }}.tar.gz | |
| cd nginx-${{ matrix.nginx }} | |
| ./configure \ | |
| --prefix=/tmp/nginx \ | |
| --with-compat \ | |
| --with-file-aio \ | |
| --with-http_addition_module \ | |
| --with-http_auth_request_module \ | |
| --with-http_dav_module \ | |
| --with-http_flv_module \ | |
| --with-http_gunzip_module \ | |
| --with-http_gzip_static_module \ | |
| --with-http_mp4_module \ | |
| --with-http_random_index_module \ | |
| --with-http_realip_module \ | |
| --with-http_secure_link_module \ | |
| --with-http_slice_module \ | |
| --with-http_ssl_module \ | |
| --with-http_stub_status_module \ | |
| --with-http_sub_module \ | |
| --with-http_v2_module \ | |
| --with-stream \ | |
| --with-stream_realip_module \ | |
| --with-stream_ssl_module \ | |
| --with-stream_ssl_preread_module \ | |
| --with-threads | |
| make -j$(nproc) | |
| sudo make install | |
| echo "NGX_VERSION=${{ matrix.nginx }}" >> $GITHUB_ENV | |
| echo "NGX_PATH=$(pwd)" >> $GITHUB_ENV | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-${{ matrix.nginx }} | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-${{ matrix.nginx }} | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-${{ matrix.nginx }} | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-${{ matrix.nginx }} | |
| cargo build --verbose | |
| - name: Run tests with nginx environment | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-${{ matrix.nginx }} | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-${{ matrix.nginx }} | |
| cargo test --lib --verbose | |
| - name: Build release | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-${{ matrix.nginx }} | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-${{ matrix.nginx }} | |
| cargo build --release --verbose | |
| security: | |
| name: Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: Run security audit | |
| run: cargo audit | |
| msrv: | |
| name: Minimum Supported Rust Version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust 1.82 | |
| uses: dtolnay/rust-toolchain@1.82.0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libpcre3-dev zlib1g-dev libssl-dev | |
| - name: Download and build Nginx | |
| run: | | |
| wget http://nginx.org/download/nginx-1.24.0.tar.gz | |
| tar -xzf nginx-1.24.0.tar.gz | |
| cd nginx-1.24.0 | |
| ./configure --prefix=/tmp/nginx --with-compat | |
| make -j$(nproc) | |
| sudo make install | |
| echo "NGX_VERSION=1.24.0" >> $GITHUB_ENV | |
| - name: Check build with MSRV | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-1.24.0 | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-1.24.0 | |
| cargo build --verbose | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libpcre3-dev zlib1g-dev libssl-dev | |
| - name: Download and build Nginx | |
| run: | | |
| wget http://nginx.org/download/nginx-1.24.0.tar.gz | |
| tar -xzf nginx-1.24.0.tar.gz | |
| cd nginx-1.24.0 | |
| ./configure --prefix=/tmp/nginx --with-compat | |
| make -j$(nproc) | |
| sudo make install | |
| echo "NGX_VERSION=1.24.0" >> $GITHUB_ENV | |
| - name: Build documentation | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-1.24.0 | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-1.24.0 | |
| cargo doc --no-deps --document-private-items | |
| - name: Check for documentation warnings | |
| run: | | |
| export NGX_PATH=$(pwd)/nginx-1.24.0 | |
| export NGINX_SOURCE_DIR=$(pwd)/nginx-1.24.0 | |
| # Build docs and check for warnings, but don't fail on warnings for now | |
| cargo doc --no-deps 2>&1 | tee doc-output.log | |
| if grep -q "warning:" doc-output.log; then | |
| echo "Documentation warnings found:" | |
| grep "warning:" doc-output.log | |
| echo "Continuing build despite warnings..." | |
| fi |