Skip to content

Commit 7534dda

Browse files
authored
Adopt github-workflows (#187)
* Adopt github-workflows
1 parent 4008ac4 commit 7534dda

File tree

23 files changed

+239
-223
lines changed

23 files changed

+239
-223
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
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-
151
name: CI
162
permissions:
173
contents: read
184
on:
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
2612
concurrency:
@@ -32,28 +18,23 @@ env:
3218
SWIFTFORMAT_VERSION: 0.54.6
3319
SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_BENCHMARKING: 1
3420
jobs:
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

.license_header_template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@@ Copyright YEARS 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.

.licenseignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**/.swiftformat
2+
*.pb.swift
3+
*.txtpb
4+
.gitignore
5+
.gitmodules
6+
.swiftformat
7+
CITATION.cff
8+
Package.resolved
9+
Package.swift
10+
Snippets/*
11+
swift-homomorphic-encryption-protobuf

.pre-commit-config.yaml

Lines changed: 39 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,63 @@
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-
151
repos:
16-
- repo: https://github.com/pre-commit/pre-commit-hooks
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
173
rev: v5.0.0
184
hooks:
19-
- id: check-case-conflict
20-
- id: check-merge-conflict
21-
- id: check-symlinks
22-
- id: fix-byte-order-marker
23-
- id: check-toml
24-
- id: check-yaml
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-symlinks
8+
- id: fix-byte-order-marker
9+
- id: check-toml
10+
- id: check-yaml
2511
args: [--allow-multiple-documents]
26-
- id: end-of-file-fixer
27-
- id: mixed-line-ending
28-
- id: no-commit-to-branch
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: no-commit-to-branch
2915
args: [--branch, main]
30-
- id: trailing-whitespace
31-
- repo: https://github.com/crate-ci/typos
16+
- id: trailing-whitespace
17+
- repo: https://github.com/crate-ci/typos
3218
rev: v1.29.3
3319
hooks:
34-
- id: typos
35-
- repo: https://github.com/Lucas-C/pre-commit-hooks
20+
- id: typos
21+
- repo: https://github.com/Lucas-C/pre-commit-hooks
3622
rev: v1.5.5
3723
hooks:
38-
- id: insert-license
24+
- id: insert-license
3925
name: insert-license
40-
'types_or': [c, swift, proto]
26+
types_or: [c, swift, proto]
4127
args:
42-
- --license-filepath
43-
- copyright-header.txt
44-
- --comment-style
45-
- //
46-
- --allow-past-years
47-
- --use-current-year
48-
- --detect-license-in-X-top-lines=11
49-
- id: insert-license
50-
name: insert-license-yaml
51-
'types_or': [yaml]
28+
- --license-filepath
29+
- copyright-header.txt
30+
- --comment-style
31+
- //
32+
- --allow-past-years
33+
- --use-current-year
34+
- --detect-license-in-X-top-lines=11
35+
- id: insert-license
36+
name: insert-license-sh
37+
types_or: [shell]
5238
args:
53-
- --license-filepath
54-
- copyright-header.txt
55-
- --allow-past-years
56-
- --use-current-year
57-
- repo: local
39+
- --license-filepath
40+
- copyright-header.txt
41+
- --comment-style
42+
- "##"
43+
- --allow-past-years
44+
- --use-current-year
45+
- repo: local
5846
hooks:
59-
# https://github.com/nicklockwood/SwiftFormat
60-
- id: lockwood-swiftformat
47+
# https://github.com/nicklockwood/SwiftFormat
48+
- id: lockwood-swiftformat
6149
name: lockwood-swiftformat
6250
entry: swiftformat
6351
language: system
6452
types: [swift]
65-
# https://github.com/apple/swift-format
66-
- id: apple-swift-format
53+
# https://github.com/apple/swift-format
54+
- id: apple-swift-format
6755
name: apple-swift-format
6856
entry: ci/run-apple-swift-format.sh
6957
language: script
7058
pass_filenames: false
71-
# https://github.com/realm/SwiftLint
72-
- id: swiftlint
59+
# https://github.com/realm/SwiftLint
60+
- id: swiftlint
7361
name: swiftlint
7462
entry: swiftlint lint --strict
7563
language: system

.spi.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
# Copyright 2024 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-
151
version: 1
162
builder:
173
configs:
184
- documentation_targets:
19-
- HomomorphicEncryption
20-
- HomomorphicEncryptionProtobuf
21-
- PIRGenerateDatabase
22-
- PIRProcessDatabase
23-
- PIRShardDatabase
24-
- PNNSGenerateDatabase
25-
- PNNSProcessDatabase
26-
- PrivateInformationRetrieval
27-
- PrivateInformationRetrievalProtobuf
28-
- PrivateNearestNeighborSearch
29-
- PrivateNearestNeighborSearchProtobuf
5+
- HomomorphicEncryption
6+
- HomomorphicEncryptionProtobuf
7+
- PIRGenerateDatabase
8+
- PIRProcessDatabase
9+
- PIRShardDatabase
10+
- PNNSGenerateDatabase
11+
- PNNSProcessDatabase
12+
- PrivateInformationRetrieval
13+
- PrivateInformationRetrievalProtobuf
14+
- PrivateNearestNeighborSearch
15+
- PrivateNearestNeighborSearchProtobuf
3016
swift_version: 6.0

.swiftformat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
--asynccapturing XCTAssertAsyncThrowsError
21
--closingparen same-line
32
--exclude **/*.pb.swift
43
--extensionacl on-declarations

0 commit comments

Comments
 (0)