diff --git a/.github/workflows/apple-tests.yml b/.github/workflows/apple-tests.yml deleted file mode 100644 index acc1f55..0000000 --- a/.github/workflows/apple-tests.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Apple Tests - -on: - workflow_call: - inputs: - name: - required: true - type: string - xcode-version: - default: '26.5' - required: false - type: string - platform: - default: 'macOS-26' - required: false - type: string - package-name: - required: true - type: string - destination: - required: true - type: string - coverage-enabled: - default: false - required: false - type: boolean - -jobs: - apple-tests: - name: "Testing on ${{ inputs.name }}" - runs-on: ${{ inputs.platform }} - steps: - - name: ⬇️ Get Sources - uses: actions/checkout@v6.0.2 - - - name: 🍺 Homebrew Dependencies - run: | - brew install xcbeautify - - - name: β˜‘οΈ Xcode Select - run: sudo xcode-select -switch /Applications/Xcode_${{ inputs.xcode-version }}.app - - - name: βš’οΈ Build Package - env: - NSUnbufferedIO: YES - run: | - set -o pipefail && xcodebuild build-for-testing \ - -scheme "${{ inputs.package-name }}" \ - -destination "${{ inputs.destination }}" \ - -derivedDataPath .xcbuild 2>&1 | xcbeautify --quiet --renderer github-actions - - - name: πŸ§ͺ Run Tests with Coverage - env: - NSUnbufferedIO: YES - run: | - set -o pipefail && xcodebuild test-without-building \ - -scheme "${{ inputs.package-name }}" \ - -destination "${{ inputs.destination }}" \ - -enableCodeCoverage YES \ - -derivedDataPath .xcbuild 2>&1 | xcbeautify --renderer github-actions - - - name: πŸ” Debug - List coverage files - if: inputs.coverage-enabled - run: | - echo "=== Looking for coverage files ===" - find .xcbuild -name "*.profdata" -o -name "*.xctest" 2>/dev/null || echo "No files found" - echo "=== Directory structure ===" - find .xcbuild -type d -name "*Coverage*" -o -name "*DerivedData*" 2>/dev/null || echo "No special directories" - - - name: πŸ”€ Move Coverage Files - if: inputs.coverage-enabled - run: | - mkdir -p coverage-artifacts - - # Copiar todos os arquivos .profdata - find .xcbuild -name "*.profdata" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true - - # Copiar todos os arquivos .xctest (exceto os dentro de .dSYM) - find .xcbuild -name "*.xctest" -not -path "*/.dSYM/*" -exec cp -r {} coverage-artifacts/ \; 2>/dev/null || true - - echo "=== Files moved to coverage-artifacts ===" - ls -la coverage-artifacts/ - - - name: πŸ“€ Upload Coverage Data - if: inputs.coverage-enabled - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ inputs.name }} - path: coverage-artifacts/ diff --git a/.github/workflows/coverage-upload.yml b/.github/workflows/coverage-upload.yml deleted file mode 100644 index 60bb173..0000000 --- a/.github/workflows/coverage-upload.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Coverage Upload - -on: - workflow_call: - inputs: - xcode-version: - default: '26.5' - required: false - type: string - platform: - default: 'macOS-26' - required: false - type: string - -jobs: - coverage-upload: - runs-on: ${{ inputs.platform }} - steps: - - name: ⬇️ Get Sources - uses: actions/checkout@v6.0.2 - - - name: πŸ“₯ Download All Artifacts - uses: actions/download-artifact@v7.0.0 - with: - path: artifacts - - - name: πŸ“ List Downloaded Artifacts - run: | - echo "Artifacts downloaded:" - ls -la artifacts/ - echo "Subdirectories:" - find artifacts -type d -mindepth 1 -maxdepth 1 - - - name: β˜‘οΈ Xcode Select - run: sudo xcode-select -switch /Applications/Xcode_${{ inputs.xcode-version }}.app - - - name: πŸ“ Process Coverage for Each Destination - run: | - # Iterar por cada subpasta de artefato - for artifact_dir in artifacts/*/; do - if [ -d "$artifact_dir" ]; then - echo "=== Processing: $artifact_dir ===" - ( - cd "$artifact_dir" - - # Extrair o nome do diretΓ³rio (remove "artifacts/" e "/") - ARTIFACT_DIR_NAME=$(basename "$artifact_dir") - - # Encontrar todos os arquivos .profdata - PROFDATA_FILES=$(find . -name "*.profdata" | head -n 1) - PROFDATA_FILE="$PROFDATA_FILES" - - if [ -z "$PROFDATA_FILE" ]; then - echo "Nenhum arquivo .profdata encontrado em $artifact_dir" - exit 1 - fi - - # Encontrar todos os bundles .xctest - find . -name "*.xctest" -type d | while read -r xctest_bundle; do - if [ -n "$xctest_bundle" ]; then - # Extrair o nome base do bundle (sem .xctest) - BUNDLE_NAME=$(basename "$xctest_bundle" .xctest) - - # Procurar o executΓ‘vel usando glob pattern (funciona em todas as plataformas) - EXECUTABLE_PATH=$(find "$xctest_bundle" -name "$BUNDLE_NAME" -type f -not -path "*/.dSYM/*" | head -n 1) - - # Verificar se o executΓ‘vel existe - if [ -n "$EXECUTABLE_PATH" ] && [ -f "$EXECUTABLE_PATH" ]; then - echo "Processando cobertura para: $BUNDLE_NAME" - echo "ExecutΓ‘vel encontrado em: $EXECUTABLE_PATH" - - # Nome do arquivo de saΓ­da usando MD5 do artifact directory - OUTPUT_FILE="${{ github.workspace }}/${ARTIFACT_DIR_NAME}.lcov" - - # Gerar relatΓ³rio de cobertura - xcrun llvm-cov export "$EXECUTABLE_PATH" \ - -format="lcov" \ - -instr-profile="$PROFDATA_FILE" \ - -ignore-filename-regex=".build|Tests" > "$OUTPUT_FILE" - - echo "Gerado: $OUTPUT_FILE" - else - echo "ExecutΓ‘vel nΓ£o encontrado para: $BUNDLE_NAME" - echo "Buscado em: $xctest_bundle" - fi - fi - done - ) - fi - done - - - name: πŸ“‹ List Generated LCOV Files - run: | - echo "LCOV files generated:" - ls -la *.lcov - - - name: πŸ“¦ Upload to Codecov - uses: codecov/codecov-action@v6.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: "*.lcov" - verbose: true diff --git a/.github/workflows/no-breaking-changes.yml b/.github/workflows/no-breaking-changes.yml deleted file mode 100644 index 77038e0..0000000 --- a/.github/workflows/no-breaking-changes.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: No API Breaking Changes - -on: - workflow_call: - inputs: - swift-version: - default: '6.3' - required: false - type: string - platform: - default: 'macOS-26' - required: false - type: string - -jobs: - breaking-changes: - runs-on: ${{ inputs.platform }} - name: Checking API Breaking Changes - steps: - - name: β˜‘οΈ Swift Select - uses: SwiftyLab/setup-swift@v1.14.0 - with: - swift-version: ${{ inputs.swift-version }} - - - name: ⬇️ Get Sources - uses: actions/checkout@v6.0.2 - with: - fetch-depth: 0 - - - name: πŸ’” Checking API Breaking Changes - run: | - latest_tag=$(git describe --tags --abbrev=0) - echo "Checking breaking changes for $latest_tag" - swift package diagnose-api-breaking-changes $latest_tag diff --git a/.github/workflows/swift-ci.yml b/.github/workflows/swift-ci.yml new file mode 100644 index 0000000..722d771 --- /dev/null +++ b/.github/workflows/swift-ci.yml @@ -0,0 +1,511 @@ +name: Swift CI + +on: + workflow_call: + inputs: + # ── Common ────────────────────────────────────────────── + name: + description: 'Package name (repository/directory identifier)' + required: true + type: string + product-name: + description: 'Product name (importable library name)' + default: '' + required: false + type: string + swift-version: + description: 'Swift version for compilation and tests' + default: '6.2' + required: false + type: string + format-swift-version: + description: 'Swift version for swift-format (can use latest)' + default: '6.3' + required: false + type: string + platform: + default: 'macOS-26' + required: false + type: string + + # ── Step 1: Format ────────────────────────────────────── + enable-format: + description: 'Step 1 – Validate swift format' + default: true + required: false + type: boolean + format-path: + default: '.' + required: false + type: string + format-config: + default: '.swift-format' + required: false + type: string + + # ── Step 2: Breaking Changes ──────────────────────────── + enable-breaking-changes: + description: 'Step 2 – Check API breaking changes' + default: false + required: false + type: boolean + skip-on-major-update: + default: true + required: false + type: boolean + force-skip-breaking-changes: + description: 'Force skip breaking changes check' + default: false + required: false + type: boolean + + # ── Step 3: Apple Tests ───────────────────────────────── + enable-apple-tests: + description: 'Step 3 – Run Apple platform tests' + default: false + required: false + type: boolean + xcode-version: + default: '26.6' + required: false + type: string + package-name: + default: '' + required: false + type: string + apple-coverage-enabled: + default: false + required: false + type: boolean + + # ── Step 3: Third Party Tests ─────────────────────────── + enable-third-party-tests: + description: 'Step 3 – Run third-party platform tests' + default: false + required: false + type: boolean + third-party-coverage-enabled: + default: false + required: false + type: boolean + + # ── Step 3: Linkage Test (FoundationEssentials) ───────── + enable-linkage-test: + description: 'Step 3 – Run linkage test for FoundationEssentials (Linux only)' + default: false + required: false + type: boolean + + # ── Step 4: Coverage Upload ───────────────────────────── + enable-coverage-upload: + description: 'Step 4 – Upload coverage to Codecov' + default: false + required: false + type: boolean + secrets: + CODECOV_TOKEN: + required: false + +# ═══════════════════════════════════════════════════════════════ +# HIERARQUIA +# +# format-check +# β”‚ +# β–Ό +# breaking-changes +# β”‚ +# β”œβ”€β”€β–Ί apple-tests (matrix) +# β”œβ”€β”€β–Ί third-party-tests (matrix) +# └──► linkage-test (Linux) +# β”‚ +# β–Ό +# coverage-upload +# ═══════════════════════════════════════════════════════════════ + +jobs: + # ── STEP 1 ────────────────────────────────────────────────── + format-check: + name: "🎨 Format" + if: inputs.enable-format + runs-on: ${{ inputs.platform }} + timeout-minutes: 10 + steps: + - name: β˜‘οΈ Swift Select + uses: SwiftyLab/setup-swift@v1.14.0 + with: + swift-version: ${{ inputs.format-swift-version }} + + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + + - name: 🎨 Check Formatting + run: | + echo "=== Running swift format lint ===" + if [ -f "${{ inputs.format-config }}" ]; then + swift format lint --strict --recursive \ + --configuration "${{ inputs.format-config }}" \ + "${{ inputs.format-path }}" + else + echo "⚠️ ${{ inputs.format-config }} not found, using defaults" + swift format lint --strict --recursive "${{ inputs.format-path }}" + fi + echo "βœ… Formatting check passed" + + # ── STEP 2 ────────────────────────────────────────────────── + breaking-changes: + name: "πŸ’” Breaking Changes" + needs: format-check + if: | + always() && + inputs.enable-breaking-changes && + !inputs.force-skip-breaking-changes && + (needs.format-check.result == 'success' || needs.format-check.result == 'skipped') && + !contains(github.event.pull_request.labels.*.name, 'major-release') && + !contains(github.event.pull_request.labels.*.name, 'breaking-change') && + !contains(github.event.pull_request.labels.*.name, 'release/major') && + !startsWith(github.head_ref, 'release/v') && + !startsWith(github.head_ref, 'v') && + github.head_ref != 'major' && + github.head_ref != 'next-major' + runs-on: ${{ inputs.platform }} + timeout-minutes: 15 + steps: + - name: β˜‘οΈ Swift Select + uses: SwiftyLab/setup-swift@v1.14.0 + with: + swift-version: ${{ inputs.swift-version }} + + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + with: + fetch-depth: 0 + + - name: πŸ’” Check API Breaking Changes + run: | + # ── Skip on push to main ──────────────────────────── + if [ "${{ github.event_name }}" != "pull_request" ]; then + echo "Push to main detected, skipping" + exit 0 + fi + + # ── DetecΓ§Γ£o automΓ‘tica por major bump ────────────── + if [ "${{ inputs.skip-on-major-update }}" == "true" ]; then + latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [ -z "$latest_tag" ]; then + echo "No tags found, skipping" + exit 0 + fi + echo "Latest tag: $latest_tag" + + tag_version="${latest_tag#v}" + latest_major=$(echo "$tag_version" | cut -d. -f1) + current_ref="${{ github.ref_name }}" + ref_version="${current_ref#v}" + current_major=$(echo "$ref_version" | cut -d. -f1) + + if [[ "$latest_major" =~ ^[0-9]+$ ]] && [[ "$current_major" =~ ^[0-9]+$ ]]; then + if [ "$latest_major" != "$current_major" ]; then + echo "⚠️ Major bump detectado ($latest_tag β†’ $current_ref)" + exit 0 + fi + fi + fi + + echo "Checking breaking changes against $latest_tag" + swift package diagnose-api-breaking-changes "$latest_tag" + + # ── STEP 3A ───────────────────────────────────────────────── + apple-tests: + name: "🍎 ${{ matrix.name }}" + needs: [format-check, breaking-changes] + if: | + always() && + inputs.enable-apple-tests && + (needs.breaking-changes.result == 'success' || needs.breaking-changes.result == 'skipped') + strategy: + fail-fast: false + matrix: + include: + - destination: "platform=iOS Simulator,arch=arm64,name=iPhone 17 Pro,OS=26.5" + name: "iOS" + - destination: "platform=iOS Simulator,arch=arm64,name=iPad (A16),OS=26.5" + name: "iPadOS" + - destination: "platform=watchOS Simulator,arch=arm64,name=Apple Watch Series 11 (42mm),OS=26.5" + name: "watchOS" + - destination: "platform=tvOS Simulator,arch=arm64,name=Apple TV 4K (3rd generation) (at 1080p),OS=26.5" + name: "tvOS" + - destination: "platform=visionOS Simulator,arch=arm64,name=Apple Vision Pro,OS=26.5" + name: "visionOS" + - destination: "platform=macOS,arch=arm64,name=My Mac" + name: "macOS" + - destination: "platform=macOS,arch=arm64,variant=Mac Catalyst,name=My Mac" + name: "macOS Catalyst" + runs-on: ${{ inputs.platform }} + timeout-minutes: 30 + steps: + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + + - name: 🍺 Homebrew Dependencies + run: brew install xcbeautify + + - name: β˜‘οΈ Xcode Select + run: sudo xcode-select -switch /Applications/Xcode_${{ inputs.xcode-version }}.app + + - name: βš’οΈ Build Package + env: + NSUnbufferedIO: YES + run: | + set -o pipefail && xcodebuild build-for-testing \ + -scheme "${{ inputs.package-name }}" \ + -destination "${{ matrix.destination }}" \ + -derivedDataPath .xcbuild 2>&1 | xcbeautify --quiet --renderer github-actions + + - name: πŸ§ͺ Run Tests with Coverage + env: + NSUnbufferedIO: YES + run: | + set -o pipefail && xcodebuild test-without-building \ + -scheme "${{ inputs.package-name }}" \ + -destination "${{ matrix.destination }}" \ + -enableCodeCoverage YES \ + -derivedDataPath .xcbuild 2>&1 | xcbeautify --renderer github-actions + + - name: πŸ”€ Move Coverage Files + if: inputs.apple-coverage-enabled + run: | + mkdir -p coverage-artifacts + find .xcbuild -name "*.profdata" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true + find .xcbuild -name "*.xctest" -not -path "*/.dSYM/*" -exec cp -r {} coverage-artifacts/ \; 2>/dev/null || true + + - name: πŸ“€ Upload Coverage Data + if: inputs.apple-coverage-enabled + uses: actions/upload-artifact@v7.0.1 + with: + name: apple-${{ matrix.name }} + path: coverage-artifacts/ + + # ── STEP 3B ───────────────────────────────────────────────── + third-party-tests: + name: "πŸ”§ ${{ matrix.name }}" + needs: [format-check, breaking-changes] + if: | + always() && + inputs.enable-third-party-tests && + (needs.breaking-changes.result == 'success' || needs.breaking-changes.result == 'skipped') + strategy: + fail-fast: false + matrix: + include: + - platform: "ubuntu-latest" + name: "Linux" + # - platform: "windows-latest" + # name: "Windows" + runs-on: ${{ matrix.platform }} + timeout-minutes: 20 + steps: + - name: β˜‘οΈ Swift Select + uses: SwiftyLab/setup-swift@v1.14.0 + with: + swift-version: ${{ inputs.swift-version }} + + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + + - name: βš’οΈ Test Package + run: swift test --enable-code-coverage + + - name: πŸ”€ Move Coverage Files (Unix) + if: inputs.third-party-coverage-enabled && (runner.os == 'Linux' || runner.os == 'macOS') + run: | + mkdir -p coverage-artifacts + find .build -name "*.profdata" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true + find .build -name "*.xctest" -not -path "*/.dSYM/*" -exec cp -r {} coverage-artifacts/ \; 2>/dev/null || true + + - name: πŸ”€ Move Coverage Files (Windows) + if: inputs.third-party-coverage-enabled && runner.os == 'Windows' + shell: pwsh + run: | + New-Item -ItemType Directory -Path "coverage-artifacts" -Force + Get-ChildItem -Path .build -Recurse -Filter "*.profdata" | ForEach-Object { + Copy-Item $_.FullName -Destination "coverage-artifacts" -Force + } + Get-ChildItem -Path .build -Recurse -Directory -Filter "*.xctest" | Where-Object { + $_.FullName -notlike "*\.dSYM\*" + } | ForEach-Object { + Copy-Item $_.FullName -Destination "coverage-artifacts" -Recurse -Force + } + + - name: πŸ“€ Upload Artifacts + if: inputs.third-party-coverage-enabled + uses: actions/upload-artifact@v7.0.1 + with: + name: third-party-${{ matrix.name }} + path: coverage-artifacts/ + + # ── STEP 3C: Linkage Test (FoundationEssentials) ─────────── + linkage-test: + name: "πŸ”— Linkage Test (FoundationEssentials)" + needs: [format-check, breaking-changes] + if: | + always() && + inputs.enable-linkage-test && + (needs.breaking-changes.result == 'success' || needs.breaking-changes.result == 'skipped') + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + + - name: β˜‘οΈ Swift Select + uses: SwiftyLab/setup-swift@v1.14.0 + with: + swift-version: ${{ inputs.swift-version }} + + - name: πŸ”— Setup Linkage Test Package + env: + PKG_NAME: ${{ inputs.name }} + PROD_NAME: ${{ inputs.product-name != '' && inputs.product-name || inputs.name }} + run: | + set -e + echo "Setting up linkage test for package '$PKG_NAME', product '$PROD_NAME'..." + + mkdir -p Tests/LinkageTest/Sources + + cat > Tests/LinkageTest/Package.swift << EOF + // swift-tools-version: 6.2 + import PackageDescription + + let package = Package( + name: "linkageTest", + platforms: [.macOS(.v15)], + dependencies: [ + .package(name: "$PKG_NAME", path: "../.."), + ], + targets: [ + .executableTarget( + name: "linkageTest", + dependencies: [ + .product(name: "$PROD_NAME", package: "$PKG_NAME"), + ] + ), + ] + ) + EOF + + cat > Tests/LinkageTest/Sources/main.swift << 'EOF' + import ${{ inputs.name }} + + // This executable only imports the package + // If the package uses Foundation (not FoundationEssentials), + // the binary will be linked against libFoundation.so + print("Linkage test executable") + EOF + + echo 'Linkage test package created at Tests/LinkageTest/' + ls -la Tests/LinkageTest/ + + - name: βš’οΈ Build Linkage Test + run: | + cd Tests/LinkageTest + swift build + + - name: πŸ” Verify Linkage + run: | + set -e + cd Tests/LinkageTest + + # Find the built binary + BINARY_PATH=$(find .build -name 'linkageTest' -type f -executable | head -n 1) + + if [ -z "$BINARY_PATH" ]; then + echo '❌ Error: Could not find linkage test binary' + find .build -type f -executable 2>/dev/null || true + exit 1 + fi + + echo "βœ… Found binary: $BINARY_PATH" + echo '' + echo 'LDD output:' + ldd "$BINARY_PATH" + echo '' + + # Check if the binary is linked against libFoundation.so + if ldd "$BINARY_PATH" | grep -q 'libFoundation.so'; then + echo '❌ FAILURE: Binary is linked against libFoundation.so' + echo 'This means the package uses Foundation instead of FoundationEssentials' + echo 'On Linux, this requires importing FoundationNetworking for URLSession APIs' + exit 1 + else + echo 'βœ… SUCCESS: Binary is not linked against libFoundation.so - linkage test passed' + echo 'The package correctly uses FoundationEssentials' + fi + + # ── STEP 4 ────────────────────────────────────────────────── + coverage-upload: + name: "πŸ“€ Coverage Upload" + needs: [apple-tests, third-party-tests, linkage-test] + if: | + always() && + inputs.enable-coverage-upload && + (needs.apple-tests.result != 'cancelled' || needs.third-party-tests.result != 'cancelled') + runs-on: ${{ inputs.platform }} + timeout-minutes: 15 + steps: + - name: ⬇️ Get Sources + uses: actions/checkout@v6.0.2 + + - name: πŸ“₯ Download All Artifacts + uses: actions/download-artifact@v7.0.0 + with: + path: artifacts + + - name: πŸ“ List Downloaded Artifacts + run: | + echo "Artifacts downloaded:" + ls -la artifacts/ + find artifacts -type d -mindepth 1 -maxdepth 1 + + - name: β˜‘οΈ Xcode Select + run: sudo xcode-select -switch /Applications/Xcode_${{ inputs.xcode-version }}.app + + - name: πŸ“ Process Coverage for Each Destination + run: | + for artifact_dir in artifacts/*/; do + if [ -d "$artifact_dir" ]; then + echo "=== Processing: $artifact_dir ===" + ( + cd "$artifact_dir" + ARTIFACT_DIR_NAME=$(basename "$artifact_dir") + PROFDATA_FILE=$(find . -name "*.profdata" | head -n 1) + if [ -z "$PROFDATA_FILE" ]; then + echo "Nenhum .profdata em $artifact_dir" + exit 1 + fi + find . -name "*.xctest" -type d | while read -r xctest_bundle; do + if [ -n "$xctest_bundle" ]; then + BUNDLE_NAME=$(basename "$xctest_bundle" .xctest) + EXECUTABLE_PATH=$(find "$xctest_bundle" -name "$BUNDLE_NAME" -type f -not -path "*/.dSYM/*" | head -n 1) + if [ -n "$EXECUTABLE_PATH" ] && [ -f "$EXECUTABLE_PATH" ]; then + OUTPUT_FILE="${{ github.workspace }}/${ARTIFACT_DIR_NAME}.lcov" + xcrun llvm-cov export "$EXECUTABLE_PATH" \ + -format="lcov" \ + -instr-profile="$PROFDATA_FILE" \ + -ignore-filename-regex=".build|Tests" > "$OUTPUT_FILE" + echo "Gerado: $OUTPUT_FILE" + fi + fi + done + ) + fi + done + + - name: πŸ“‹ List Generated LCOV Files + run: ls -la *.lcov + + - name: πŸ“¦ Upload to Codecov + uses: codecov/codecov-action@v6.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: "*.lcov" + verbose: true \ No newline at end of file diff --git a/.github/workflows/third-party-tests.yml b/.github/workflows/third-party-tests.yml deleted file mode 100644 index e8efbb3..0000000 --- a/.github/workflows/third-party-tests.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Third Party Tests - -on: - workflow_call: - inputs: - name: - required: true - type: string - swift-version: - default: '6.3' - required: false - type: string - platform: - required: true - type: string - coverage-enabled: - default: false - required: false - type: boolean - -jobs: - third-party-tests: - name: "Testing on ${{ inputs.name }}" - runs-on: ${{ inputs.platform }} - steps: - - name: β˜‘οΈ Swift Select - uses: SwiftyLab/setup-swift@v1.14.0 - with: - swift-version: ${{ inputs.swift-version }} - - - name: ⬇️ Get Sources - uses: actions/checkout@v6.0.2 - - - name: βš’οΈ Test Package - run: swift test --enable-code-coverage - - - name: πŸ” Debug - List coverage files (Unix) - if: inputs.coverage-enabled && (runner.os == 'Linux' || runner.os == 'macOS') - run: | - echo "=== Looking for coverage files ===" - find .build -name "*.profdata" -o -name "*.xctest" 2>/dev/null || echo "No files found" - - - name: πŸ” Debug - List coverage files (Windows) - if: inputs.coverage-enabled && runner.os == 'Windows' - shell: pwsh - run: | - Write-Host "=== Looking for coverage files ===" - Get-ChildItem -Path .build -Recurse -Include "*.profdata", "*.xctest" -ErrorAction SilentlyContinue - - - name: πŸ”€ Move Coverage Files (Unix) - if: inputs.coverage-enabled && (runner.os == 'Linux' || runner.os == 'macOS') - run: | - mkdir -p coverage-artifacts - - # Copiar todos os arquivos .profdata - find .build -name "*.profdata" -exec cp {} coverage-artifacts/ \; 2>/dev/null || true - - # Copiar todos os arquivos .xctest (exceto os dentro de .dSYM) - find .build -name "*.xctest" -not -path "*/.dSYM/*" -exec cp -r {} coverage-artifacts/ \; 2>/dev/null || true - - echo "=== Files moved to coverage-artifacts ===" - ls -la coverage-artifacts/ - - - name: πŸ”€ Move Coverage Files (Windows) - if: inputs.coverage-enabled && runner.os == 'Windows' - shell: pwsh - run: | - New-Item -ItemType Directory -Path "coverage-artifacts" -Force - - # Copiar todos os arquivos .profdata - Get-ChildItem -Path .build -Recurse -Filter "*.profdata" | ForEach-Object { - Copy-Item $_.FullName -Destination "coverage-artifacts" -Force - } - - # Copiar todos os arquivos .xctest (exceto os dentro de .dSYM) - Get-ChildItem -Path .build -Recurse -Directory -Filter "*.xctest" | Where-Object { - $_.FullName -notlike "*\.dSYM\*" - } | ForEach-Object { - Copy-Item $_.FullName -Destination "coverage-artifacts" -Recurse -Force - } - - Write-Host "=== Files moved to coverage-artifacts ===" - Get-ChildItem -Path "coverage-artifacts" - - - name: πŸ“€ Upload Artifacts - if: inputs.coverage-enabled - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ inputs.name }} - path: coverage-artifacts/