Skip to content

Missing dependency #401

Missing dependency

Missing dependency #401

Workflow file for this run

name: Pull request
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# tests:
# name: Test
# uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
# with:
# linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
# soundness:
# name: Soundness
# uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
# with:
# license_header_check_project_name: "Swift.org"
# api_breakage_check_allowlist_path: "api-breakages.txt"
performance_test:
name: Performance test
runs-on: ubuntu-latest
container:
image: swift:latest
permissions:
pull-requests: write
steps:
- name: Install libjemalloc-dev
run: apt-get update && apt-get install -y libjemalloc-dev
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Measure PR performance
run: |
swift package --package-path Benchmarks/ --allow-writing-to-directory Benchmarks/.benchmarkBaselines/ benchmark baseline update "${{ github.head_ref }}"
- name: Measure base branch performance
run: |
git checkout ${{ github.base_ref }}
swift package --package-path Benchmarks/ --allow-writing-to-directory Benchmarks/.benchmarkBaselines/ benchmark baseline update "${{ github.base_ref }}"
- name: Compare performance measurements
id: compare_performance
run: |
find Benchmarks
if ! swift package --package-path Benchmarks benchmark baseline check "${{ github.base_ref }}" "${{ github.head_ref }}" --quiet --format markdown > /tmp/comparison.md; then
echo "has_significant_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_significant_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Install gh
if: ${{ steps.compare_performance.outputs.has_significant_changes == 'true' }}
# Installation instructions from https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
run: |
(type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
&& mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt update \
&& apt install gh -y
- name: Post comment
if: ${{ steps.compare_performance.outputs.has_significant_changes == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
cat > /tmp/performance_change_header.md <<END_OF_COMMENT
This PR has changed performance characteristics. Please review that the measurements reported below are expected. If these are improvements, thanks for improving the performance.
END_OF_COMMENT
COMMENT="$(cat /tmp/performance_change_header.md /tmp/comparison.md)"
gh pr comment ${{ github.event.number }} --body "$COMMENT"