Skip to content

Commit b3b4132

Browse files
authored
Adding Macro Samples and More Capabilities (#64)
1 parent e28e3e5 commit b3b4132

80 files changed

Lines changed: 5799 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/SyntaxKit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
restore-keys: |
123123
${{ runner.os }}-mint-
124124
- name: Install mint
125-
if: steps.cache-mint.outputs.cache-hit != 'true'
125+
if: steps.cache-mint.outputs.cache-hit == ''
126126
run: |
127127
git clone https://github.com/yonaskolb/Mint.git
128128
cd Mint

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ excluded:
116116
- .build
117117
- Mint
118118
- Examples
119+
- Macros
119120
indentation_width:
120121
indentation_width: 2
121122
file_name:
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
name: macOS
2+
on:
3+
push:
4+
branches-ignore:
5+
- '*WIP'
6+
env:
7+
PACKAGE_NAME: Options
8+
jobs:
9+
build-ubuntu:
10+
name: Build on Ubuntu
11+
env:
12+
PACKAGE_NAME: Options
13+
SWIFT_VER: ${{ matrix.swift-version }}
14+
runs-on: ${{ matrix.runs-on }}
15+
if: "!contains(github.event.head_commit.message, 'ci skip')"
16+
strategy:
17+
matrix:
18+
runs-on: [ubuntu-20.04, ubuntu-22.04]
19+
swift-version: ["5.7.1", "5.8.1", "5.9", "5.9.2", "5.10"]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set Ubuntu Release DOT
23+
run: echo "RELEASE_DOT=$(lsb_release -sr)" >> $GITHUB_ENV
24+
- name: Set Ubuntu Release NUM
25+
run: echo "RELEASE_NUM=${RELEASE_DOT//[-._]/}" >> $GITHUB_ENV
26+
- name: Set Ubuntu Codename
27+
run: echo "RELEASE_NAME=$(lsb_release -sc)" >> $GITHUB_ENV
28+
- name: Cache swift package modules
29+
id: cache-spm-linux
30+
uses: actions/cache@v4
31+
env:
32+
cache-name: cache-spm
33+
with:
34+
path: .build
35+
key: ${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ hashFiles('Package.resolved') }}
36+
restore-keys: |
37+
${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
38+
${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-
39+
- name: Cache swift
40+
id: cache-swift-linux
41+
uses: actions/cache@v4
42+
env:
43+
cache-name: cache-swift
44+
with:
45+
path: swift-${{ env.SWIFT_VER }}-RELEASE-ubuntu${{ env.RELEASE_DOT }}
46+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ env.RELEASE_DOT }}
47+
restore-keys: |
48+
${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
49+
- name: Download Swift
50+
if: steps.cache-swift-linux.outputs.cache-hit != 'true'
51+
run: curl -O https://download.swift.org/swift-${SWIFT_VER}-release/ubuntu${RELEASE_NUM}/swift-${SWIFT_VER}-RELEASE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
52+
- name: Extract Swift
53+
if: steps.cache-swift-linux.outputs.cache-hit != 'true'
54+
run: tar xzf swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
55+
- name: Add Path
56+
run: echo "$GITHUB_WORKSPACE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}/usr/bin" >> $GITHUB_PATH
57+
- name: Test
58+
run: swift test --enable-code-coverage
59+
- uses: sersoft-gmbh/swift-coverage-action@v4
60+
id: coverage-files
61+
with:
62+
fail-on-empty-output: true
63+
- name: Upload coverage to Codecov
64+
uses: codecov/codecov-action@v4
65+
with:
66+
fail_ci_if_error: true
67+
flags: swift-${{ matrix.swift-version }},ubuntu-${{ matrix.RELEASE_DOT }}
68+
verbose: true
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
71+
build-macos:
72+
name: Build on macOS
73+
runs-on: ${{ matrix.os }}
74+
if: "!contains(github.event.head_commit.message, 'ci skip')"
75+
env:
76+
PACKAGE_NAME: Options
77+
strategy:
78+
matrix:
79+
include:
80+
- xcode: "/Applications/Xcode_14.1.app"
81+
os: macos-12
82+
iOSVersion: "16.1"
83+
watchOSVersion: "9.0"
84+
watchName: "Apple Watch Series 5 - 40mm"
85+
iPhoneName: "iPhone 12 mini"
86+
- xcode: "/Applications/Xcode_14.2.app"
87+
os: macos-12
88+
iOSVersion: "16.2"
89+
watchOSVersion: "9.1"
90+
watchName: "Apple Watch Ultra (49mm)"
91+
iPhoneName: "iPhone 14"
92+
- xcode: "/Applications/Xcode_15.0.1.app"
93+
os: macos-13
94+
iOSVersion: "17.0.1"
95+
watchOSVersion: "10.0"
96+
watchName: "Apple Watch Series 9 (41mm)"
97+
iPhoneName: "iPhone 15"
98+
- xcode: "/Applications/Xcode_15.1.app"
99+
os: macos-13
100+
iOSVersion: "17.2"
101+
watchOSVersion: "10.2"
102+
watchName: "Apple Watch Series 9 (45mm)"
103+
iPhoneName: "iPhone 15 Plus"
104+
- xcode: "/Applications/Xcode_15.2.app"
105+
os: macos-14
106+
iOSVersion: "17.2"
107+
watchOSVersion: "10.2"
108+
watchName: "Apple Watch Ultra (49mm)"
109+
iPhoneName: "iPhone 15 Pro"
110+
- xcode: "/Applications/Xcode_15.3.app"
111+
os: macos-14
112+
iOSVersion: "17.4"
113+
watchOSVersion: "10.4"
114+
watchName: "Apple Watch Ultra 2 (49mm)"
115+
iPhoneName: "iPhone 15 Pro Max"
116+
steps:
117+
- uses: actions/checkout@v4
118+
- name: Cache swift package modules
119+
id: cache-spm-macos
120+
uses: actions/cache@v4
121+
env:
122+
cache-name: cache-spm
123+
with:
124+
path: .build
125+
key: ${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-${{ hashFiles('Package.resolved') }}
126+
restore-keys: |
127+
${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-
128+
- name: Cache mint
129+
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
130+
id: cache-mint
131+
uses: actions/cache@v4
132+
env:
133+
cache-name: cache-mint
134+
with:
135+
path: .mint
136+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Mintfile') }}
137+
restore-keys: |
138+
${{ runner.os }}-build-${{ env.cache-name }}-
139+
${{ runner.os }}-build-
140+
${{ runner.os }}-
141+
- name: Set Xcode Name
142+
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV
143+
- name: Setup Xcode
144+
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer
145+
- name: Install mint
146+
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
147+
run: |
148+
brew update
149+
brew install mint
150+
- name: Build
151+
run: swift build
152+
- name: Run Swift Package tests
153+
run: swift test --enable-code-coverage
154+
- uses: sersoft-gmbh/swift-coverage-action@v4
155+
id: coverage-files-spm
156+
with:
157+
fail-on-empty-output: true
158+
- name: Upload coverage reports to Codecov
159+
uses: codecov/codecov-action@v4
160+
with:
161+
files: ${{ join(fromJSON(steps.coverage-files-spm.outputs.files), ',') }}
162+
token: ${{ secrets.CODECOV_TOKEN }}
163+
flags: macOS,${{ env.XCODE_NAME }},${{ matrix.runs-on }}
164+
- name: Clean up spm build directory
165+
run: rm -rf .build
166+
- name: Lint
167+
run: ./scripts/lint.sh
168+
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
169+
# - name: Run iOS target tests
170+
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk "iphonesimulator" -destination 'platform=iOS Simulator,name=${{ matrix.iPhoneName }},OS=${{ matrix.iOSVersion }}' -enableCodeCoverage YES build test
171+
# - uses: sersoft-gmbh/swift-coverage-action@v4
172+
# id: coverage-files-iOS
173+
# with:
174+
# fail-on-empty-output: true
175+
# - name: Upload coverage to Codecov
176+
# uses: codecov/codecov-action@v4
177+
# with:
178+
# fail_ci_if_error: true
179+
# verbose: true
180+
# token: ${{ secrets.CODECOV_TOKEN }}
181+
# files: ${{ join(fromJSON(steps.coverage-files-iOS.outputs.files), ',') }}
182+
# flags: iOS,iOS${{ matrix.iOSVersion }},macOS,${{ env.XCODE_NAME }}
183+
# - name: Run watchOS target tests
184+
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk "watchsimulator" -destination 'platform=watchOS Simulator,name=${{ matrix.watchName }},OS=${{ matrix.watchOSVersion }}' -enableCodeCoverage YES build test
185+
# - uses: sersoft-gmbh/swift-coverage-action@v4
186+
# id: coverage-files-watchOS
187+
# with:
188+
# fail-on-empty-output: true
189+
# - name: Upload coverage to Codecov
190+
# uses: codecov/codecov-action@v4
191+
# with:
192+
# fail_ci_if_error: true
193+
# verbose: true
194+
# token: ${{ secrets.CODECOV_TOKEN }}
195+
# files: ${{ join(fromJSON(steps.coverage-files-watchOS.outputs.files), ',') }}
196+
# flags: watchOS,watchOS${{ matrix.watchOSVersion }},macOS,${{ env.XCODE_NAME }}
197+
build-self:
198+
name: Build on Self-Hosting macOS
199+
runs-on: [self-hosted, macOS]
200+
if: github.event.repository.owner.login == github.event.organization.login && !contains(github.event.head_commit.message, 'ci skip')
201+
steps:
202+
- uses: actions/checkout@v4
203+
- name: Cache swift package modules
204+
id: cache-spm-macos
205+
uses: actions/cache@v4
206+
env:
207+
cache-name: cache-spm
208+
with:
209+
path: .build
210+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Package.resolved') }}
211+
restore-keys: |
212+
${{ runner.os }}-build-${{ env.cache-name }}-
213+
${{ runner.os }}-build-
214+
${{ runner.os }}-
215+
- name: Cache mint
216+
id: cache-mint
217+
uses: actions/cache@v4
218+
env:
219+
cache-name: cache-mint
220+
with:
221+
path: .mint
222+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Mintfile') }}
223+
restore-keys: |
224+
${{ runner.os }}-build-${{ env.cache-name }}-
225+
${{ runner.os }}-build-
226+
${{ runner.os }}-
227+
- name: Build
228+
run: swift build
229+
- name: Run Swift Package tests
230+
run: swift test --enable-code-coverage
231+
- uses: sersoft-gmbh/swift-coverage-action@v4
232+
with:
233+
fail-on-empty-output: true
234+
- name: Upload coverage reports to Codecov
235+
uses: codecov/codecov-action@v4
236+
with:
237+
token: ${{ secrets.CODECOV_TOKEN }}
238+
flags: macOS,${{ env.XCODE_NAME }}
239+
- name: Clean up spm build directory
240+
run: rm -rf .build
241+
- name: Lint
242+
run: ./scripts/lint.sh

Macros/Options/.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/swift,swiftpm,swiftpackagemanager,xcode,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=swift,swiftpm,swiftpackagemanager,xcode,macos
3+
4+
### macOS ###
5+
# General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Swift ###
38+
# Xcode
39+
#
40+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
41+
42+
## User settings
43+
xcuserdata/
44+
45+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
46+
*.xcscmblueprint
47+
*.xccheckout
48+
49+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
50+
build/
51+
DerivedData/
52+
*.moved-aside
53+
*.pbxuser
54+
!default.pbxuser
55+
*.mode1v3
56+
!default.mode1v3
57+
*.mode2v3
58+
!default.mode2v3
59+
*.perspectivev3
60+
!default.perspectivev3
61+
62+
## Obj-C/Swift specific
63+
*.hmap
64+
65+
## App packaging
66+
*.ipa
67+
*.dSYM.zip
68+
*.dSYM
69+
70+
## Playgrounds
71+
timeline.xctimeline
72+
playground.xcworkspace
73+
74+
# Swift Package Manager
75+
#
76+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
77+
# Packages/
78+
# Package.pins
79+
# Package.resolved
80+
*.xcodeproj
81+
#
82+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
83+
# hence it is not needed unless you have added a package configuration file to your project
84+
.swiftpm
85+
86+
.build/
87+
88+
# CocoaPods
89+
#
90+
# We recommend against adding the Pods directory to your .gitignore. However
91+
# you should judge for yourself, the pros and cons are mentioned at:
92+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
93+
#
94+
# Pods/
95+
#
96+
# Add this line if you want to avoid checking in source code from the Xcode workspace
97+
# *.xcworkspace
98+
99+
# Carthage
100+
#
101+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
102+
# Carthage/Checkouts
103+
104+
Carthage/Build/
105+
106+
# Accio dependency management
107+
Dependencies/
108+
.accio/
109+
110+
# fastlane
111+
#
112+
# It is recommended to not store the screenshots in the git repo.
113+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
114+
# For more information about the recommended setup visit:
115+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
116+
117+
fastlane/report.xml
118+
fastlane/Preview.html
119+
fastlane/screenshots/**/*.png
120+
fastlane/test_output
121+
122+
# Code Injection
123+
#
124+
# After new code Injection tools there's a generated folder /iOSInjectionProject
125+
# https://github.com/johnno1962/injectionforxcode
126+
127+
iOSInjectionProject/
128+
129+
.mint
130+
Output
131+
132+
# Due to support for 5.10 and below
133+
Package.resolved

0 commit comments

Comments
 (0)