1- # Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
2- #
3- # Licensed under the Apache License, Version 2.0 (the "License");
4- # you may not use this file except in compliance with the License.
5- # You may obtain a copy of the License at
6- #
7- # http://www.apache.org/licenses/LICENSE-2.0
8- #
9- # Unless required by applicable law or agreed to in writing, software
10- # distributed under the License is distributed on an "AS IS" BASIS,
11- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12- # See the License for the specific language governing permissions and
13- # limitations under the License.
14-
151name : CI
162permissions :
173 contents : read
184on :
195 workflow_dispatch :
206 push :
21- branches : [ "main", "release/**" ]
7+ branches : ["main", "release/**"]
228 pull_request :
23- branches : [ "main", "release/**" ]
9+ branches : ["main", "release/**"]
2410 types : [opened, reopened, synchronize]
2511# Pushing changes to PR stops currently-running CI
2612concurrency :
3218 SWIFTFORMAT_VERSION : 0.54.6
3319 SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_BENCHMARKING : 1
3420jobs :
35- swift-tests :
36- timeout-minutes : 15
37- runs-on : ubuntu-latest
38- strategy :
39- fail-fast : false
40- matrix :
41- swift_version : ['6.0']
42- os_version : ['jammy']
43- container :
44- image : swift:${{ matrix.swift_version }}-${{ matrix.os_version }}
45- name : swift ${{ matrix.swift_version }} tests
46- steps :
47- - name : Swift version
48- run : swift --version
49- - name : Checkout repository
50- uses : actions/checkout@v4
51- - name : Install jemalloc
52- run : apt-get update && apt-get install -y libjemalloc-dev
53- - name : Run tests
54- run : swift test --configuration release --parallel
55- - name : Run snippets
56- run : >
21+ soundness :
22+ name : soundness
23+ uses : swiftlang/github-workflows/.github/workflows/soundness.yml@main
24+ with :
25+ # https://github.com/swiftlang/swift-package-manager/issues/8103
26+ api_breakage_check_enabled : false
27+ format_check_enabled : false
28+ tests :
29+ name : swifttests
30+ uses : swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
31+ with :
32+ enable_windows_checks : false
33+ # TODO: remove 5.8 after https://github.com/swiftlang/github-workflows/pull/107
34+ linux_exclude_swift_versions : " [{\" swift_version\" : \" 5.8\" }, {\" swift_version\" : \" 5.9\" }, {\" swift_version\" : \" 5.10\" }]"
35+ linux_pre_build_command : " apt-get update && apt-get install -y libjemalloc-dev"
36+ linux_build_command : >
37+ swift test --configuration release;
5738 for filename in $(find Snippets -name \*.swift); do
5839 basename=$(basename "$filename" .swift)
5940 swift run --configuration release ${basename}
@@ -62,71 +43,71 @@ jobs:
6243 timeout-minutes : 1
6344 runs-on : ubuntu-22.04
6445 steps :
65- - name : Checkout repository
66- uses : actions/checkout@v4
67- - name : Install pre-commit
68- run : pip install pre-commit
69- - name : Pre-commit checks
70- # CI will commit to `main`
71- # swiftformat, swiftlint and license checks tested separately
72- run : >
73- SKIP=no-commit-to-branch,lockwood-swiftformat,swiftlint,check-doc-comments,insert-license
74- pre-commit run --all-files
46+ - name : Checkout repository
47+ uses : actions/checkout@v4
48+ - name : Install pre-commit
49+ run : pip install pre-commit
50+ - name : Pre-commit checks
51+ # CI will commit to `main`
52+ # swiftformat, swiftlint and license checks tested separately
53+ run : >
54+ SKIP=no-commit-to-branch,lockwood-swiftformat,swiftlint,check-doc-comments,insert-license
55+ pre-commit run --all-files
7556 insert-license :
7657 timeout-minutes : 1
7758 runs-on : ubuntu-22.04
7859 steps :
79- - name : Checkout repository
80- uses : actions/checkout@v4
81- with :
82- fetch-depth : 2
83- - name : Install pre-commit
84- run : pip install pre-commit
85- - name : List changed files
86- run : git diff --name-only HEAD~1
87- - name : Run license check
88- run : pre-commit run insert-license --files $(git diff --name-only HEAD~1)
60+ - name : Checkout repository
61+ uses : actions/checkout@v4
62+ with :
63+ fetch-depth : 2
64+ - name : Install pre-commit
65+ run : pip install pre-commit
66+ - name : List changed files
67+ run : git diff --name-only HEAD~1
68+ - name : Run license check
69+ run : pre-commit run insert-license --files $(git diff --name-only HEAD~1)
8970 lint :
9071 timeout-minutes : 15
9172 runs-on : ubuntu-22.04
9273 steps :
93- - name : Checkout repository
94- uses : actions/checkout@v4
95- - name : Cache SwiftLint
96- id : cache-swiftlint
97- uses : actions/cache@v4
98- with :
99- path : /tmp/swiftlint/SwiftLint/.build/release/swiftlint
100- key : ${{ runner.os }}-swiftlint-${{ env.SWIFTLINT_VERSION }}
101- - name : Install SwiftLint
102- if : steps.cache-swiftlint.outputs.cache-hit != 'true'
103- run : |
104- ci/install-swiftlint.sh
105- - name : Run SwiftLint
106- run : /tmp/swiftlint/SwiftLint/.build/release/swiftlint lint --strict .
74+ - name : Checkout repository
75+ uses : actions/checkout@v4
76+ - name : Cache SwiftLint
77+ id : cache-swiftlint
78+ uses : actions/cache@v4
79+ with :
80+ path : /tmp/swiftlint/SwiftLint/.build/release/swiftlint
81+ key : ${{ runner.os }}-swiftlint-${{ env.SWIFTLINT_VERSION }}
82+ - name : Install SwiftLint
83+ if : steps.cache-swiftlint.outputs.cache-hit != 'true'
84+ run : |
85+ ci/install-swiftlint.sh
86+ - name : Run SwiftLint
87+ run : /tmp/swiftlint/SwiftLint/.build/release/swiftlint lint --strict .
10788 lockwood-swiftformat :
10889 timeout-minutes : 5
10990 runs-on : ubuntu-22.04
11091 steps :
111- - name : Checkout repository
112- uses : actions/checkout@v4
113- - name : Cache SwiftFormat
114- id : cache-swiftformat
115- uses : actions/cache@v4
116- with :
117- path : /tmp/swiftformat/SwiftFormat/.build/release/swiftformat
118- key : ${{ runner.os }}-swiftformat-${{ env.SWIFTFORMAT_VERSION }}
119- - name : Install Lockwood SwiftFormat
120- if : steps.cache-swiftformat.outputs.cache-hit != 'true'
121- run : |
122- ci/install-lockwood-swiftformat.sh
123- - name : Run SwiftFormat
124- run : /tmp/swiftformat/SwiftFormat/.build/release/swiftformat --strict .
92+ - name : Checkout repository
93+ uses : actions/checkout@v4
94+ - name : Cache SwiftFormat
95+ id : cache-swiftformat
96+ uses : actions/cache@v4
97+ with :
98+ path : /tmp/swiftformat/SwiftFormat/.build/release/swiftformat
99+ key : ${{ runner.os }}-swiftformat-${{ env.SWIFTFORMAT_VERSION }}
100+ - name : Install Lockwood SwiftFormat
101+ if : steps.cache-swiftformat.outputs.cache-hit != 'true'
102+ run : |
103+ ci/install-lockwood-swiftformat.sh
104+ - name : Run SwiftFormat
105+ run : /tmp/swiftformat/SwiftFormat/.build/release/swiftformat --strict .
125106 check-doc-comments :
126107 timeout-minutes : 5
127108 runs-on : ubuntu-22.04
128109 steps :
129- - name : Checkout repository
130- uses : actions/checkout@v4
131- - name : Check documentation comments
132- run : ci/run-apple-swift-format.sh
110+ - name : Checkout repository
111+ uses : actions/checkout@v4
112+ - name : Check documentation comments
113+ run : ci/run-apple-swift-format.sh
0 commit comments