Merge pull request #241 from datadog-labs/chore/update-dependencies #552
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] | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| name: Check & Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-check-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-check- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal --component clippy,rustfmt | |
| rustup default stable | |
| - name: Format check | |
| run: cargo fmt --check | |
| - name: Clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Build | |
| run: cargo build --release | |
| - name: Report binary size | |
| run: | | |
| ls -lh target/release/pup | |
| strip target/release/pup | |
| echo "Stripped:" | |
| ls -lh target/release/pup | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-test- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| - name: Run tests | |
| run: cargo test --verbose -- --test-threads=1 | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-cov-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-cov- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal --component llvm-tools-preview | |
| rustup default stable | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov | |
| - name: Generate coverage | |
| run: cargo llvm-cov --lcov --output-path lcov.info --ignore-filename-regex 'main\.rs|auth/' -- --test-threads=1 | |
| - name: Coverage summary | |
| run: cargo llvm-cov report --ignore-filename-regex 'main\.rs|auth/' | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| path: lcov.info | |
| cross-compile-linux: | |
| name: Cross Compile (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-cross-linux-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-cross-linux- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| rustup target add aarch64-unknown-linux-gnu | |
| - name: Install Zig | |
| run: | | |
| ZIG_VERSION="0.13.0" | |
| curl -sL "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" | tar xJ | |
| echo "$PWD/zig-linux-x86_64-${ZIG_VERSION}" >> "$GITHUB_PATH" | |
| - name: Install cargo-zigbuild | |
| run: cargo install --locked cargo-zigbuild | |
| - name: Build all targets | |
| run: | | |
| PIDS=() | |
| for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do | |
| (set -o pipefail | |
| echo "==> Starting ${target}" | |
| cargo zigbuild --release --target "${target}" --features vendored-openssl 2>&1 \ | |
| | tee "/tmp/${target}.log" | |
| ) & | |
| PIDS+=($!) | |
| done | |
| status=0 | |
| for pid in "${PIDS[@]}"; do | |
| wait "$pid" || status=1 | |
| done | |
| exit $status | |
| - name: Report sizes | |
| run: | | |
| for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do | |
| echo "${target}:" | |
| ls -lh "target/${target}/release/pup" | |
| done | |
| cross-compile-macos: | |
| name: Cross Compile (macOS) | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-cross-macos-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-cross-macos- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| rustup target add x86_64-apple-darwin aarch64-apple-darwin | |
| - name: Build all targets | |
| run: | | |
| PIDS=() | |
| for target in x86_64-apple-darwin aarch64-apple-darwin; do | |
| (set -o pipefail | |
| echo "==> Starting ${target}" | |
| cargo build --release --target "${target}" 2>&1 \ | |
| | tee "/tmp/${target}.log" | |
| ) & | |
| PIDS+=($!) | |
| done | |
| status=0 | |
| for pid in "${PIDS[@]}"; do | |
| wait "$pid" || status=1 | |
| done | |
| exit $status | |
| - name: Report sizes | |
| run: | | |
| for target in x86_64-apple-darwin aarch64-apple-darwin; do | |
| echo "${target}:" | |
| ls -lh "target/${target}/release/pup" | |
| done | |
| windows: | |
| name: Windows Build & Test | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-windows-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-windows- | |
| - name: Enable long paths | |
| run: git config --global core.longpaths true | |
| - name: Install NASM | |
| run: | | |
| choco install nasm -y | |
| echo "C:\Program Files\NASM" >> "$GITHUB_PATH" | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| - name: Build | |
| run: cargo build --release | |
| - name: Run tests | |
| run: cargo test --verbose -- --test-threads=1 | |
| - name: Report binary size | |
| run: ls -lh target/release/pup.exe | |
| wasm: | |
| name: WASM (WASI + Browser) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-wasm-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: cargo-wasm- | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| rustup target add wasm32-wasip2 wasm32-unknown-unknown | |
| - name: Build WASI | |
| run: cargo build --target wasm32-wasip2 --no-default-features --features wasi --release | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| - name: Build browser WASM | |
| run: wasm-pack build --target web --no-default-features --features browser | |
| - name: Report sizes | |
| run: | | |
| echo "WASI:" | |
| ls -lh target/wasm32-wasip2/release/pup.wasm | |
| echo "Browser WASM:" | |
| ls -lh pkg/pup_wasm_bg.wasm |