diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 760b4d803..e8e27f268 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,13 +47,14 @@ jobs: - name: Check logs don't contain private messages run: "! grep 'Go down in flames' /Users/Shared -R" - - name: Zip results # for faster upload + - name: Zip results # Faster upload if: failure() working-directory: fastlane/test_output run: zip -r IntegrationTests.xcresult.zip IntegrationTests.xcresult - name: Archive artifacts uses: actions/upload-artifact@v6 + # We only care about artefacts if the tests fail if: failure() with: name: Results @@ -71,9 +72,13 @@ jobs: if-no-files-found: ignore - name: Collect coverage + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: xcresultparser -q -o cobertura -t ElementX -p $(pwd) fastlane/test_output/IntegrationTests.xcresult > fastlane/test_output/integration-cobertura.xml - name: Upload coverage to Codecov + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 with: report_type: coverage @@ -82,11 +87,13 @@ jobs: flags: integrationtests - name: Collect test results - if: ${{ !cancelled() }} + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: xcresultparser -q -o junit -p $(pwd) fastlane/test_output/IntegrationTests.xcresult > fastlane/test_output/integration-junit.xml - name: Upload test results to Codecov - if: ${{ !cancelled() }} + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 continue-on-error: true with: diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index 56d1c63a2..daaaeff90 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -46,13 +46,14 @@ jobs: bundle exec fastlane ui_tests device:${{ matrix.device }} test_name:${{ github.event.inputs.test_name }} fi - - name: Zip results # for faster upload + - name: Zip results # Faster uploads if: failure() working-directory: fastlane/test_output run: zip -r UITests.xcresult.zip UITests.xcresult - name: Archive artifacts uses: actions/upload-artifact@v6 + # We only care about artefacts if the tests fail if: failure() with: name: ${{ matrix.device }} @@ -61,9 +62,13 @@ jobs: if-no-files-found: ignore - name: Collect coverage + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: xcresultparser -q -o cobertura -t ElementX -p $(pwd) fastlane/test_output/UITests.xcresult > fastlane/test_output/ui-cobertura.xml - name: Upload coverage to Codecov + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 with: report_type: coverage @@ -72,11 +77,13 @@ jobs: flags: uitests - name: Collect test results - if: ${{ !cancelled() }} + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: xcresultparser -q -o junit -p $(pwd) fastlane/test_output/UITests.xcresult > fastlane/test_output/ui-junit.xml - name: Upload test results to Codecov - if: ${{ !cancelled() }} + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 continue-on-error: true with: diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 5cd11fed9..4943ddcc4 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -40,7 +40,7 @@ jobs: - name: Run tests run: bundle exec fastlane unit_tests - - name: Zip results # for faster upload + - name: Zip results # Faster uploads if: failure() working-directory: fastlane/test_output run: zip -r UnitTests.zip UnitTests.xcresult PreviewTests.xcresult @@ -56,12 +56,15 @@ jobs: if-no-files-found: ignore - name: Collect coverage + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: | xcresultparser -q -o cobertura -t ElementX -p $(pwd) fastlane/test_output/UnitTests.xcresult > fastlane/test_output/unit-cobertura.xml xcresultparser -q -o cobertura -t ElementX -p $(pwd) fastlane/test_output/PreviewTests.xcresult > fastlane/test_output/preview-cobertura.xml - name: Upload coverage to Codecov - if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} # Skip in forks + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 with: report_type: coverage @@ -70,12 +73,14 @@ jobs: flags: unittests - name: Collect test results - if: ${{ !cancelled() }} + # Skip if cancelled and in forks + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} run: | xcresultparser -q -o junit -p $(pwd) fastlane/test_output/UnitTests.xcresult > fastlane/test_output/unit-junit.xml xcresultparser -q -o junit -p $(pwd) fastlane/test_output/PreviewTests.xcresult > fastlane/test_output/preview-junit.xml - name: Upload test results to Codecov + # Skip if cancelled and in forks if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 continue-on-error: true