docs: add comprehensive README and MIT license for open source #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: iOS CI/CD | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| validate-content: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install jsonschema | |
| - name: Validate seed content | |
| run: python3 Scripts/validate_content.py --seed-dir Content/seed | |
| test-swift-packages: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.0" | |
| - name: Build & test DialectCore | |
| run: swift test --package-path Packages/DialectCore | |
| - name: Build & test SRSEngine | |
| run: swift test --package-path Packages/SRSEngine | |
| build-and-test-ios: | |
| runs-on: macos-15 | |
| needs: [test-swift-packages, validate-content] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xcodegen | |
| run: brew install xcodegen | |
| - name: Generate Xcode project | |
| run: xcodegen generate | |
| - name: Decode Firebase config | |
| run: echo "$FIREBASE_PLIST_B64" | base64 -d > App/GoogleService-Info.plist | |
| env: | |
| FIREBASE_PLIST_B64: ${{ secrets.FIREBASE_PLIST_B64 }} | |
| - name: Build for testing | |
| run: > | |
| xcodebuild build-for-testing | |
| -scheme BabYap | |
| -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' | |
| -skipPackagePluginValidation | |
| - name: Run unit tests | |
| run: > | |
| xcodebuild test-without-building | |
| -scheme BabYap | |
| -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' | |
| - name: Run UI tests | |
| run: > | |
| xcodebuild test | |
| -scheme BabYap | |
| -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' | |
| -only-testing:BabYapUITests | |
| -skipPackagePluginValidation | |
| - name: Measure DialectCore coverage | |
| run: | | |
| swift test --package-path Packages/DialectCore --enable-code-coverage | |
| BIN=$(find Packages/DialectCore/.build -name "DialectCorePackageTests" -type f -not -path "*.dSYM*" | head -1) | |
| PROF=$(find Packages/DialectCore/.build -name "default.profdata" -type f -not -path "*.dSYM*" | head -1) | |
| mkdir -p phase7-artifacts/coverage-reports | |
| xcrun llvm-cov report "$BIN" -instr-profile "$PROF" | tee phase7-artifacts/coverage-reports/dialectcore-coverage.txt | |
| COVERAGE=$(grep "TOTAL" phase7-artifacts/coverage-reports/dialectcore-coverage.txt | grep -oE '[0-9]+\.[0-9]+%' | tail -1 | tr -d '%') | |
| echo "DialectCore line coverage: ${COVERAGE}%" | |
| if [ -z "$COVERAGE" ]; then | |
| echo "::error::Failed to parse DialectCore coverage from llvm-cov output" | |
| exit 1 | |
| fi | |
| if (( $(echo "$COVERAGE < 80" | bc -l) )); then | |
| echo "::error::DialectCore coverage ${COVERAGE}% is below 80% threshold" | |
| exit 1 | |
| fi | |
| - name: Measure SRSEngine coverage | |
| run: | | |
| swift test --package-path Packages/SRSEngine --enable-code-coverage | |
| BIN=$(find Packages/SRSEngine/.build -name "SRSEnginePackageTests" -type f -not -path "*.dSYM*" | head -1) | |
| PROF=$(find Packages/SRSEngine/.build -name "default.profdata" -type f -not -path "*.dSYM*" | head -1) | |
| xcrun llvm-cov report "$BIN" -instr-profile "$PROF" | tee phase7-artifacts/coverage-reports/srsengine-coverage.txt | |
| COVERAGE=$(grep "TOTAL" phase7-artifacts/coverage-reports/srsengine-coverage.txt | grep -oE '[0-9]+\.[0-9]+%' | tail -1 | tr -d '%') | |
| echo "SRSEngine line coverage: ${COVERAGE}%" | |
| if [ -z "$COVERAGE" ]; then | |
| echo "::error::Failed to parse SRSEngine coverage from llvm-cov output" | |
| exit 1 | |
| fi | |
| if (( $(echo "$COVERAGE < 80" | bc -l) )); then | |
| echo "::error::SRSEngine coverage ${COVERAGE}% is below 80% threshold" | |
| exit 1 | |
| fi | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-reports | |
| path: phase7-artifacts/coverage-reports/ | |
| deploy-testflight: | |
| runs-on: macos-15 | |
| needs: build-and-test-ios | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xcodegen | |
| run: brew install xcodegen | |
| - name: Generate Xcode project | |
| run: xcodegen generate | |
| - name: Install certificate & profile | |
| run: | | |
| # Create keychain | |
| security create-keychain -p "" build.keychain | |
| security default-keychain -s build.keychain | |
| security unlock-keychain -p "" build.keychain | |
| # Import certificate | |
| echo "$APPLE_CERTIFICATE_P12" | base64 -d > cert.p12 | |
| security import cert.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
| security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain | |
| # Install provisioning profile | |
| mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
| echo "$PROVISIONING_PROFILE_B64" | base64 -d > ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision | |
| env: | |
| APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }} | |
| APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
| PROVISIONING_PROFILE_B64: ${{ secrets.PROVISIONING_PROFILE_B64 }} | |
| - name: Decode Firebase config | |
| run: echo "$FIREBASE_PLIST_B64" | base64 -d > App/GoogleService-Info.plist | |
| env: | |
| FIREBASE_PLIST_B64: ${{ secrets.FIREBASE_PLIST_B64 }} | |
| - name: Archive | |
| run: > | |
| xcodebuild archive | |
| -scheme BabYap | |
| -archivePath build/BabYap.xcarchive | |
| -allowProvisioningUpdates | |
| -skipPackagePluginValidation | |
| - name: Export IPA | |
| run: > | |
| xcodebuild -exportArchive | |
| -archivePath build/BabYap.xcarchive | |
| -exportPath build/ | |
| -exportOptionsPlist ExportOptions.plist | |
| - name: Upload to TestFlight | |
| run: > | |
| xcrun altool --upload-app | |
| -f build/BabYap.ipa | |
| --type ios | |
| --apiKey "$ASC_KEY_ID" | |
| --apiIssuer "$ASC_ISSUER_ID" | |
| env: | |
| ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} | |
| ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} | |
| ASC_PRIVATE_KEY_B64: ${{ secrets.ASC_PRIVATE_KEY_B64 }} |