Add swift command for running UI tests

This commit is contained in:
Stefan Ceriu
2026-02-27 14:04:48 +02:00
committed by Stefan Ceriu
parent 3dfb33d6e9
commit 6e60aac0dc
4 changed files with 87 additions and 72 deletions

View File

@@ -28,28 +28,16 @@ jobs:
steps:
- uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2 #v1.2.3
- uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup environment
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
- name: Run tests
run: |
if [[ -z "${{ github.event.inputs.test_name }}" ]]; then
bundle exec fastlane ui_tests device:${{ matrix.device }}
else
bundle exec fastlane ui_tests device:${{ matrix.device }} test_name:${{ github.event.inputs.test_name }}
args=(--device-type "${{ matrix.device }}")
if [[ -n "${{ github.event.inputs.test_name }}" ]]; then
args+=( --test-name "${{ github.event.inputs.test_name }}")
fi
- name: Zip results # Faster uploads
if: failure()
working-directory: fastlane/test_output
run: zip -r UITests.xcresult.zip UITests.xcresult
swift run tools ci ui-tests "${args[@]}"
- name: Archive artifacts
uses: actions/upload-artifact@v7
@@ -57,32 +45,22 @@ jobs:
if: failure()
with:
name: ${{ matrix.device }}
path: fastlane/test_output/UITests.xcresult.zip
path: test_output/UITests.xcresult.zip
retention-days: 7
if-no-files-found: ignore
- name: Collect coverage
# Skip if not successful and in forks
if: ${{ success() && (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 not successful and in forks
if: ${{ success() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
report_type: coverage
files: fastlane/test_output/ui-cobertura.xml
files: test_output/ui-cobertura.xml
disable_search: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: uitests
- name: Collect test results
# 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
# Skip if cancelled and in forks
if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
@@ -90,7 +68,7 @@ jobs:
continue-on-error: true
with:
report_type: test_results
files: fastlane/test_output/ui-junit.xml
files: test_output/ui-junit.xml
disable_search: true
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}