Replace the enterprise unit tests workflow with the new swift ones

This commit is contained in:
Stefan Ceriu
2026-03-01 18:20:52 +02:00
committed by Stefan Ceriu
parent 1b55fb224c
commit 6dd9f3f5e9
3 changed files with 21 additions and 64 deletions
+3 -18
View File
@@ -28,36 +28,21 @@ jobs:
submodules: recursive submodules: recursive
token: ${{ secrets.ELEMENT_BOT_TOKEN }} token: ${{ secrets.ELEMENT_BOT_TOKEN }}
- uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup environment - name: Setup environment
run: source ci_scripts/ci_common.sh && setup_github_actions_environment run: source ci_scripts/ci_common.sh && setup_github_actions_environment
- name: Configure Enterprise - name: Configure Enterprise
run: swift run pipeline configure-element-pro run: swift run pipeline configure-element-pro
- name: SwiftFormat
run: swiftformat --lint .
- name: Run tests - name: Run tests
run: bundle exec fastlane unit_tests skip_previews:true run: swift run -q tools ci unit-tests --skip-previews
- name: Zip results # for faster upload
if: failure()
working-directory: fastlane/test_output
run: zip -r UnitTests.zip UnitTests.xcresult
- name: Archive artifacts - name: Archive artifacts
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
# We only care about artefacts if the tests fail # We only care about artefacts if the tests fail
if: failure() if: failure()
with: with:
name: Results name: Results
path: fastlane/test_output/UnitTests.zip path: test_output/UnitTests.zip
retention-days: 1 retention-days: 1
if-no-files-found: ignore if-no-files-found: ignore
+18 -13
View File
@@ -12,6 +12,9 @@ struct UnitTests: AsyncParsableCommand {
@Option(help: "iOS version for the simulator.") @Option(help: "iOS version for the simulator.")
var osVersion = "26.1" var osVersion = "26.1"
@Flag(help: "Skip preview tests")
var skipPreviews = false
func run() async throws { func run() async throws {
try await CI.lint() try await CI.lint()
@@ -31,19 +34,21 @@ struct UnitTests: AsyncParsableCommand {
logger.error("\n❌ Unit tests failed. \(error)\n") logger.error("\n❌ Unit tests failed. \(error)\n")
} }
// Run preview tests on a smaller device if !skipPreviews {
do { // Run preview tests on a smaller device
logger.info("\n🧪 Running preview tests…\n") do {
try await RunTests.parse([ logger.info("\n🧪 Running preview tests…\n")
"--scheme", "PreviewTests", try await RunTests.parse([
"--device", "iPhone SE (3rd generation)", "--scheme", "PreviewTests",
"--os-version", osVersion, "--device", "iPhone SE (3rd generation)",
"--create-simulator-name", "iPhone SE (3rd generation)", "--os-version", osVersion,
"--create-simulator-type", "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation" "--create-simulator-name", "iPhone SE (3rd generation)",
]).run() "--create-simulator-type", "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation"
} catch { ]).run()
failures.append("Preview tests failed: \(error)") } catch {
logger.error("\n❌ Preview tests failed.\n") failures.append("Preview tests failed: \(error)")
logger.error("\n❌ Preview tests failed.\n")
}
} }
// Zip results (best-effort, useful for CI artifact uploads) // Zip results (best-effort, useful for CI artifact uploads)
-33
View File
@@ -12,39 +12,6 @@ before_all do
ENV["SENTRY_LOG_LEVEL"] = "DEBUG" ENV["SENTRY_LOG_LEVEL"] = "DEBUG"
end end
lane :unit_tests do |options|
reset_simulator = ENV.key?('CI')
run_tests(
scheme: "UnitTests",
device: "iPhone 17 (#{simulator_version})",
ensure_devices_found: true,
result_bundle: true,
number_of_retries: 3,
reset_simulator: reset_simulator,
xcodebuild_formatter: "xcbeautify --quiet --is-ci --renderer github-actions"
)
if !options[:skip_previews]
create_simulator_if_necessary(
name: "iPhone SE (3rd generation)",
type: "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation"
)
run_tests(
scheme: "PreviewTests",
device: "iPhone SE (3rd generation) (#{simulator_version})",
ensure_devices_found: true,
result_bundle: true,
number_of_retries: 3,
reset_simulator: reset_simulator,
xcodebuild_formatter: "xcbeautify --quiet --is-ci --renderer github-actions"
)
end
# We use xcresultparser in the workflow to collect coverage from both result bundles.
end
lane :config_production do lane :config_production do
sh("(cd .. && swift run pipeline update-foss-secrets)") sh("(cd .. && swift run pipeline update-foss-secrets)")
xcodegen(spec: "project.yml") xcodegen(spec: "project.yml")