feat: implement GZIP compression/decompression with >90% test coverage #73
Workflow file for this run
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: Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Run Unit Tests | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| swift-version: ['6.0'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Select Xcode version | |
| run: sudo xcode-select -s /Applications/Xcode.app | |
| - name: Show Swift version | |
| run: swift --version | |
| - name: Resolve dependencies | |
| run: swift package resolve | |
| - name: Build package | |
| run: swift build | |
| - name: Run tests with code coverage | |
| run: | | |
| swift test --enable-code-coverage | |
| - name: Find coverage data | |
| id: coverage | |
| run: | | |
| PROF_DATA=$(find .build -name "default.profdata" -type f | head -1) | |
| # Find the test executable binary inside the .xctest bundle | |
| XCTEST_BUNDLE=$(find .build -name "DesignAlgorithmsKitPackageTests.xctest" -type d | head -1) | |
| if [ -n "$XCTEST_BUNDLE" ]; then | |
| BINARY="$XCTEST_BUNDLE/Contents/MacOS/DesignAlgorithmsKitPackageTests" | |
| else | |
| # Fallback: try to find the binary directly | |
| BINARY=$(find .build -name "DesignAlgorithmsKitPackageTests" -type f -path "*/Contents/MacOS/*" | head -1) | |
| fi | |
| echo "profdata=$PROF_DATA" >> $GITHUB_OUTPUT | |
| echo "binary=$BINARY" >> $GITHUB_OUTPUT | |
| echo "Found profdata: $PROF_DATA" | |
| echo "Found binary: $BINARY" | |
| echo "XCTest bundle: $XCTEST_BUNDLE" | |
| - name: Generate code coverage report | |
| if: steps.coverage.outputs.profdata != '' && steps.coverage.outputs.binary != '' | |
| run: | | |
| if [ -f "${{ steps.coverage.outputs.binary }}" ]; then | |
| xcrun llvm-cov export -format="lcov" \ | |
| -instr-profile="${{ steps.coverage.outputs.profdata }}" \ | |
| "${{ steps.coverage.outputs.binary }}" \ | |
| -ignore-filename-regex=".build|Tests" > coverage.lcov | |
| echo "Coverage report generated successfully" | |
| ls -lh coverage.lcov | |
| else | |
| echo "Binary not found, skipping coverage generation" | |
| echo "Binary path: ${{ steps.coverage.outputs.binary }}" | |
| fi | |
| - name: Upload coverage to Codecov | |
| if: steps.coverage.outputs.profdata != '' && steps.coverage.outputs.binary != '' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.lcov | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| - name: Generate HTML coverage report | |
| if: steps.coverage.outputs.profdata != '' && steps.coverage.outputs.binary != '' | |
| run: | | |
| if [ -f "${{ steps.coverage.outputs.binary }}" ]; then | |
| mkdir -p .build/coverage-html || true | |
| xcrun llvm-cov show -format="html" \ | |
| -instr-profile="${{ steps.coverage.outputs.profdata }}" \ | |
| -output-dir=.build/coverage-html \ | |
| "${{ steps.coverage.outputs.binary }}" \ | |
| -ignore-filename-regex=".build|Tests" || echo "HTML report generation skipped" | |
| # Ensure directory exists even if generation fails | |
| touch .build/coverage-html/index.html || true | |
| else | |
| echo "Binary not found, skipping HTML report generation" | |
| fi | |
| - name: Upload coverage HTML report | |
| if: steps.coverage.outputs.profdata != '' && always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: .build/coverage-html | |
| retention-days: 30 | |
| if-no-files-found: ignore |