diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6570da9..dc5d9af 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,18 +28,18 @@ jobs: run: make docs - name: Setup GitHub Pages id: pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: - path: docs + path: Build/Docs deploy: runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v2 environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ca9074c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +name: Test +on: + push: + branches: + - main + tags-ignore: + - '**' + paths: + - 'Source/**' + - 'Tests/**' + - '.github/workflows/**' + - 'Package.swift' + - 'Makefile' + pull_request: + branches: + - '**' + paths: + - 'Source/**' + - 'Tests/**' + - '.github/workflows/**' + - 'Package.swift' + - 'Makefile' + +jobs: + Apple: + name: Test ${{ matrix.name }} + runs-on: macOS-latest + strategy: + fail-fast: false + matrix: + include: + - name: macOS + target: test-macos + - name: iOS + target: test-ios + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build and test + run: make ${{ matrix.target }} + shell: bash + SPM: + name: Test with SPM + runs-on: macOS-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build and test + run: swift test + shell: bash diff --git a/.gitignore b/.gitignore index 9458023..3f63484 100644 --- a/.gitignore +++ b/.gitignore @@ -1,93 +1,11 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore +.DS_Store ## User settings xcuserdata/ -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout - -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) -build/ -DerivedData/ -*.moved-aside -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 - -## Obj-C/Swift specific -*.hmap - -## App packaging -*.ipa -*.dSYM.zip -*.dSYM - -## Playgrounds -timeline.xctimeline -playground.xcworkspace - # Swift Package Manager -# -# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. -# Packages/ -# Package.pins -# Package.resolved -# *.xcodeproj -# -# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata -# hence it is not needed unless you have added a package configuration file to your project -# .swiftpm - -.build/ - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ -# -# Add this line if you want to avoid checking in source code from the Xcode workspace -# *.xcworkspace - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build/ - -# Accio dependency management -Dependencies/ -.accio/ - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. -# Instead, use fastlane to re-generate the screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output - -# Code Injection -# -# After new code Injection tools there's a generated folder /iOSInjectionProject -# https://github.com/johnno1962/injectionforxcode - -iOSInjectionProject/ +/.swiftpm +/.build -# GitHub Pages -docs +# Makefile output dir +/Build diff --git a/Makefile b/Makefile index 06c0294..2fb64a2 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,38 @@ TARGET_NAME = SQLime -DERIVED_DATA_PATH = ./DerivedData +OUTPUD_DIR = ./Build +DERIVED_DATA_PATH = $(OUTPUD_DIR)/DerivedData -.PHONY: docs clean +.PHONY: clean, test, test-ios -docs: - xcodebuild docbuild -quiet \ +clean: + swift package clean + rm -rf $(OUTPUD_DIR) + +# MARK: - Tests + +test: + swift test + +XCODEBUILD_TEST = xcodebuild test -quiet -scheme $(TARGET_NAME) + +test-macos: + $(XCODEBUILD_TEST) -destination 'platform=macOS' + +test-ios: + $(XCODEBUILD_TEST) -destination 'platform=iOS Simulator,name=iPhone 16' + +# MARK: - DocC + +DOCC_ARCHIVE = $(DERIVED_DATA_PATH)/Build/Products/Debug/$(TARGET_NAME).doccarchive + +$(DOCC_ARCHIVE): + xcodebuild docbuild \ + -quiet \ -scheme $(TARGET_NAME) \ - -derivedDataPath $(DERIVED_DATA_PATH) \ - -destination 'platform=macOS' - xcrun docc process-archive transform-for-static-hosting \ - $(DERIVED_DATA_PATH)/Build/Products/Debug/$(TARGET_NAME).doccarchive \ + -destination "generic/platform=macOS" \ + -derivedDataPath $(DERIVED_DATA_PATH) + +$(OUTPUD_DIR)/Docs: $(DOCC_ARCHIVE) + xcrun docc process-archive transform-for-static-hosting $^ \ --hosting-base-path $(TARGET_NAME) \ --output-path $@ - -clean: - swift package clean - rm -rf $(DERIVED_DATA_PATH) - rm -rf docs diff --git a/Package.swift b/Package.swift index 82c2c07..9299b59 100644 --- a/Package.swift +++ b/Package.swift @@ -1,10 +1,14 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "SQLime", + platforms: [ + .macOS(.v12), + .iOS(.v12), + ], products: [ .library( name: "SQLime", diff --git a/README.md b/README.md index 6dff288..bfa6824 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # 🍋 SQLime +[![Test](https://github.com/Alexander-Ignition/Octokot/actions/workflows/test.yml/badge.svg)](https://github.com/Alexander-Ignition/Octokot/actions/workflows/test.yml) +[![Swift 5.9](https://img.shields.io/badge/swift-5.9-brightgreen.svg?style=flat)](https://developer.apple.com/swift) +[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/Alexander-Ignition/Octokot/blob/master/LICENSE) + Swift SQLite wrapper. + +[Documentation](https://alexander-ignition.github.io/SQLime/documentation/sqlime/)