feat(#41): config ホットリロードを全ビジュアル要素で完結 #716
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Lint (swift-format) | |
| run: swift format lint --strict --recursive Sources/ Tests/ | |
| test: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build and check for warnings | |
| run: | | |
| swift build 2>&1 | tee /tmp/build.log | |
| # Exclude: | |
| # - .build/ — third-party source warnings | |
| # - swift-syntax identity conflict — Papyrus uses apple/swift-syntax, | |
| # swift-dependencies uses swiftlang/swift-syntax (same repo, different URL). | |
| # Cannot resolve without forking upstream. | |
| WARNINGS=$(grep "warning:" /tmp/build.log \ | |
| | grep -v ".build/" \ | |
| | grep -v 'swift-syntax.*conflicts with dependency on' \ | |
| | grep -v 'Conflicting identity for swift-syntax' \ | |
| || true) | |
| if [ -n "$WARNINGS" ]; then | |
| echo "::error::Build produced warnings in project sources" | |
| exit 1 | |
| fi | |
| - name: Run tests with coverage | |
| id: run_tests | |
| run: | | |
| BIN=$(swift build --show-bin-path) | |
| PROFDATA="$BIN/codecov/default.profdata" | |
| COVERAGE_DIR="$RUNNER_TEMP/coverage" | |
| mkdir -p "$COVERAGE_DIR" | |
| # CoreAudioTapGatewayTests exercises the live CoreAudio HAL | |
| # (aggregate-device churn, process-tap attempt). On a headless | |
| # runner that destabilizes AVPlayer-dependent suites sharing the | |
| # same process, so it runs in its own swift-test process (#315). | |
| swift test --enable-code-coverage --skip CoreAudioTapGatewayTests | |
| if [[ ! -f "$PROFDATA" ]]; then | |
| echo "Coverage profile not found: $PROFDATA" | |
| exit 1 | |
| fi | |
| cp "$PROFDATA" "$COVERAGE_DIR/main.profdata" | |
| swift test --enable-code-coverage --filter CoreAudioTapGatewayTests | |
| if [[ ! -f "$PROFDATA" ]]; then | |
| echo "Coverage profile not found: $PROFDATA" | |
| exit 1 | |
| fi | |
| cp "$PROFDATA" "$COVERAGE_DIR/gateway.profdata" | |
| echo "coverage_dir=$COVERAGE_DIR" >> "$GITHUB_OUTPUT" | |
| - name: Generate lcov report | |
| id: generate_lcov | |
| if: always() | |
| run: | | |
| BIN=$(swift build --show-bin-path) | |
| TEST_BIN="$BIN/lyraPackageTests.xctest/Contents/MacOS/lyraPackageTests" | |
| COVERAGE_DIR="${{ steps.run_tests.outputs.coverage_dir }}" | |
| MERGED_PROFDATA="$COVERAGE_DIR/merged.profdata" | |
| COVERAGE_FILE="$GITHUB_WORKSPACE/coverage.lcov" | |
| if [[ -z "$COVERAGE_DIR" || ! -d "$COVERAGE_DIR" ]]; then | |
| echo "Coverage directory not found: $COVERAGE_DIR" | |
| exit 1 | |
| fi | |
| if ! compgen -G "$COVERAGE_DIR/*.profdata" > /dev/null; then | |
| echo "Coverage profiles not found in $COVERAGE_DIR" | |
| exit 1 | |
| fi | |
| if [[ ! -x "$TEST_BIN" ]]; then | |
| echo "Test binary not found: $TEST_BIN" | |
| exit 1 | |
| fi | |
| xcrun llvm-profdata merge -sparse "$COVERAGE_DIR"/*.profdata -o "$MERGED_PROFDATA" | |
| xcrun llvm-cov export \ | |
| "$TEST_BIN" \ | |
| -instr-profile "$MERGED_PROFDATA" \ | |
| -format lcov \ | |
| -ignore-filename-regex '.build|Tests/' \ | |
| > "$COVERAGE_FILE" | |
| if [[ ! -f "$COVERAGE_FILE" ]]; then | |
| echo "Coverage report not found: $COVERAGE_FILE" | |
| exit 1 | |
| fi | |
| echo "coverage_file=$COVERAGE_FILE" >> "$GITHUB_OUTPUT" | |
| - name: Upload to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ${{ steps.generate_lcov.outputs.coverage_file }} | |
| fail_ci_if_error: false |