Tailor CI for Tuwunel. #60
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: RocksDB CI | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| TUWUNEL_FEATURES: bindgen-runtime,bzip2,io-uring,jemalloc,lto,lz4,multi-threaded-cf,serde1,zstd,zstd-static-linking-only | |
| jobs: | |
| style: | |
| name: Rustfmt | |
| runs-on: ${{ vars.CI_RUNNER_X64 || 'het' }} | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| with: | |
| toolchain: stable | |
| components: rustfmt | |
| cache: false | |
| rustflags: "" | |
| - name: Run rustfmt | |
| run: cargo fmt --all -- --check | |
| consumer: | |
| name: Tuwunel consumer (${{ matrix.arch }}) | |
| needs: style | |
| runs-on: >- | |
| ${{ matrix.arch == 'arm64' | |
| && (vars.CI_RUNNER_ARM64 || 'aws') | |
| || (vars.CI_RUNNER_X64 || 'het') }} | |
| container: ubuntu:26.04 | |
| timeout-minutes: 90 | |
| env: | |
| CARGO_BUILD_JOBS: ${{ matrix.cargo_jobs }} | |
| CC: clang | |
| CXX: clang++ | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 2 | |
| matrix: | |
| include: | |
| - arch: x64 | |
| cargo_jobs: 8 | |
| expected_uname: x86_64 | |
| - arch: arm64 | |
| cargo_jobs: 4 | |
| expected_uname: aarch64 | |
| steps: | |
| - name: Bootstrap container | |
| run: | | |
| apt-get update | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | |
| build-essential ca-certificates clang curl git libclang-dev \ | |
| liburing-dev llvm-dev pkg-config zstd | |
| - name: Checkout sources | |
| uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 | |
| with: | |
| persist-credentials: false | |
| submodules: recursive | |
| - name: Verify runner architecture | |
| run: test "$(uname -m)" = "${{ matrix.expected_uname }}" | |
| - name: Verify runner dependencies | |
| run: | | |
| command -v clang | |
| test -e "$(llvm-config --libdir)/libclang.so" | |
| test -e "$(llvm-config --libdir)/LLVMgold.so" | |
| pkg-config --exists liburing | |
| - name: Install rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| cache-key: v1-tuwunel-${{ matrix.arch }} | |
| cache-bin: false | |
| cache-on-failure: false | |
| cache-save-if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} | |
| cache-targets: false | |
| rustflags: "-D warnings -Clinker=clang -Clink-arg=-flto -Ctarget-cpu=native" | |
| - name: Run Clippy | |
| if: matrix.arch == 'x64' | |
| run: | | |
| cargo clippy --locked --no-default-features \ | |
| --features "$TUWUNEL_FEATURES" --all-targets -- -D warnings | |
| - name: Build documentation | |
| if: matrix.arch == 'x64' | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| run: | | |
| cargo doc --locked --no-deps --no-default-features \ | |
| --features "$TUWUNEL_FEATURES" | |
| - name: Run tests | |
| run: | | |
| cargo test --locked --release --no-default-features \ | |
| --features "$TUWUNEL_FEATURES" --lib --bins --tests \ | |
| --jobs "${{ matrix.cargo_jobs }}" | |
| - name: Run doctests | |
| if: matrix.arch == 'x64' | |
| env: | |
| RUSTDOCFLAGS: >- | |
| -D warnings -Clinker=clang -Clink-arg=-flto -Ctarget-cpu=native | |
| run: | | |
| cargo test --locked --release --no-default-features \ | |
| --features "$TUWUNEL_FEATURES" --doc | |
| - name: Clean self-hosted build artifacts | |
| if: always() | |
| run: | | |
| if command -v cargo >/dev/null && test -f Cargo.toml; then | |
| cargo clean | |
| fi |