Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring in apple client into monorepo #1737

Merged
merged 17 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[codespell]
skip = ./rust/target,Cargo.lock,./www/docs/reference/api/*.mdx,./erl_crash.dump,./apps/*/erl_crash.dump,./cover,./vendor,*.json,yarn.lock,seeds.exs,./**/node_modules,./deps,./priv/static,./priv/plts,./**/priv/static,./.git,./www/build,./_build
ignore-words-list = crate,keypair,keypairs,iif,statics,wee,anull,commitish
ignore-words-list = crate,keypair,keypairs,iif,statics,wee,anull,commitish,inout
46 changes: 43 additions & 3 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
paths:
- "swift/**"
- "rust/connlib/**"
- ".github/workflows/swift.yml"
merge_group:
types: [checks_requested]
Expand All @@ -26,8 +27,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# TODO: Add a basic CI for the Apple client
# See rust.yml how we build, package and release connlib as an example
build:
runs-on: macos-latest
permissions:
Expand All @@ -39,4 +38,45 @@ jobs:
- draft-release
steps:
- uses: actions/checkout@v3
# TODO: Build Apple client from the CLI
- run: rustup show
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./rust
roop marked this conversation as resolved.
Show resolved Hide resolved
prefix-key: rust-${{ matrix.runs-on }}
save-if: ${{ github.ref == 'refs/heads/cloud' }}
- name: Update toolchain
run: rustup show
- name: Setup lipo
run: cargo install cargo-lipo
- uses: actions/cache@v3
with:
path: apple/.build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build Connlib.xcframework
env:
CONFIGURATION: Release
PROJECT_DIR: .
working-directory: ./rust/connlib/clients/apple
run: |
# build-xcframework.sh calls build-rust.sh indirectly via `xcodebuild`, but it pollutes the environment
# to the point that it causes the `ring` build to fail for the aarch64-apple-darwin target. So, explicitly
# build first. See https://github.com/briansmith/ring/issues/1332
PLATFORM_NAME=macosx ./build-rust.sh
PLATFORM_NAME=iphoneos ./build-rust.sh
./build-xcframework-dev.sh
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build app for macOS
working-directory: ./swift/apple
run: |
cp Firezone/Developer.xcconfig.ci-macOS Firezone/Developer.xcconfig
xcodebuild build -scheme Firezone -sdk macosx -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO
- name: Build app for iOS
working-directory: ./swift/apple
run: |
cp Firezone/Developer.xcconfig.ci-iOS Firezone/Developer.xcconfig
xcodebuild build -scheme Firezone -sdk iphoneos -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO
7 changes: 0 additions & 7 deletions rust/connlib/clients/apple/build-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

set -ex

if [[ -z "$PROJECT_DIR" ]]; then
echo "Must provide PROJECT_DIR environment variable set to the Xcode project directory." 1>&2
exit 1
fi

cd $PROJECT_DIR

# Default PLATFORM_NAME to macosx if not set.
: "${PLATFORM_NAME:=macosx}"

Expand Down
8 changes: 8 additions & 0 deletions swift/apple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
.build/
build/
DerivedData/
xcuserdata/
**/*.xcuserstate

Firezone/Developer.xcconfig
13 changes: 13 additions & 0 deletions swift/apple/.swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--swiftversion 5.7
--binarygrouping none
--decimalgrouping none
--hexgrouping none
--indent 2
--octalgrouping none
--semicolons never
--wraparguments before-first
--wrapcollections before-first
--wrapparameters before-first
--extensionacl on-declarations
--maxwidth 100
--header \n {file}\n (c) {created.year} Firezone, Inc.\n LICENSE: Apache-2.0\n
Loading
Loading