mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Setup unit tests for Enterprise. (#2984)
* Fix Analytics on Enterprise.
This commit is contained in:
parent
5086cd089b
commit
1178561853
64
.github/workflows/unit_tests_enterprise.yml
vendored
Normal file
64
.github/workflows/unit_tests_enterprise.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Unit Tests (Enterprise)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
push:
|
||||
branches: [ develop ]
|
||||
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests (Enterprise)
|
||||
runs-on: macos-14
|
||||
|
||||
# Skip in forks
|
||||
if: github.repository == 'element-hq/element-x-ios'
|
||||
|
||||
concurrency:
|
||||
# Only allow a single run of this workflow on each branch, automatically cancelling older runs.
|
||||
group: ${{ format('unit-tests-enterprise{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
- uses: nschloe/action-cached-lfs-checkout@v1
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
|
||||
- uses: actions/cache@v4
|
||||
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: bundle exec fastlane config_enterprise
|
||||
env:
|
||||
MAPLIBRE_API_KEY: WeDontNeedOneForUnitTests
|
||||
|
||||
- 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
|
||||
|
||||
- name: Archive artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
# 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
|
@ -214,14 +214,14 @@ final class AppSettings {
|
||||
#if DEBUG
|
||||
/// The configuration to use for analytics during development. Set `isEnabled` to false to disable analytics in debug builds.
|
||||
/// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork, set custom configurations.
|
||||
let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element.elementx"),
|
||||
let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element."),
|
||||
host: "https://posthog.element.dev",
|
||||
apiKey: "phc_VtA1L35nw3aeAtHIx1ayrGdzGkss7k1xINeXcoIQzXN",
|
||||
termsURL: "https://element.io/cookie-policy")
|
||||
#else
|
||||
/// The configuration to use for analytics. Set `isEnabled` to false to disable analytics.
|
||||
/// **Note:** Analytics are disabled by default for forks. If you are maintaining a fork, set custom configurations.
|
||||
let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element.elementx"),
|
||||
let analyticsConfiguration = AnalyticsConfiguration(isEnabled: InfoPlistReader.main.bundleIdentifier.starts(with: "io.element."),
|
||||
host: "https://posthog.element.io",
|
||||
apiKey: "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO",
|
||||
termsURL: URL("https://element.io/cookie-policy"))
|
||||
|
@ -9,8 +9,7 @@ install_xcode_cloud_brew_dependencies
|
||||
if [ "$CI_WORKFLOW" = "Nightly" ]; then
|
||||
bundle exec fastlane config_nightly build_number:"$CI_BUILD_NUMBER"
|
||||
elif [ "$CI_WORKFLOW" = "Enterprise" ]; then
|
||||
# Not sure what Xcode Cloud does, might need to also
|
||||
# git submodule update --init --recursive
|
||||
# Xcode Cloud automatically fetches the submodule.
|
||||
bundle exec fastlane config_enterprise
|
||||
else
|
||||
bundle exec fastlane config_production
|
||||
|
@ -79,7 +79,7 @@ lane :alpha do
|
||||
upload_to_browserstack()
|
||||
end
|
||||
|
||||
lane :unit_tests do
|
||||
lane :unit_tests do |options|
|
||||
run_tests(
|
||||
scheme: "UnitTests",
|
||||
device: 'iPhone 15',
|
||||
@ -88,13 +88,15 @@ lane :unit_tests do
|
||||
number_of_retries: 3,
|
||||
)
|
||||
|
||||
run_tests(
|
||||
scheme: "PreviewTests",
|
||||
device: 'iPhone 15',
|
||||
result_bundle: true,
|
||||
number_of_retries: 3,
|
||||
xcargs: '-skipPackagePluginValidation',
|
||||
)
|
||||
if !options[:skip_previews]
|
||||
run_tests(
|
||||
scheme: "PreviewTests",
|
||||
device: 'iPhone 15',
|
||||
result_bundle: true,
|
||||
number_of_retries: 3,
|
||||
xcargs: '-skipPackagePluginValidation',
|
||||
)
|
||||
end
|
||||
|
||||
# We use xcresultparser in the workflow to collect coverage from both result bundles.
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user