Replace the enterprise unit tests workflow with the new swift ones
This commit is contained in:
committed by
Stefan Ceriu
parent
1a42dbda97
commit
9193b188ed
21
.github/workflows/unit_tests_enterprise.yml
vendored
21
.github/workflows/unit_tests_enterprise.yml
vendored
@@ -28,36 +28,21 @@ jobs:
|
||||
submodules: recursive
|
||||
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
|
||||
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
|
||||
|
||||
- name: Configure Enterprise
|
||||
run: swift run pipeline configure-element-pro
|
||||
|
||||
- name: SwiftFormat
|
||||
run: swiftformat --lint .
|
||||
|
||||
- name: Run tests
|
||||
run: bundle exec fastlane unit_tests skip_previews:true
|
||||
|
||||
- name: Zip results # for faster upload
|
||||
if: failure()
|
||||
working-directory: fastlane/test_output
|
||||
run: zip -r UnitTests.zip UnitTests.xcresult
|
||||
|
||||
run: swift run -q tools ci unit-tests --skip-previews
|
||||
|
||||
- name: Archive artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
# We only care about artefacts if the tests fail
|
||||
if: failure()
|
||||
with:
|
||||
name: Results
|
||||
path: fastlane/test_output/UnitTests.zip
|
||||
path: test_output/UnitTests.zip
|
||||
retention-days: 1
|
||||
if-no-files-found: ignore
|
||||
|
||||
@@ -12,6 +12,9 @@ struct UnitTests: AsyncParsableCommand {
|
||||
@Option(help: "iOS version for the simulator.")
|
||||
var osVersion = "26.1"
|
||||
|
||||
@Flag(help: "Skip preview tests")
|
||||
var skipPreviews = false
|
||||
|
||||
func run() async throws {
|
||||
try await CI.lint()
|
||||
|
||||
@@ -31,19 +34,21 @@ struct UnitTests: AsyncParsableCommand {
|
||||
logger.error("\n❌ Unit tests failed. \(error)\n")
|
||||
}
|
||||
|
||||
// Run preview tests on a smaller device
|
||||
do {
|
||||
logger.info("\n🧪 Running preview tests…\n")
|
||||
try await RunTests.parse([
|
||||
"--scheme", "PreviewTests",
|
||||
"--device", "iPhone SE (3rd generation)",
|
||||
"--os-version", osVersion,
|
||||
"--create-simulator-name", "iPhone SE (3rd generation)",
|
||||
"--create-simulator-type", "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation"
|
||||
]).run()
|
||||
} catch {
|
||||
failures.append("Preview tests failed: \(error)")
|
||||
logger.error("\n❌ Preview tests failed.\n")
|
||||
if !skipPreviews {
|
||||
// Run preview tests on a smaller device
|
||||
do {
|
||||
logger.info("\n🧪 Running preview tests…\n")
|
||||
try await RunTests.parse([
|
||||
"--scheme", "PreviewTests",
|
||||
"--device", "iPhone SE (3rd generation)",
|
||||
"--os-version", osVersion,
|
||||
"--create-simulator-name", "iPhone SE (3rd generation)",
|
||||
"--create-simulator-type", "com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation"
|
||||
]).run()
|
||||
} catch {
|
||||
failures.append("Preview tests failed: \(error)")
|
||||
logger.error("\n❌ Preview tests failed.\n")
|
||||
}
|
||||
}
|
||||
|
||||
// Zip results (best-effort, useful for CI artifact uploads)
|
||||
|
||||
@@ -12,39 +12,6 @@ before_all do
|
||||
ENV["SENTRY_LOG_LEVEL"] = "DEBUG"
|
||||
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
|
||||
sh("(cd .. && swift run pipeline update-foss-secrets)")
|
||||
xcodegen(spec: "project.yml")
|
||||
|
||||
Reference in New Issue
Block a user