Skip to content

Commit 12b23bb

Browse files
authored
Swift plugin (#630)
1 parent 16e2f95 commit 12b23bb

60 files changed

Lines changed: 3738 additions & 1239 deletions

Some content is hidden

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

.github/workflows/build-macos.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build macOS app
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- dev
7+
- "release/**"
8+
paths-ignore:
9+
- "*.md"
10+
- "LICENSE"
11+
tags:
12+
- v*.*.*
13+
14+
jobs:
15+
build-macos:
16+
runs-on:
17+
- self-hosted
18+
- macOS
19+
env:
20+
APPLE_SIGNING_IDENTITY: "Apple Distribution: defguard sp. z o.o. (82GZ7KN29J)"
21+
APPLE_SIGNING_IDENTITY_INSTALLER: "3rd Party Mac Developer Installer: defguard sp. z o.o. (82GZ7KN29J)"
22+
APPLE_PROVIDER_SHORT_NAME: "82GZ7KN29J"
23+
APPLE_ID: "kamil@defguard.net"
24+
APPLE_TEAM_ID: "82GZ7KN29J"
25+
steps:
26+
- uses: actions/checkout@v5
27+
with:
28+
submodules: recursive
29+
30+
- name: Write release version
31+
run: |
32+
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
33+
echo Version: $VERSION
34+
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
35+
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: "24"
39+
cache: "pnpm"
40+
41+
- uses: pnpm/action-setup@v4
42+
with:
43+
version: 10
44+
run_install: false
45+
46+
- name: Get pnpm store directory
47+
shell: bash
48+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
49+
50+
- name: Install deps
51+
run: pnpm install --frozen-lockfile
52+
53+
- uses: dtolnay/rust-toolchain@stable
54+
with:
55+
targets: aarch64-apple-darwin,x86_64-apple-darwin
56+
57+
- name: Unlock keychain
58+
run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain
59+
60+
- name: Set build number
61+
run: |
62+
sed -i '' "s,@BUILD_NUMBER@,${{ github.run_number }}," src-tauri/tauri.conf.json
63+
sed -i '' "s,@BUILD_NUMBER@,${{ github.run_number }}," swift/extension/VPNExtension.xcodeproj/project.pbxproj
64+
65+
- name: Build app
66+
# Switch back to tauri-action when this gets merged https://github.com/tauri-apps/tauri/pull/14379
67+
# uses: tauri-apps/tauri-action@v0.5.23 # .24 seems broken, TODO: update when fixed
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
# APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
71+
# APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
72+
run: cd src-tauri && cargo tauri build --bundles app --target universal-apple-darwin
73+
74+
- name: Build installation package
75+
run: |
76+
security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain
77+
xcrun productbuild --sign "${{ env.APPLE_SIGNING_IDENTITY_INSTALLER }}" --component "src-tauri/target/universal-apple-darwin/release/bundle/macos/defguard-client.app" /Applications defguard-client.pkg
78+
xcrun altool --upload-app --type macos --file defguard-client.pkg --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUER }}
79+
# xcrun notarytool submit --wait --apple-id ${{ env.APPLE_ID }} --password ${{ secrets.NOTARYTOOL_APP_SPECIFIC_PASSWORD }} --team-id ${{ env.APPLE_TEAM_ID }} defguard-client.pkg
80+
# xcrun stapler staple defguard-client.pkg
81+
82+
# - name: Upload installation package
83+
# uses: actions/upload-release-asset@v1
84+
# env:
85+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
# with:
87+
# upload_url: ${{ needs.create-release.outputs.upload_url }}
88+
# asset_path: defguard-client.pkg
89+
# asset_name: defguard-client-universal-${{ env.VERSION }}.pkg
90+
# asset_content_type: application/octet-stream

.github/workflows/release.yaml

Lines changed: 5 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
tags:
55
- v*.*.*
6+
67
jobs:
78
create-release:
89
name: create-release
@@ -105,12 +106,11 @@ jobs:
105106
apt-get install -y ruby
106107
gem install deb-s3
107108
echo "$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" >> $GITHUB_PATH
108-
- name: Upload DEB to APT repository
109+
- name: Upload DEB to APT repository
109110
run: |
110111
COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release.
111112
112113
deb-s3 upload -l --bucket=apt.defguard.net --access-key-id=${{ secrets.AWS_ACCESS_KEY_APT }} --secret-access-key=${{ secrets.AWS_SECRET_KEY_APT }} --s3-region=eu-north-1 --no-fail-if-exists --codename=bookworm --component="$COMPONENT" src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
113-
114114
115115
build-linux:
116116
needs:
@@ -208,7 +208,6 @@ jobs:
208208
- name: Upload DEB to APT repository #Add this to ubuntu 22.04 job (on merge dev -> main) with --codename=bookworm
209209
run: |
210210
COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release.
211-
212211
deb-s3 upload -l --bucket=apt.defguard.net --access-key-id=${{ secrets.AWS_ACCESS_KEY_APT }} --secret-access-key=${{ secrets.AWS_SECRET_KEY_APT }} --s3-region=eu-north-1 --no-fail-if-exists --codename=trixie --component="$COMPONENT" src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
213212
- name: Rename client binary
214213
run: mv src-tauri/target/release/defguard-client defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
@@ -301,8 +300,6 @@ jobs:
301300
- self-hosted
302301
- Linux
303302
- X64
304-
strategy:
305-
fail-fast: false
306303
steps:
307304
- name: Sign APT repository
308305
run: |
@@ -314,15 +311,15 @@ jobs:
314311
315312
for DIST in trixie bookworm; do
316313
aws s3 cp s3://apt.defguard.net/dists/${DIST}/Release .
317-
314+
318315
curl -X POST "${{ secrets.DEFGUARD_SIGNING_URL }}?signature_type=both" \
319316
-H "Authorization: Bearer ${{ secrets.DEFGUARD_SIGNING_API_KEY }}" \
320317
-F "file=@Release" \
321318
-o response.json
322-
319+
323320
cat response.json | jq -r '.files["Release.gpg"].content' | base64 --decode > Release.gpg
324321
cat response.json | jq -r '.files.Release.content' | base64 --decode > InRelease
325-
322+
326323
aws s3 cp Release.gpg s3://apt.defguard.net/dists/${DIST}/ --acl public-read
327324
aws s3 cp InRelease s3://apt.defguard.net/dists/${DIST}/ --acl public-read
328325
@@ -398,83 +395,6 @@ jobs:
398395
cat PKGBUILD
399396
cat .SRCINFO
400397
401-
build-macos:
402-
needs:
403-
- create-release
404-
strategy:
405-
fail-fast: false
406-
matrix:
407-
target: [aarch64-apple-darwin, x86_64-apple-darwin]
408-
runs-on:
409-
- self-hosted
410-
- macOS
411-
env:
412-
APPLE_SIGNING_IDENTITY_APPLICATION: "Developer ID Application: defguard sp. z o.o. (82GZ7KN29J)"
413-
APPLE_SIGNING_IDENTITY_INSTALLER: "Developer ID Installer: defguard sp. z o.o. (82GZ7KN29J)"
414-
APPLE_ID: "kamil@defguard.net"
415-
APPLE_TEAM_ID: "82GZ7KN29J"
416-
steps:
417-
- uses: actions/checkout@v5
418-
with:
419-
submodules: "recursive"
420-
- name: Write release version
421-
run: |
422-
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
423-
echo Version: $VERSION
424-
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
425-
- uses: actions/setup-node@v4
426-
with:
427-
node-version: "22"
428-
- uses: pnpm/action-setup@v4
429-
with:
430-
version: 10
431-
run_install: false
432-
- name: Get pnpm store directory
433-
shell: bash
434-
run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
435-
- uses: actions/cache@v4
436-
name: Setup pnpm cache
437-
with:
438-
path: ${{ env.STORE_PATH }}
439-
key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }}
440-
restore-keys: |
441-
${{ runner.os }}-pnpm-build-store-
442-
- name: Install deps
443-
run: pnpm install --frozen-lockfile
444-
- uses: dtolnay/rust-toolchain@stable
445-
- name: Install protobuf compiler
446-
run: brew install protobuf
447-
- name: Install ARM target
448-
run: rustup target add aarch64-apple-darwin
449-
- name: Unlock keychain
450-
run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" /Users/admin/Library/Keychains/login.keychain
451-
- name: Build app
452-
uses: tauri-apps/tauri-action@v0.5.23 # .24 seems broken, TODO: update when fixed
453-
env:
454-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
455-
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY_APPLICATION }}
456-
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
457-
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
458-
APPLE_ID: ${{ env.APPLE_ID }}
459-
APPLE_PASSWORD: ${{ secrets.NOTARYTOOL_APP_SPECIFIC_PASSWORD }}
460-
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }}
461-
with:
462-
args: --target ${{ matrix.target }} -v
463-
- name: Build installation package
464-
run: |
465-
bash build-macos-package.sh src-tauri/target/${{ matrix.target }} src-tauri/resources-macos/scripts '${{ env.APPLE_SIGNING_IDENTITY_INSTALLER }}' /Users/admin/Library/Keychains/login.keychain
466-
xcrun notarytool submit --wait --apple-id ${{ env.APPLE_ID }} --password ${{ secrets.NOTARYTOOL_APP_SPECIFIC_PASSWORD }} --team-id ${{ env.APPLE_TEAM_ID }} src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
467-
xcrun stapler staple src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
468-
- name: Upload installation package
469-
uses: actions/upload-release-asset@v1
470-
env:
471-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
472-
with:
473-
upload_url: ${{ needs.create-release.outputs.upload_url }}
474-
asset_path: src-tauri/target/${{ matrix.target }}/product-signed/defguard.pkg
475-
asset_name: defguard-${{ matrix.target }}-${{ env.VERSION }}.pkg
476-
asset_content_type: application/octet-stream
477-
478398
# Builds Windows MSI and uploads it as artifact
479399
build-windows:
480400
needs:

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "src-tauri/proto"]
55
path = src-tauri/proto
66
url = ../proto.git
7+
[submodule "swift/boringtun"]
8+
path = swift/boringtun
9+
url = ../boringtun.git

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
33
"vcs": {
44
"enabled": false,
55
"clientKind": "git",

build-macos-package.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@react-hook/resize-observer": "^2.0.2",
5353
"@stablelib/base64": "^2.0.1",
5454
"@stablelib/x25519": "^2.0.1",
55-
"@tanstack/query-core": "^5.90.2",
55+
"@tanstack/query-core": "^5.90.5",
5656
"@tanstack/react-virtual": "3.13.12",
5757
"@tauri-apps/api": "^2.8.0",
5858
"@tauri-apps/plugin-clipboard-manager": "^2.3.0",
@@ -72,19 +72,19 @@
7272
"classnames": "^2.5.1",
7373
"clsx": "^2.1.1",
7474
"compare-versions": "^6.1.1",
75-
"dayjs": "^1.11.18",
75+
"dayjs": "^1.11.19",
7676
"deepmerge-ts": "^7.1.5",
7777
"detect-browser": "^5.3.0",
7878
"fast-deep-equal": "^3.1.3",
7979
"file-saver": "^2.0.5",
8080
"get-text-width": "^1.0.3",
81-
"html-react-parser": "^5.2.6",
81+
"html-react-parser": "^5.2.7",
8282
"itertools": "^2.5.0",
8383
"js-base64": "^3.7.8",
8484
"lodash-es": "^4.17.21",
8585
"merge-refs": "^2.0.0",
8686
"millify": "^6.1.0",
87-
"motion": "^12.23.22",
87+
"motion": "^12.23.24",
8888
"p-timeout": "^6.1.4",
8989
"prop-types": "^15.8.1",
9090
"radash": "^12.1.1",
@@ -100,36 +100,36 @@
100100
"react-router-dom": "^6.30.1",
101101
"react-use-websocket": "^4.13.0",
102102
"react-virtualized-auto-sizer": "^1.0.26",
103-
"recharts": "^3.2.1",
103+
"recharts": "^3.3.0",
104104
"rehype-sanitize": "^6.0.0",
105105
"rxjs": "^7.8.2",
106-
"use-breakpoint": "^4.0.6",
106+
"use-breakpoint": "^4.0.10",
107107
"zod": "^3.25.76",
108108
"zustand": "^5.0.8"
109109
},
110110
"devDependencies": {
111-
"@biomejs/biome": "^2.2.4",
111+
"@biomejs/biome": "^2.3.2",
112112
"@hookform/devtools": "^4.4.0",
113113
"@svgr/cli": "^8.1.0",
114-
"@tanstack/react-query": "^5.90.2",
114+
"@tanstack/react-query": "^5.90.5",
115115
"@tanstack/react-query-devtools": "^5.90.2",
116-
"@tauri-apps/cli": "^2.8.4",
116+
"@tauri-apps/cli": "^2.9.2",
117117
"@types/file-saver": "^2.0.7",
118118
"@types/lodash-es": "^4.17.12",
119-
"@types/node": "^24.6.2",
120-
"@types/react": "^19.2.0",
121-
"@types/react-dom": "^19.2.0",
122-
"@vitejs/plugin-react": "^5.0.4",
123-
"@vitejs/plugin-react-swc": "^4.1.0",
119+
"@types/node": "^24.9.2",
120+
"@types/react": "^19.2.2",
121+
"@types/react-dom": "^19.2.2",
122+
"@vitejs/plugin-react": "^5.1.0",
123+
"@vitejs/plugin-react-swc": "^4.2.0",
124124
"autoprefixer": "^10.4.21",
125125
"npm-run-all": "^4.1.5",
126126
"postcss": "^8.5.6",
127127
"prettier": "^3.6.2",
128128
"sass": "~1.92.1",
129-
"typedoc": "^0.28.13",
129+
"typedoc": "^0.28.14",
130130
"typesafe-i18n": "^5.26.2",
131131
"typescript": "^5.9.3",
132-
"vite": "^7.1.8"
132+
"vite": "^7.1.12"
133133
},
134134
"volta": {
135135
"node": "20.5.1"

0 commit comments

Comments
 (0)