Merge pull request #17 from ViewFeature/docs/add-observation-to-descr… #47
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: Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-macos: | |
| name: Test on macOS | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Show Xcode and Swift version | |
| run: | | |
| xcodebuild -version | |
| swift --version | |
| - name: Cache Swift Package Manager | |
| uses: actions/cache@v4 | |
| with: | |
| path: .build | |
| key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }} | |
| restore-keys: | | |
| ${{ runner.os }}-spm- | |
| - name: Build | |
| run: swift build --build-tests | |
| - name: Run Tests | |
| run: swift test --parallel --enable-code-coverage | |
| - name: Generate Code Coverage | |
| run: | | |
| xcrun llvm-cov export \ | |
| .build/debug/FlowPackageTests.xctest/Contents/MacOS/FlowPackageTests \ | |
| -instr-profile .build/debug/codecov/default.profdata \ | |
| -format="lcov" \ | |
| -ignore-filename-regex=".build|Tests" > coverage.lcov | |
| - name: Upload Coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.lcov | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-macos | |
| path: .build/debug/*.xctest | |
| test-ios: | |
| name: Test on iOS | |
| runs-on: macos-26 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Show Xcode and Swift version | |
| run: | | |
| xcodebuild -version | |
| swift --version | |
| - name: List available simulators | |
| run: xcrun simctl list devices available | |
| - name: Run Tests on iOS Simulator | |
| run: | | |
| xcodebuild test \ | |
| -scheme Flow \ | |
| -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6' \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation \ | |
| -enableCodeCoverage YES | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-ios | |
| path: .build/debug/*.xctest | |
| # SwiftLint check | |
| swiftlint: | |
| name: SwiftLint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: SwiftLint | |
| uses: norio-nomura/action-swiftlint@3.2.1 | |
| with: | |
| args: --strict | |
| # Build for all platforms | |
| build-platforms: | |
| name: Build ${{ matrix.platform }} | |
| runs-on: macos-26 | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - iOS | |
| - macOS | |
| - watchOS | |
| - tvOS | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build for ${{ matrix.platform }} | |
| run: | | |
| case "${{ matrix.platform }}" in | |
| iOS) | |
| xcodebuild build \ | |
| -scheme Flow \ | |
| -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6' \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation | |
| ;; | |
| macOS) | |
| xcodebuild build \ | |
| -scheme Flow \ | |
| -destination 'platform=macOS' \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation | |
| ;; | |
| watchOS) | |
| xcodebuild build \ | |
| -scheme Flow \ | |
| -destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.5' \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation | |
| ;; | |
| tvOS) | |
| xcodebuild build \ | |
| -scheme Flow \ | |
| -destination 'platform=tvOS Simulator,name=Apple TV' \ | |
| -skipPackagePluginValidation \ | |
| -skipMacroValidation | |
| ;; | |
| esac | |
| # Status check for required jobs | |
| test-status: | |
| name: Test Status | |
| runs-on: ubuntu-latest | |
| needs: [test-macos, test-ios, swiftlint, build-platforms] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [[ "${{ needs.test-macos.result }}" != "success" ]]; then | |
| echo "::error::macOS tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.test-ios.result }}" != "success" ]]; then | |
| echo "::error::iOS tests failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.swiftlint.result }}" != "success" ]]; then | |
| echo "::error::SwiftLint check failed" | |
| exit 1 | |
| fi | |
| if [[ "${{ needs.build-platforms.result }}" != "success" ]]; then | |
| echo "::error::Platform builds failed" | |
| exit 1 | |
| fi | |
| echo "✅ All tests passed!" |