diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index dcaeb355..097ae590 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -90,18 +90,32 @@ jobs: run: make test-coverage - name: Merge and generate coverage report run: | - llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata + mapfile -t PROFDATA_FILES < <(find . -type f -path '*/codecov/*.profdata' -print) + if [ "${#PROFDATA_FILES[@]}" -eq 0 ]; then + echo "No coverage profile data found" + exit 1 + fi + llvm-profdata merge -sparse "${PROFDATA_FILES[@]}" -o default.profdata for file in **/Tests; do BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")" - XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest') - for XCTEST_PATH in $XCTEST_PATHS; do - echo "Processing $XCTEST_PATH" - # Export the code coverage for the current subproject and append to coverage.lcov - llvm-cov export "${XCTEST_PATH}" \ - -instr-profile=default.profdata \ - -format lcov >> coverage.lcov \ - -ignore-filename-regex=".build/repositories/.*|.*/JAMTests/.*" - done + while IFS= read -r TEST_BUNDLE; do + echo "Processing $TEST_BUNDLE" + llvm-cov export "${TEST_BUNDLE}" \ + -instr-profile=default.profdata \ + -format lcov >> coverage.lcov \ + -ignore-filename-regex=".build/repositories/.*|.*/JAMTests/.*" + done < <(find "${BIN_PATH}" -type d -name '*.xctest' -print) + + while IFS= read -r TEST_LIBRARY; do + TEST_RUNNER="${TEST_LIBRARY%.so}-test-runner" + if [ -f "${TEST_RUNNER}" ]; then + echo "Processing $TEST_LIBRARY" + llvm-cov export "${TEST_LIBRARY}" \ + -instr-profile=default.profdata \ + -format lcov >> coverage.lcov \ + -ignore-filename-regex=".build/repositories/.*|.*/JAMTests/.*" + fi + done < <(find "${BIN_PATH}" -type f -name '*.so' -print) done - uses: codecov/codecov-action@v4 with: diff --git a/.github/workflows/polka-codes-review-pr.yml b/.github/workflows/polka-codes-review-pr.yml index 87afe648..5144cc90 100644 --- a/.github/workflows/polka-codes-review-pr.yml +++ b/.github/workflows/polka-codes-review-pr.yml @@ -19,8 +19,8 @@ concurrency: cancel-in-progress: true jobs: - review_gemini: - name: Review With Gemini + review_polka: + name: Review With Polka Codes timeout-minutes: 40 runs-on: ubuntu-latest steps: @@ -29,19 +29,29 @@ jobs: with: fetch-depth: 0 - - name: Google Auth - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }} + - name: Check Polka Codes configuration + id: check-polka-config + shell: bash + env: + POLKA_BASE_URL: ${{ secrets.POLKA_BASE_URL }} + POLKA_API_KEY: ${{ secrets.POLKA_API_KEY }} + run: | + if [[ -n "$POLKA_BASE_URL" && -n "$POLKA_API_KEY" ]]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + echo "Polka Codes secrets are not configured; skipping review." + fi - - name: Run Polka Codes (Gemini) + - name: Run Polka Codes + if: steps.check-polka-config.outputs.enabled == 'true' uses: polka-codes/action@master with: pr_number: ${{ github.event.inputs.pr_number || github.event.number }} review: true env: - POLKA_API_PROVIDER: google-vertex - POLKA_MODEL: gemini-3-pro-preview + POLKA_API_PROVIDER: openai-compatible + POLKA_BASE_URL: ${{ secrets.POLKA_BASE_URL }} + POLKA_API_KEY: ${{ secrets.POLKA_API_KEY }} + POLKA_MODEL: gpt-5.6-sol GITHUB_TOKEN: ${{ github.token }} - GOOGLE_VERTEX_LOCATION: global - GOOGLE_VERTEX_PROJECT: ${{ secrets.GOOGLE_VERTEX_PROJECT }} diff --git a/Boka/Tests/BokaTests/BokaTests.swift b/Boka/Tests/BokaTests/BokaTests.swift index 4ca754fa..8b19df04 100644 --- a/Boka/Tests/BokaTests/BokaTests.swift +++ b/Boka/Tests/BokaTests/BokaTests.swift @@ -6,6 +6,12 @@ import Logging import Node import Testing +#if canImport(Darwin) +import Darwin +#elseif canImport(Glibc) +import Glibc +#endif + struct BokaTests { @Test func commandWithInvalidPaths() async throws { let invalidChainPath = "/path/to/wrong/file.json" @@ -314,7 +320,8 @@ struct BokaTests { } } - @Test func fuzzEnvironmentRejectsUnwritableDataDirectory() throws { + @Test(.disabled(if: geteuid() == 0, "requires a non-root user")) + func fuzzEnvironmentRejectsUnwritableDataDirectory() throws { let root = try makeTemporaryDirectory() defer { try? FileManager.default.removeItem(at: root) diff --git a/Makefile b/Makefile index c58f8462..cdf91a0a 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,20 @@ test-all: test test-cargo .PHONY: test-coverage test-coverage: - @for pkg in $(TEST_PACKAGES); do \ + @failed=""; \ + for pkg in $(TEST_PACKAGES); do \ echo "Running coverage for $$pkg..."; \ - swift test --enable-code-coverage --package-path "$$pkg"; \ - done + if swift test --enable-code-coverage --package-path "$$pkg"; then \ + echo " ✓ PASS"; \ + else \ + echo " ✗ FAIL"; \ + failed="$$failed $$pkg"; \ + fi; \ + done; \ + if [ -n "$$failed" ]; then \ + echo "Failed packages:$$failed"; \ + exit 1; \ + fi .PHONY: build build: githooks deps