Skip to content

Commit b2a073d

Browse files
Merge pull request #3 from gojekfarm/task/update-to-latest-swiftprotobuf-version
Task/update to latest swiftprotobuf version
2 parents 6a0a361 + fe8e25b commit b2a073d

File tree

686 files changed

+248815
-127835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

686 files changed

+248815
-127835
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.git-blame-ignore-revs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore the commit where all the sources were reformatted with no other changes.
2+
ac8da77c937f3c98c3959f72e76184b6b577cf38
3+
# Ignore some followup commits for things swift-format lint reported.
4+
e1c4ca3714b1d423b2257a4f4050b73d7a46f04d
5+
10ed2c6e30d5ea7982590f6424e161386bfc444d

.github/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- ⚠️ semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- 🆕 semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- 🔨 semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none

.github/workflows/build.yml

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,34 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
# Looking at https://hub.docker.com/_/swift, the version only tags (i.e.
19-
# - 5.6.3) use different Ubuntu releases. Generally we want to avoid
20-
# bionic as it is older then we want to deal with having to build
21-
# protobuf on.
19+
# - 5.9.2) can use different Ubuntu releases. But just to be safe we use
20+
# the specific OS release.
2221
#
23-
# We also could use less specific tags (i.e. - 5.6), so they "float" as
22+
# We could use less specific tags (i.e. - 5.9), so they "float" as
2423
# new point release come, but to help make history/logs more clear,
2524
# being explicit (at the cost of having to update with point releases)
2625
# seems better. This should also ensure protobuf caching changes with
2726
# each new image incase system in the Swift image are changed/updated.
2827
swift:
29-
- 5.8.0-jammy
30-
- 5.7.2-jammy
31-
- 5.6.3-focal
32-
- 5.5.3-focal
33-
- 5.4.3-focal
28+
- version: 6.1.0-noble
29+
hook: "SWIFT_BUILD_TEST_HOOK=\"-Xswiftc -warnings-as-errors\""
30+
- version: 6.0.3-noble
31+
hook: "SWIFT_BUILD_TEST_HOOK=\"-Xswiftc -warnings-as-errors\""
32+
- version: 5.10.1-noble
33+
# No "hook", see https://github.com/apple/swift-protobuf/issues/1560 for the
34+
# current issue with using -warnings-as-errors on linux.
3435
# protobuf_git can reference a commit, tag, or branch
3536
# commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
3637
# tag: "ref/tags/v3.11.4"
3738
# branch: "ref/heads/main"
3839
protobuf_git: ["ref/heads/main"]
39-
# We are not testing the SPM plugins on Swift version that don't support SPM plugins
40-
include:
41-
- swift: 5.8.0-jammy
42-
test_spm_plugin: true
43-
- swift: 5.7.2-jammy
44-
test_spm_plugin: true
45-
- swift: 5.6.3-focal
46-
test_spm_plugin: true
47-
- swift: 5.5.3-focal
48-
test_spm_plugin: false
49-
- swift: 5.4.3-focal
50-
test_spm_plugin: false
5140
container:
52-
image: swift:${{ matrix.swift }}
41+
image: swift:${{ matrix.swift.version }}
5342
steps:
5443
- name: Checkout
55-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
5645
with:
57-
path: main
46+
path: swift-protobuf
5847
- name: Update and install dependencies
5948
# dependencies from https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
6049
# this step is run before get-sha because we need curl and jq for get-sha
@@ -73,21 +62,21 @@ jobs:
7362
;;
7463
esac
7564
- name: Build
76-
working-directory: main
77-
run: make build
65+
working-directory: swift-protobuf
66+
run: make build ${{ matrix.swift.hook }}
7867
- name: Test runtime
79-
working-directory: main
80-
run: make test-runtime
68+
working-directory: swift-protobuf
69+
run: make test-runtime ${{ matrix.swift.hook }}
8170
- name: Cache protobuf
8271
id: cache-protobuf
83-
uses: actions/cache@v3
72+
uses: actions/cache@v4
8473
with:
8574
path: protobuf
8675
# NOTE: for refs that can float like 'main' the cache might be out of date!
87-
key: ${{ runner.os }}-${{ matrix.swift}}-protobuf-${{ steps.get-sha.outputs.sha }}
76+
key: ${{ runner.os }}-${{ matrix.swift.version}}-protobuf-${{ steps.get-sha.outputs.sha }}
8877
- name: Checkout protobuf repo
8978
if: steps.cache-protobuf.outputs.cache-hit != 'true'
90-
uses: actions/checkout@v3
79+
uses: actions/checkout@v4
9180
with:
9281
repository: protocolbuffers/protobuf
9382
ref: ${{ steps.get-sha.outputs.sha }}
@@ -96,10 +85,12 @@ jobs:
9685
- name: Build protobuf
9786
if: steps.cache-protobuf.outputs.cache-hit != 'true'
9887
working-directory: protobuf
88+
# https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md#c-version
9989
run: |
10090
mkdir cmake_build
10191
cd cmake_build
10292
cmake \
93+
-DCMAKE_CXX_STANDARD=17 \
10394
-DCMAKE_BUILD_TYPE=Release \
10495
-Dprotobuf_BUILD_TESTS=OFF \
10596
-Dprotobuf_INSTALL=OFF \
@@ -108,15 +99,64 @@ jobs:
10899
NUM_CPUS=$(getconf _NPROCESSORS_ONLN)
109100
make -j "${NUM_CPUS}" protoc conformance_test_runner
110101
- name: Test plugin
111-
working-directory: main
102+
working-directory: swift-protobuf
112103
run: make test-plugin PROTOC=../protobuf/cmake_build/protoc
113104
- name: Test conformance
114-
working-directory: main
105+
working-directory: swift-protobuf
115106
run: make test-conformance CONFORMANCE_TEST_RUNNER=../protobuf/cmake_build/conformance_test_runner
116107
- name: Test SPM plugin
117-
if: ${{ matrix.test_spm_plugin }}
118-
working-directory: main
108+
working-directory: swift-protobuf
119109
run: make test-spm-plugin PROTOC=../protobuf/cmake_build/protoc
110+
- name: Compilation Tests
111+
working-directory: swift-protobuf
112+
run: make compile-tests PROTOC=../protobuf/cmake_build/protoc
113+
114+
api-breakage:
115+
name: Api Breakage Compared to main branch
116+
# Only on pull requests
117+
if: github.event_name == 'pull_request'
118+
runs-on: ubuntu-latest
119+
container:
120+
# Test on the latest Swift release. This could run on all the support
121+
# Swift versions, but that doesn't seem worth it until there are Swift
122+
# version specific conditionals to justify it.
123+
image: swift:latest
124+
steps:
125+
- name: Checkout
126+
uses: actions/checkout@v4
127+
with:
128+
fetch-depth: 0
129+
- name: Mark the workspace as safe
130+
# https://github.com/actions/checkout/issues/766
131+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
132+
- name: Check for API breaking changes
133+
run: swift package diagnose-api-breaking-changes origin/main
134+
135+
format-check:
136+
name: swift-format Check
137+
# Only on pull requests
138+
if: github.event_name == 'pull_request'
139+
runs-on: ubuntu-latest
140+
container:
141+
# Use use the latest Swift release and that's the version of swift-format
142+
# people should use.
143+
image: swift:latest
144+
steps:
145+
- name: Checkout
146+
uses: actions/checkout@v4
147+
- name: Mark the workspace as safe
148+
# https://github.com/actions/checkout/issues/766
149+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
150+
- name: Run format check
151+
run: |
152+
set -eu
153+
git ls-files -z '*.swift' | xargs -0 swift format format --parallel --in-place
154+
GIT_PAGER='' git diff --exit-code '*.swift'
155+
# Disabled as it produces multiple warnings at the moment.
156+
# - name: Run format lint check
157+
# run: |
158+
# set -eu
159+
# git ls-files -z '*.swift' | xargs -0 swift format lint --strict --parallel
120160

121161
sanitizer_testing:
122162
runs-on: ubuntu-latest
@@ -129,7 +169,7 @@ jobs:
129169
# Test on the latest Swift release.
130170
image: swift:latest
131171
steps:
132-
- uses: actions/checkout@v3
172+
- uses: actions/checkout@v4
133173
- name: Test
134174
run: |
135175
set -eu
@@ -158,6 +198,6 @@ jobs:
158198
# Test on the latest Swift release.
159199
image: swift:latest
160200
steps:
161-
- uses: actions/checkout@v3
201+
- uses: actions/checkout@v4
162202
- name: Build
163203
run: FuzzTesting/do_build.sh --${{ matrix.swiftpm_config }}-only --run-regressions

.github/workflows/check_upstream_protos.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
17-
path: main
17+
path: swift-protobuf
1818
- name: Checkout protobufbuffers/protobuf
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020
with:
2121
repository: protocolbuffers/protobuf
2222
path: protobuf
2323
- name: Check Upstream Proto Files
24-
working-directory: main
24+
working-directory: swift-protobuf
2525
run: make check-proto-files
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, reopened, synchronize]
6+
7+
jobs:
8+
semver-label-check:
9+
name: Semantic version label check
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Check for Semantic Version label
18+
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

.github/workflows/regular_conformance.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,16 @@ jobs:
2626
strategy:
2727
matrix:
2828
# Looking at https://hub.docker.com/_/swift, the version only tags (i.e.
29-
# - 5.6.3) use different Ubuntu releases. Generally we want to avoid
30-
# bionic as it is older then we want to deal with having to build
31-
# protobuf on.
29+
# - 5.9.2) can use different Ubuntu releases. But just to be safe we use
30+
# the specific OS release.
3231
#
33-
# We also could use less specific tags (i.e. - 5.6), so they "float" as
32+
# We could use less specific tags (i.e. - 5.9), so they "float" as
3433
# new point release come, but to help make history/logs more clear,
3534
# being explicit (at the cost of having to update with point releases)
3635
# seems better. This should also ensure protobuf caching changes with
3736
# each new image incase system in the Swift image are changed/updated.
3837
swift:
39-
- 5.8.0-jammy
38+
- 6.1.0-noble
4039
# protobuf_git can reference a commit, tag, or branch
4140
# commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
4241
# tag: "ref/tags/v3.11.4"
@@ -46,9 +45,9 @@ jobs:
4645
image: swift:${{ matrix.swift }}
4746
steps:
4847
- name: Checkout
49-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
5049
with:
51-
path: main
50+
path: swift-protobuf
5251
- name: Update and install dependencies
5352
# dependencies from https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
5453
# this step is run before get-sha because we need curl and jq for get-sha
@@ -68,14 +67,14 @@ jobs:
6867
esac
6968
- name: Cache protobuf
7069
id: cache-protobuf
71-
uses: actions/cache@v3
70+
uses: actions/cache@v4
7271
with:
7372
path: protobuf
7473
# NOTE: for refs that can float like 'main' the cache might be out of date!
75-
key: ${{ runner.os }}-${{ matrix.swift}}-protobuf-${{ steps.get-sha.outputs.sha }}
74+
key: ${{ runner.os }}-${{ matrix.swift }}-protobuf-${{ steps.get-sha.outputs.sha }}
7675
- name: Checkout protobuf repo
7776
if: steps.cache-protobuf.outputs.cache-hit != 'true'
78-
uses: actions/checkout@v3
77+
uses: actions/checkout@v4
7978
with:
8079
repository: protocolbuffers/protobuf
8180
ref: ${{ steps.get-sha.outputs.sha }}
@@ -84,10 +83,12 @@ jobs:
8483
- name: Build protobuf
8584
if: steps.cache-protobuf.outputs.cache-hit != 'true'
8685
working-directory: protobuf
86+
# https://github.com/protocolbuffers/protobuf/blob/main/cmake/README.md#c-version
8787
run: |
8888
mkdir cmake_build
8989
cd cmake_build
9090
cmake \
91+
-DCMAKE_CXX_STANDARD=17 \
9192
-DCMAKE_BUILD_TYPE=Release \
9293
-Dprotobuf_BUILD_TESTS=OFF \
9394
-Dprotobuf_INSTALL=OFF \
@@ -96,5 +97,5 @@ jobs:
9697
NUM_CPUS=$(getconf _NPROCESSORS_ONLN)
9798
make -j "${NUM_CPUS}" protoc conformance_test_runner
9899
- name: Test conformance
99-
working-directory: main
100+
working-directory: swift-protobuf
100101
run: make test-conformance CONFORMANCE_TEST_RUNNER=../protobuf/cmake_build/conformance_test_runner

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ xcbaselines
99
/docs
1010
/build
1111
mined_words.txt
12+
/CompileTests/MultiModule/.build
13+
/CompileTests/MultiModule/.swiftpm
14+
/CompileTests/InternalImportsByDefault/.build
15+
/CompileTests/InternalImportsByDefault/.swiftpm
1216
/*DescriptorTestData.bin
1317
/Package.resolved
18+
/PluginLibEditionDefaults.bin
19+
/PluginLibTestingEditionDefaults.bin
1420

1521
# Intermediate conformance test outputs
1622
failing_tests.txt
1723
nonexistent_tests.txt
24+
succeeding_tests.txt
25+
1826
PluginExamples/.build
1927
PluginExamples/.swiftpm/

0 commit comments

Comments
 (0)