Skip to content

Commit a501f4c

Browse files
committed
docs: standardize README with verified examples and CI/CD
- Update README with corrected code examples and proper module imports - Add ReadmeVerificationTests to ensure all README examples compile and run - Add GitHub Actions CI/CD workflow for macOS, Linux, and Windows - Add .swift-format configuration for consistent code formatting - Update .gitignore with cleaner, more maintainable structure - Fix minor whitespace issues in FloodColor.swift
1 parent be78ece commit a501f4c

File tree

6 files changed

+488
-94
lines changed

6 files changed

+488
-94
lines changed

.github/workflows/ci.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
macos:
18+
name: macOS (Swift 6.1+)
19+
runs-on: macos-15
20+
strategy:
21+
matrix:
22+
xcode: ['16.0']
23+
config: ['release']
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Select Xcode ${{ matrix.xcode }}
28+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
29+
30+
- name: Print Swift version
31+
run: swift --version
32+
33+
- name: Cache Swift packages
34+
uses: actions/cache@v4
35+
with:
36+
path: .build
37+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
38+
restore-keys: |
39+
${{ runner.os }}-spm-
40+
41+
- name: Build
42+
run: swift build -c ${{ matrix.config }}
43+
44+
- name: Run tests
45+
run: swift test -c ${{ matrix.config }}
46+
47+
linux:
48+
name: Ubuntu (Swift 6.0)
49+
runs-on: ubuntu-latest
50+
container: swift:6.0
51+
steps:
52+
- uses: actions/checkout@v5
53+
54+
- name: Build
55+
run: swift build
56+
57+
- name: Run tests
58+
run: swift test
59+
60+
windows:
61+
name: Windows (Swift 6.0)
62+
runs-on: windows-latest
63+
steps:
64+
- uses: actions/checkout@v5
65+
66+
- uses: compnerd/gha-setup-swift@main
67+
with:
68+
branch: swift-6.0-release
69+
tag: 6.0-RELEASE
70+
71+
- name: Build
72+
run: swift build
73+
74+
- name: Run tests
75+
run: swift test
76+
77+
documentation:
78+
name: Documentation
79+
runs-on: macos-15
80+
steps:
81+
- uses: actions/checkout@v5
82+
83+
- name: Select Xcode
84+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
85+
86+
- name: Build documentation
87+
run: |
88+
swift package \
89+
--allow-writing-to-directory ./docs \
90+
generate-documentation \
91+
--target CSSTypes \
92+
--output-path ./docs \
93+
--transform-for-static-hosting \
94+
--hosting-base-path swift-css-types
95+
continue-on-error: true

.gitignore

Lines changed: 31 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,40 @@
1-
# Xcode
2-
#
3-
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4-
5-
## Build generated
6-
build/
7-
DerivedData/
8-
9-
## Various settings
10-
*.pbxuser
11-
!default.pbxuser
12-
*.mode1v3
13-
!default.mode1v3
14-
*.mode2v3
15-
!default.mode2v3
16-
*.perspectivev3
17-
!default.perspectivev3
18-
xcuserdata/
19-
20-
## Other
21-
*.moved-aside
22-
*.xccheckout
23-
*.xcscmblueprint
24-
25-
## Obj-C/Swift specific
26-
*.hmap
27-
*.ipa
28-
*.dSYM.zip
29-
*.dSYM
1+
# Swift
2+
.build/
3+
.swiftpm/
4+
Package.resolved
305

31-
## Playgrounds
32-
timeline.xctimeline
33-
playground.xcworkspace
6+
# Environment files
7+
.env*
348

35-
# Swift Package Manager
36-
#
37-
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
38-
# Packages/
39-
# Package.pins
40-
# Package.resolved
41-
.build/
9+
# Xcode
10+
*.xcodeproj
11+
*.xcworkspace
12+
*.xcuserdata
13+
DerivedData/
4214

43-
# CocoaPods
44-
#
45-
# We recommend against adding the Pods directory to your .gitignore. However
46-
# you should judge for yourself, the pros and cons are mentioned at:
47-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48-
#
49-
# Pods/
15+
# IDEs
16+
.vscode/
17+
.idea/
18+
*.swp
19+
*.swo
20+
*~
5021

51-
# Carthage
52-
#
53-
# Add this line if you want to avoid checking in source code from Carthage dependencies.
54-
# Carthage/Checkouts
22+
# Generated by MacOS
23+
.DS_Store
5524

56-
Carthage/Build
25+
# Generated by Windows
26+
Thumbs.db
5727

58-
# fastlane
59-
#
60-
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61-
# screenshots whenever they are needed.
62-
# For more information about the recommended setup visit:
63-
# https://docs.fastlane.tools/best-practices/source-control/#source-control
28+
# Generated by Linux
29+
*~
6430

65-
fastlane/report.xml
66-
fastlane/Preview.html
67-
fastlane/screenshots/**/*.png
68-
fastlane/test_output
31+
# Log files
32+
*.log
6933

70-
.DS_Store
71-
Packages/*
72-
.swiftpm
34+
# AI
35+
.claude
36+
CLAUDE.MD
7337

74-
CLAUDE.md
75-
.claude
38+
# Temporary files
39+
*.tmp
40+
*.temp

.swift-format

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": 1,
3+
"lineLength": 100,
4+
"indentation": {
5+
"spaces": 2
6+
},
7+
"tabWidth": 8,
8+
"maximumBlankLines": 1,
9+
"respectsExistingLineBreaks": true,
10+
"lineBreakBeforeControlFlowKeywords": false,
11+
"lineBreakBeforeEachArgument": true,
12+
"lineBreakBeforeEachGenericRequirement": false,
13+
"prioritizeKeepingFunctionOutputTogether": true,
14+
"indentConditionalCompilationBlocks": true,
15+
"lineBreakAroundMultilineExpressionChainComponents": false,
16+
"fileScopedDeclarationPrivacy": {
17+
"accessLevel": "private"
18+
},
19+
"rules": {
20+
"AllPublicDeclarationsHaveDocumentation": false,
21+
"AlwaysUseLowerCamelCase": true,
22+
"AmbiguousTrailingClosureOverload": true,
23+
"BeginDocumentationCommentWithOneLineSummary": false,
24+
"DoNotUseSemicolons": true,
25+
"DontRepeatTypeInStaticProperties": true,
26+
"FileScopedDeclarationPrivacy": true,
27+
"FullyIndirectEnum": true,
28+
"GroupNumericLiterals": true,
29+
"IdentifiersMustBeASCII": true,
30+
"NeverForceUnwrap": false,
31+
"NeverUseForceTry": false,
32+
"NeverUseImplicitlyUnwrappedOptionals": false,
33+
"NoAccessLevelOnExtensionDeclaration": true,
34+
"NoBlockComments": true,
35+
"NoCasesWithOnlyFallthrough": true,
36+
"NoEmptyTrailingClosureParentheses": true,
37+
"NoLabelsInCasePatterns": true,
38+
"NoLeadingUnderscores": false,
39+
"NoParensAroundConditions": true,
40+
"NoVoidReturnOnFunctionSignature": true,
41+
"OneCasePerLine": true,
42+
"OneVariableDeclarationPerLine": true,
43+
"OnlyOneTrailingClosureArgument": true,
44+
"OrderedImports": true,
45+
"ReturnVoidInsteadOfEmptyTuple": true,
46+
"UseLetInEveryBoundCaseVariable": true,
47+
"UseShorthandTypeNames": true,
48+
"UseSingleLinePropertyGetter": true,
49+
"UseSynthesizedInitializer": true,
50+
"UseTripleSlashForDocumentationComments": true,
51+
"UseWhereClausesInForLoops": false,
52+
"ValidateDocumentationComments": false
53+
}
54+
}

0 commit comments

Comments
 (0)