From fdf80ddad02a4061dba3feaead1e85d874c54dbd Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Sun, 31 Dec 2023 17:00:37 +0100 Subject: [PATCH] Write a script for merging test results from various platforms --- .github/workflows/ci.yml | 57 ++++++++++++++++++++--------------- scripts/merge_test_results.sh | 2 ++ 2 files changed, 35 insertions(+), 24 deletions(-) create mode 100755 scripts/merge_test_results.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e4d7f1e6..73e8c31f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,13 +49,11 @@ jobs: steps: - uses: actions/checkout@v3 - name: ${{ matrix.name }} - run: xcodebuild test -scheme "Flare" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "./macos.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + run: xcodebuild test -scheme "Flare" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.name }}.xcresult" || exit 1 + - uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: "./macos.xcresult" + name: macos-coverage + path: ./${{ matrix.name }}.xcresult iOS: name: ${{ matrix.name }} @@ -82,13 +80,11 @@ jobs: - name: Generate project run: make generate - name: ${{ matrix.name }} - run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "./iphonesimulator.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.name }}.xcresult" || exit 1 + - uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: "./iphonesimulator.xcresult" + name: ios-coverage + path: ./${{ matrix.name }}.xcresult tvOS: name: ${{ matrix.name }} @@ -115,13 +111,11 @@ jobs: - name: Generate project run: make generate - name: ${{ matrix.name }} - run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "./appletvsimulator.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.name }}.xcresult" || exit 1 + - uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: "./appletvsimulator.xcresult" + name: tvos-coverage + path: ./${{ matrix.name }}.xcresult watchOS: name: ${{ matrix.name }} @@ -152,13 +146,11 @@ jobs: - name: Generate project run: make generate - name: ${{ matrix.name }} - run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan UnitTests clean -enableCodeCoverage YES -resultBundlePath "./watchsimulator.xcresult" || exit 1 - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3.1.0 + run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan UnitTests clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.name }}.xcresult" || exit 1 + - uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} - xcode: true - xcode_archive_path: "./watchsimulator.xcresult" + name: watchos-coverage + path: ./${{ matrix.name }}.xcresult spm: name: ${{ matrix.name }} @@ -181,6 +173,23 @@ jobs: - name: ${{ matrix.name }} run: swift build -c release --target Flare + upload-to-codecov: + needs: [iOS, macOS, watchOS, tvOS] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Merge downloaded files + run: ./scripts/merge_test_results.sh + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3.1.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + xcode: true + xcode_archive_path: "./final.xcresult" + # Beta: # name: ${{ matrix.name }} # runs-on: firebreak diff --git a/scripts/merge_test_results.sh b/scripts/merge_test_results.sh new file mode 100755 index 000000000..8bda0db60 --- /dev/null +++ b/scripts/merge_test_results.sh @@ -0,0 +1,2 @@ +files=$(find . -name '*.xcresult') +xcrun xcresulttool merge $files --output-path final.xcresult \ No newline at end of file