Skip to content
Merged

CI #182

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
133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: CI

# Comprehensive CI workflow that includes builds, tests, and validations
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]

# Cancel any in-progress workflow runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer

jobs:
# Swift Package Manager Build
spm-build:
name: SPM Build
runs-on: macos-latest
strategy:
matrix:
platform: [iOS, macOS, tvOS, watchOS, visionOS]

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Build with SPM
run: |
case "${{ matrix.platform }}" in
iOS)
SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path)
swift build \
-Xcc "-isysroot" -Xcc "$SDK_PATH" \
-Xswiftc "-sdk" -Xswiftc "$SDK_PATH" \
-Xswiftc "-target" -Xswiftc "arm64-apple-ios13.0-simulator"
;;
macOS)
swift build
;;
tvOS)
SDK_PATH=$(xcrun --sdk appletvsimulator --show-sdk-path)
swift build \
-Xcc "-isysroot" -Xcc "$SDK_PATH" \
-Xswiftc "-sdk" -Xswiftc "$SDK_PATH" \
-Xswiftc "-target" -Xswiftc "arm64-apple-tvos13.0-simulator"
;;
watchOS)
SDK_PATH=$(xcrun --sdk watchsimulator --show-sdk-path)
swift build \
-Xcc "-isysroot" -Xcc "$SDK_PATH" \
-Xswiftc "-sdk" -Xswiftc "$SDK_PATH" \
-Xswiftc "-target" -Xswiftc "arm64-apple-watchos6.0-simulator"
;;
visionOS)
SDK_PATH=$(xcrun --sdk xrsimulator --show-sdk-path)
swift build \
-Xcc "-isysroot" -Xcc "$SDK_PATH" \
-Xswiftc "-sdk" -Xswiftc "$SDK_PATH" \
-Xswiftc "-target" -Xswiftc "arm64-apple-xros1.0-simulator"
;;
esac

# Xcode Build Test
xcode-build:
name: Xcode Build
runs-on: macos-latest
strategy:
matrix:
destination:
- 'platform=iOS Simulator,name=iPhone 15,OS=latest'
- 'platform=macOS'
- 'platform=tvOS Simulator,name=Apple TV,OS=latest'
- 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest'
- 'platform=visionOS Simulator,name=Apple Vision Pro,OS=latest'

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Build with Xcode
run: |
xcodebuild clean build \
-workspace EFQRCode.xcworkspace \
-scheme "${{ contains(matrix.destination, 'iOS') && 'iOS Example' || contains(matrix.destination, 'macOS') && 'macOS Example' || contains(matrix.destination, 'tvOS') && 'tvOS Example' || contains(matrix.destination, 'watchOS') && 'watchOS Example' || 'iOS Example' }}" \
-destination "${{ matrix.destination }}" \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
ONLY_ACTIVE_ARCH=NO

# Documentation Check
documentation-check:
name: Documentation Check
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Jazzy
run: sudo gem install jazzy
- name: Resolve Swift Package dependencies
run: xcodebuild -resolvePackageDependencies
- name: Generate Documentation
run: ./docs.sh
continue-on-error: false

# Final Status Check
status-check:
name: Status Check
runs-on: macos-latest
needs: [spm-build, xcode-build, documentation-check]
if: always()

steps:
- name: Check Results
run: |
if [[ "${{ needs.spm-build.result }}" != "success" ]] || [[ "${{ needs.xcode-build.result }}" != "success" ]]; then
echo "❌ Build checks failed - PR will be blocked"
exit 1
fi

echo "✅ All checks passed successfully!"
5 changes: 5 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- main
- docs

# Cancel any in-progress workflow runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
jazzy:
runs-on: macos-latest
Expand Down
13 changes: 5 additions & 8 deletions Package@swift-5.3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ let package = Package(
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.visionOS(.v1)
.watchOS(.v6)
],
products: [
.library(name: "EFQRCode", targets: ["EFQRCode"])
Expand All @@ -52,17 +51,15 @@ let package = Package(
"SwiftDraw"
],
path: "Source",
exclude: ["Info.plist", "Info-tvOS.plist"]),
exclude: ["Info.plist", "Info-tvOS.plist"],
resources: [
.process("PrivacyInfo.xcprivacy")
]),
.testTarget(name: "EFQRCodeSwiftTests",
dependencies: ["EFQRCode"],
path: "Tests",
exclude: ["Info.plist"],
resources: [.process("Resources")]),
.testTarget(name: "EFQRCodeObjCTests",
dependencies: ["EFQRCode"],
path: "Tests",
exclude: ["Info.plist", "Tests.swift"],
resources: [.process("Resources")]),
],
swiftLanguageVersions: [.v5]
)
66 changes: 66 additions & 0 deletions Package@swift-5.9.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// swift-tools-version:5.9
//
// Package.swift
// EFQRCode
//
// Created by EyreFree on 2017/4/1.
//
// Copyright (c) 2017-2021 EyreFree <eyrefree@eyrefree.org>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import PackageDescription

let package = Package(
name: "EFQRCode",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.visionOS(.v1)
],
products: [
.library(name: "EFQRCode", targets: ["EFQRCode"])
],
dependencies: [
.package(url: "https://github.com/EFPrefix/swift_qrcodejs.git",
.upToNextMinor(from: "2.3.1")),
.package(url: "https://github.com/swhitty/SwiftDraw.git",
.upToNextMinor(from: "0.22.0")),
],
targets: [
.target(name: "EFQRCode",
dependencies: [
.product(name: "QRCodeSwift", package: "swift_qrcodejs"),
"SwiftDraw"
],
path: "Source",
exclude: ["Info.plist", "Info-tvOS.plist"],
resources: [
.process("PrivacyInfo.xcprivacy")
]),
.testTarget(name: "EFQRCodeSwiftTests",
dependencies: ["EFQRCode"],
path: "Tests",
exclude: ["Info.plist"],
resources: [.process("Resources")]),
],
swiftLanguageVersions: [.v5]
)
Loading