Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@ runs:
- name: Build with cross (Linux)
if: runner.os == 'Linux'
shell: bash
env:
TARGET: ${{ inputs.target }}
run: |
cargo install cross --locked
cross build --release --locked --target ${{ inputs.target }}
cross build --release --locked --target "$TARGET"

- name: Build natively (macOS/Windows)
if: runner.os != 'Linux'
shell: bash
run: cargo build --release --locked --target ${{ inputs.target }}
env:
TARGET: ${{ inputs.target }}
run: cargo build --release --locked --target "$TARGET"

- name: Final path
id: get_binary_path
shell: bash
env:
TARGET: ${{ inputs.target }}
run: |
binary=yek
[ "${{ runner.os }}" = "Windows" ] && binary=yek.exe
echo "path=target/${{ inputs.target }}/release/$binary" >> "$GITHUB_OUTPUT"
[ "$RUNNER_OS" = "Windows" ] && binary=yek.exe
echo "path=target/$TARGET/release/$binary" >> "$GITHUB_OUTPUT"
26 changes: 17 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,18 @@ jobs:
- uses: dtolnay/rust-toolchain@stable

- name: Run benchmarks
env:
BASE_REF: ${{ github.base_ref }}
run: |
git fetch origin ${{ github.base_ref }}
git checkout ${{ github.base_ref }}
git fetch origin "$BASE_REF"
git checkout "$BASE_REF"
cargo bench --bench serialization --no-run
cargo bench --bench serialization -- --save-baseline ${{ github.base_ref }} '${{ matrix.benchmark_group.group }}/'
cargo bench --bench serialization -- --save-baseline "$BASE_REF" '${{ matrix.benchmark_group.group }}/'

git checkout ${{ github.head_ref }}
# Back to the commit actions/checkout fetched; a fork's branch is not on origin.
git checkout "$GITHUB_SHA"
cargo bench --bench serialization --no-run
cargo bench --bench serialization -- --baseline ${{ github.base_ref }} --noise-threshold 2 '${{ matrix.benchmark_group.group }}/' > benchmark_results.md
cargo bench --bench serialization -- --baseline "$BASE_REF" --noise-threshold 2 '${{ matrix.benchmark_group.group }}/' > benchmark_results.md
echo "## Benchmark Results for ${{ matrix.benchmark_group.name }}" >> $GITHUB_STEP_SUMMARY
cat benchmark_results.md >> $GITHUB_STEP_SUMMARY

Expand Down Expand Up @@ -260,9 +263,11 @@ jobs:
# --- Base Branch Coverage ---
- name: Fetch and check out base branch
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
git fetch origin ${{ github.base_ref }}
git checkout ${{ github.base_ref }}
git fetch origin "$BASE_REF"
git checkout "$BASE_REF"

- name: Build + Test coverage on base
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -294,7 +299,8 @@ jobs:
- name: Check out head branch (PR)
if: github.event_name == 'pull_request'
run: |
git checkout ${{ github.head_ref }}
# Back to the commit actions/checkout fetched; a fork's branch is not on origin.
git checkout "$GITHUB_SHA"

- name: Build + Test coverage on PR
run: |
Expand Down Expand Up @@ -323,6 +329,8 @@ jobs:

- name: Compare coverage
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
run: |
# Check if base coverage file exists
if [ ! -f coverage-base/coverage.json ]; then
Expand All @@ -341,7 +349,7 @@ jobs:
# Compare and fail if coverage decreased
check=$(awk -v base="$BASE_COV" -v pr="$PR_COV" 'BEGIN { if (pr < base) print 1; else print 0; }')
if [ "$check" -eq 1 ]; then
git diff --unified=0 origin/${{ github.base_ref }}...HEAD -- 'src/*.rs' \
git diff --unified=0 "origin/$BASE_REF...HEAD" -- 'src/*.rs' \
| awk '
/^\+\+\+ b\/src\// { file = substr($0, 11); next }
/^@@/ {
Expand Down
Loading