diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee605cd1..3dd5bdfb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ on: push: branches: - main - pull_request: + # pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..4966d3bb --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,81 @@ +on: + push: + branches: + - main + pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + build-appimage: + runs-on: ubuntu-24.04-arm + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build + run: XTL_CONFIG=debug make linux-dist + - name: Upload AppImage + uses: actions/upload-artifact@v4 + with: + name: xtool-linux-aarch64 + path: Linux/packages/xtool-aarch64.AppImage + compression-level: 0 + build-mac: + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + - name: Build + run: | + brew install xcodegen + make mac DEVELOPMENT_TEAM='""' + (cd macOS/Build/XcodeInstall && zip -yqr xtool.app.zip xtool.app) + - name: Upload app + uses: actions/upload-artifact@v4 + with: + name: xtool-mac + path: macOS/Build/XcodeInstall/xtool.app.zip + compression-level: 0 + test: + needs: [build-appimage, build-mac] + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: xtool-* + merge-multiple: true + path: stage + - name: Process artifacts + run: | + chmod +x stage/xtool-aarch64.AppImage + unzip -q stage/xtool.app.zip -d stage + ln -fs "$PWD/stage/xtool.app/Contents/Resources/bin/xtool" /usr/local/bin/xtool + # https://github.com/abiosoft/colima/issues/970#issuecomment-2224011277 + - name: Setup Docker + run: | + brew install --formula docker colima qemu + LIMACTL_PATH=$(brew --prefix)/bin/limactl + sudo curl -fL -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/acd34e689a7186d8317116165101b1fa56083542/limactl + sudo chmod +x $LIMACTL_PATH + colima start --disk 20 --vm-type qemu --arch arm64 + - name: Build SDK + run: | + xtool sdk build /Applications/Xcode_16.3.app stage + - name: Run test + run: | + docker run --rm -i \ + -v ./stage:/stage \ + swift:6.1.1 \ + bash << EOF + + mkdir -p ~/.swiftpm/swift-sdks + ln -fs /stage/darwin.artifactbundle ~/.swiftpm/swift-sdks/ + export APPIMAGE_EXTRACT_AND_RUN=1 + ln -fs /stage/xtool-aarch64.AppImage /usr/local/bin/xtool + + xtool new Hello --skip-setup + cd Hello + xtool dev build + + EOF diff --git a/Linux/build.sh b/Linux/build.sh index 87dff15d..072d33cd 100755 --- a/Linux/build.sh +++ b/Linux/build.sh @@ -13,8 +13,10 @@ fi rm -rf staging/tmp mkdir -p staging/tmp staging/linuxdeploy -swift build --package-path .. -c release --product xtool --static-swift-stdlib -bin="$(swift build --package-path .. -c release --show-bin-path)" +RESOLVED_CONFIG="${XTL_CONFIG:-release}" + +swift build --package-path .. -c "${RESOLVED_CONFIG}" --product xtool --static-swift-stdlib +bin="$(swift build --package-path .. -c "${RESOLVED_CONFIG}" --show-bin-path)" strip "${bin}/xtool" curr_git_info="$(curl -fsSL https://api.github.com/repos/linuxdeploy/linuxdeploy/git/refs/tags/continuous)" diff --git a/Makefile b/Makefile index 565ebbfc..4666bf8d 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ linux-clean: .PHONY: linux-dist # dist build for Linux linux-dist: - docker compose run --build --rm xtool Linux/build.sh + docker compose run --build -e XTL_CONFIG --rm xtool Linux/build.sh .PHONY: mac # dev build for macOS diff --git a/macOS/Support/Base.xcconfig b/macOS/Support/Base.xcconfig index 34a90d69..71ed4fff 100644 --- a/macOS/Support/Base.xcconfig +++ b/macOS/Support/Base.xcconfig @@ -1,5 +1,4 @@ GENERATE_INFOPLIST_FILE = YES -CODE_SIGN_ENTITLEMENTS = Support/XToolMac.entitlements CODE_SIGN_STYLE = Automatic ENABLE_HARDENED_RUNTIME = YES @@ -10,3 +9,20 @@ INFOPLIST_KEY_LSApplicationCategoryType = public.app-category.developer-tools #include? "Private-Team.xcconfig" #include? "Private.xcconfig" + +XTL_IS_EMPTY_ = YES +XTL_COERCE_TO_BOOL_YES = YES +XTL_COERCE_TO_BOOL_ = NO +XTL_INVERT_YES = NO +XTL_INVERT_NO = YES + +XTL_HAS_TEAM = $(XTL_INVERT_$(XTL_COERCE_TO_BOOL_$(XTL_IS_EMPTY_$(DEVELOPMENT_TEAM)))) + +XTL_CODE_SIGN_ENTITLEMENTS_NO = Support/XToolMac-NoTeam.entitlements +XTL_CODE_SIGN_ENTITLEMENTS_YES = Support/XToolMac.entitlements +CODE_SIGN_ENTITLEMENTS = $(XTL_CODE_SIGN_ENTITLEMENTS_$(XTL_HAS_TEAM)) + +ENABLE_HARDENED_RUNTIME = $(XTL_HAS_TEAM) + +XTL_TEAM_DEFINE_YES = -DHAS_TEAM +OTHER_SWIFT_FLAGS = $(inherited) $(XTL_TEAM_DEFINE_$(XTL_HAS_TEAM)) diff --git a/macOS/Support/XToolMac-NoTeam.entitlements b/macOS/Support/XToolMac-NoTeam.entitlements new file mode 100644 index 00000000..6631ffa6 --- /dev/null +++ b/macOS/Support/XToolMac-NoTeam.entitlements @@ -0,0 +1,6 @@ + + + + + + diff --git a/macOS/XToolMac/XToolMac.swift b/macOS/XToolMac/XToolMac.swift index a4a97008..1ea700d8 100644 --- a/macOS/XToolMac/XToolMac.swift +++ b/macOS/XToolMac/XToolMac.swift @@ -15,8 +15,10 @@ import XKit } private static func runXTool() async throws { - try await withDependencies { - $0.keyValueStorage = KeychainStorage(service: "sh.xtool.keychain.credentials") + try await withDependencies { d in + #if HAS_TEAM + d.keyValueStorage = KeychainStorage(service: "sh.xtool.keychain.credentials") + #endif } operation: { try await XTool.run() }