@@ -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
0 commit comments