feat: delegate vendoring of OpenSSL to git2 dependency tree #153
Workflow file for this run
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: Benchmark | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - cpp-linter/src/** | |
| - cpp-linter/Cargo.toml | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .github/workflows/benchmark.yml | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - cpp-linter/src/** | |
| - cpp-linter/Cargo.toml | |
| - Cargo.toml | |
| - Cargo.lock | |
| - .github/workflows/benchmark.yml | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build-bin: | |
| name: Build ${{ matrix.name }} binary | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - commit: ${{ github.sha }} | |
| name: current | |
| - commit: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} | |
| name: previous | |
| env: | |
| BIN: target/release/cpp-linter | |
| steps: | |
| - name: Checkout ${{ matrix.name }} | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ matrix.commit }} | |
| persist-credentials: false | |
| - name: Cache base ref build | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| key: bin-cache-${{ hashFiles('cpp-linter/src/**', 'Cargo.toml', 'Cargo.lock', 'cpp-linter/Cargo.toml') }} | |
| path: ${{ env.BIN }} | |
| - name: Validate cached binary | |
| if: steps.cache.outputs.cache-hit == 'true' | |
| id: validate | |
| run: | | |
| chmod +x ${{ env.BIN }} | |
| if ! ${{ env.BIN }} version; then | |
| echo "Cached binary is invalid, rebuilding..." | |
| echo "cache-valid=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - run: rustup update --no-self-update | |
| if: steps.cache.outputs.cache-hit != 'true' || steps.validate.outputs.cache-valid == 'false' | |
| - run: cargo build --bin cpp-linter --release | |
| if: steps.cache.outputs.cache-hit != 'true' || steps.validate.outputs.cache-valid == 'false' | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: ${{ env.BIN }} | |
| build-py-binding: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| id: setup-python | |
| with: | |
| python-version: '3.x' | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4 | |
| with: | |
| target: x86_64 | |
| args: --release --out dist --find-interpreter | |
| manylinux: auto | |
| before-script-linux: | | |
| # NOTE: rust-cross/manylinux docker images are CentOS based | |
| yum update -y | |
| yum install -y openssl openssl-devel | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/* | |
| benchmark: | |
| name: Measure Performance Difference | |
| needs: [build-bin, build-py-binding] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Checkout libgit2 | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: libgit2/libgit2 | |
| ref: v1.8.1 | |
| path: benchmark/libgit2 | |
| persist-credentials: false | |
| - name: Download built binaries | |
| uses: actions/download-artifact@v5 | |
| - name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@a66119fbb1c952daba62640c2609111fe0803621 # v1.15.7 | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Install hyperfine | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: cargo binstall -y hyperfine | |
| - name: Install nushell | |
| uses: hustcer/setup-nu@985d59ec83ae3e3418f9d36471cda38b9d8b9879 # v3.20 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 | |
| - name: Run benchmark script | |
| working-directory: benchmark | |
| shell: nu {0} | |
| run: |- | |
| let new_py = ( | |
| glob "../wheel/cpp_linter-*.whl" | |
| | first | |
| | path expand | |
| ) | |
| let prev_bin = "../previous/cpp-linter" | path expand | |
| let curr_bin = "../current/cpp-linter" | path expand | |
| nu benchmark.nu --new-py $new_py --rust-bin $curr_bin --prev-rust-bin $prev_bin |