Replace ruby/fastlane tools with swift variants. (#5105)

* Replace ruby/fastlane unit and preview test flows with swift variants.

* Switch to swift-log and Logger for logging

* Address (my own!) PR comments.

---------

Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Stefan Ceriu
2026-02-19 11:13:42 +02:00
committed by GitHub
parent cbeaaf02bb
commit c92e847ed7
9 changed files with 375 additions and 48 deletions

View File

@@ -22,65 +22,34 @@ 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: SwiftFormat
run:
swiftformat --lint .
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
- name: Run tests
run: bundle exec fastlane unit_tests
- name: Zip results # Faster uploads
if: failure()
working-directory: fastlane/test_output
run: zip -r UnitTests.zip UnitTests.xcresult PreviewTests.xcresult
run: swift run -q tools ci unit-tests
- name: Archive artifacts
uses: actions/upload-artifact@v6
# We only care about artefacts if the tests fail
if: failure()
with:
name: Results
path: fastlane/test_output/UnitTests.zip
retention-days: 1
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/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: Results
path: test_output/UnitTests.zip
retention-days: 1
if-no-files-found: ignore
- 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/unit-cobertura.xml,fastlane/test_output/preview-cobertura.xml
files: test_output/unit-cobertura.xml,test_output/preview-cobertura.xml
disable_search: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
- 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/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) }}
@@ -88,7 +57,7 @@ jobs:
continue-on-error: true
with:
report_type: test_results
files: fastlane/test_output/unit-junit.xml,fastlane/test_output/preview-junit.xml
files: test_output/unit-junit.xml,test_output/preview-junit.xml
disable_search: true
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}