Skip to content
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
38 changes: 38 additions & 0 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
name: Build and Test

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
build:
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the @main branch reference for a GitHub Action is not recommended for production workflows as it can introduce breaking changes without warning. Consider pinning to a specific version tag (e.g., @v1 or a specific commit SHA) to ensure build reproducibility and stability.

Suggested change
uses: DeterminateSystems/nix-installer-action@main
uses: DeterminateSystems/nix-installer-action@v13

Copilot uses AI. Check for mistakes.

- name: Show Swift version
run: |
swift --version
xcodebuild -version

- name: Build with Nix
run: |
nix build .#default --print-build-logs

- name: Verify binary exists
run: |
test -f result/bin/WhoseDefaultBrowser && echo "Build successful!" || exit 1

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: WhoseDefaultBrowser
path: result/bin/WhoseDefaultBrowser
17 changes: 13 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@
};
buildInputs = [ pkgs.darwin.apple_sdk.frameworks.CoreServices ];
buildPhase = ''
export PATH=$PATH:/usr/bin:/usr/local/bin
export SDKROOT=$(xcrun --show-sdk-path)
export MACOSX_DEPLOYMENT_TARGET=10.15
xcrun swiftc -o WhoseDefaultBrowser main.swift
export PATH="/usr/bin:/usr/local/bin:$PATH"

# Use the latest SDK and Swift from the system's Xcode
export SDKROOT=$(/usr/bin/xcrun --sdk macosx --show-sdk-path)
export DEVELOPER_DIR=$(/usr/bin/xcode-select -p)
export MACOSX_DEPLOYMENT_TARGET=15.0

# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references "macOS 26" which uses incorrect version numbering. macOS versions follow a numbering scheme (e.g., macOS 10.x, macOS 11, 12, 13, 14, 15). "macOS 26" would be an unprecedented jump in versioning. This should be corrected to reference the actual macOS version being targeted.

Suggested change
# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
# Use xcrun/swiftc from the system's Xcode for compilation

Copilot uses AI. Check for mistakes.
/usr/bin/xcrun --sdk macosx swiftc \
-o WhoseDefaultBrowser \
-sdk "$SDKROOT" \
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The architecture mapping uses "arm64" and "x86_64" which are correct, but there's an inconsistency: the condition checks for "aarch64-darwin" but maps it to "arm64". While this works (arm64 and aarch64 refer to the same architecture), it would be more consistent to use "aarch64" in the target triple as well, or document why "arm64" is specifically chosen here for the Apple target triple.

Suggested change
-sdk "$SDKROOT" \
-sdk "$SDKROOT" \
# Nix uses "aarch64-darwin" as the system name, while Apple toolchains use "arm64" for the same architecture.

Copilot uses AI. Check for mistakes.
-target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx15.0 \
Comment on lines +39 to +45
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MACOSX_DEPLOYMENT_TARGET has been increased from 10.15 to 15.0, which is a significant jump (skipping macOS versions 11 through 14). This may unnecessarily restrict compatibility with older macOS systems that could otherwise run this application. Unless there's a specific requirement for macOS 15+ features, consider using a lower deployment target to maintain broader compatibility.

Suggested change
export MACOSX_DEPLOYMENT_TARGET=15.0
# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
/usr/bin/xcrun --sdk macosx swiftc \
-o WhoseDefaultBrowser \
-sdk "$SDKROOT" \
-target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx15.0 \
export MACOSX_DEPLOYMENT_TARGET=10.15
# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
/usr/bin/xcrun --sdk macosx swiftc \
-o WhoseDefaultBrowser \
-sdk "$SDKROOT" \
-target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx10.15 \

Copilot uses AI. Check for mistakes.
main.swift
'';
installPhase = ''
mkdir -p $out/bin
Expand Down
Loading