@@ -9,14 +9,72 @@ concurrency:
99 cancel-in-progress : true
1010
1111jobs :
12- tests :
13- name : Test
14- uses : swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
15- with :
16- linux_exclude_swift_versions : " [{\" swift_version\" : \" 5.8\" }]"
17- soundness :
18- name : Soundness
19- uses : swiftlang/github-workflows/.github/workflows/soundness.yml@main
20- with :
21- license_header_check_project_name : " Swift.org"
22- api_breakage_check_allowlist_path : " api-breakages.txt"
12+ # tests:
13+ # name: Test
14+ # uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
15+ # with:
16+ # linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
17+ # soundness:
18+ # name: Soundness
19+ # uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
20+ # with:
21+ # license_header_check_project_name: "Swift.org"
22+ # api_breakage_check_allowlist_path: "api-breakages.txt"
23+ performance_test :
24+ name : Performance test
25+ runs-on : ubuntu-latest
26+ container :
27+ image : swift:latest
28+ permissions :
29+ pull-requests : write
30+ steps :
31+ - name : Install libjemalloc-dev
32+ run : apt-get update && apt-get install -y libjemalloc-dev
33+ - name : Checkout repository
34+ uses : actions/checkout@v4
35+ with :
36+ fetch-depth : 0
37+ - name : Mark the workspace as safe
38+ # https://github.com/actions/checkout/issues/766
39+ run : git config --global --add safe.directory ${GITHUB_WORKSPACE}
40+ - name : Measure PR performance
41+ run : |
42+ swift package --package-path Benchmarks/ --allow-writing-to-directory Benchmarks/.benchmarkBaselines/ benchmark baseline update "${{ github.head_ref }}"
43+ - name : Measure base branch performance
44+ run : |
45+ git checkout ${{ github.base_ref }}
46+ swift package --package-path Benchmarks/ --allow-writing-to-directory Benchmarks/.benchmarkBaselines/ benchmark baseline update "${{ github.base_ref }}"
47+ - name : Compare performance measurements
48+ id : compare_performance
49+ run : |
50+ find Benchmarks
51+ if ! swift package --package-path Benchmarks benchmark baseline check "${{ github.base_ref }}" "${{ github.head_ref }}" --quiet --format markdown > /tmp/comparison.md; then
52+ echo "has_significant_changes=true" >> "$GITHUB_OUTPUT"
53+ else
54+ echo "has_significant_changes=false" >> "$GITHUB_OUTPUT"
55+ fi
56+ - name : Install gh
57+ if : ${{ steps.compare_performance.outputs.has_significant_changes == 'true' }}
58+ # Installation instructions from https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
59+ run : |
60+ (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
61+ && mkdir -p -m 755 /etc/apt/keyrings \
62+ && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
63+ && cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
64+ && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
65+ && 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 \
66+ && apt update \
67+ && apt install gh -y
68+ - name : Post comment
69+ if : ${{ steps.compare_performance.outputs.has_significant_changes == 'true' }}
70+ env :
71+ GH_TOKEN : ${{ github.token }}
72+ run : |
73+ cat > /tmp/performance_change_header.md <<END_OF_COMMENT
74+ This PR has changed performance characteristics. Please review that the measurements reported below are expected. If these are improvements, thanks for improving the performance.
75+
76+
77+ END_OF_COMMENT
78+ COMMENT="$(cat /tmp/performance_change_header.md /tmp/comparison.md)"
79+ gh pr comment ${{ github.event.number }} --body "$COMMENT"
80+
0 commit comments