Skip to content

Commit 7b8507d

Browse files
authored
Workaround SwiftPM bug for API breakage checks (#48)
Motivation: SwiftPM has some issues with the API breakage checker when building packages which contain an executable and/or a C target. Modifications: Don't compile the C target when running the breakage checker. Result: API breakage checking works
1 parent 8a5278a commit 7b8507d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
1212
with:
1313
license_header_check_project_name: "gRPC"
14+
# This is done by a similar job defined in soundness.yml. It needs to be
15+
# separate in order to export an environment variable.
16+
api_breakage_check_enabled: false
1417

1518
grpc-soundness:
1619
name: Soundness

.github/workflows/soundness.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,28 @@ jobs:
3535
- name: Run soundness checks
3636
run: |
3737
./dev/check-generated-code.sh
38+
39+
api-breakage-check:
40+
name: API breakage check
41+
runs-on: ubuntu-latest
42+
container:
43+
image: swift:latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
with:
48+
persist-credentials: false
49+
fetch-depth: 0 # Fetching tags requires fetch-depth: 0 (https://github.com/actions/checkout/issues/1471)
50+
- name: Mark the workspace as safe
51+
# https://github.com/actions/checkout/issues/766
52+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
53+
- name: Run API breakage check
54+
shell: bash
55+
# See Package.swift in grpc-swift-protobuf for why we set GRPC_SWIFT_PROTOBUF_NO_VERSION=1
56+
run: |
57+
export GRPC_SWIFT_PROTOBUF_NO_VERSION=1
58+
59+
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
60+
BASELINE_REF='pull-base-ref'
61+
echo "Using baseline: $BASELINE_REF"
62+
swift package diagnose-api-breaking-changes "$BASELINE_REF"

0 commit comments

Comments
 (0)