Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to run detox iOS tests #7878

Merged
merged 62 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
81b2a3b
init
yasserfaraazkhan Mar 24, 2024
442f5df
brew link overwrite [email protected]
yasserfaraazkhan Mar 24, 2024
63b6104
brew link overwrite [email protected]
yasserfaraazkhan Mar 24, 2024
1e089d2
install [email protected]_1
yasserfaraazkhan Mar 24, 2024
10ed924
brew link --overwrite [email protected]
yasserfaraazkhan Mar 24, 2024
20e721d
cache deps and cache app
yasserfaraazkhan Mar 24, 2024
75f2212
update actions from v3 to v4
yasserfaraazkhan Mar 24, 2024
66b5d1d
fix cache step
yasserfaraazkhan Mar 24, 2024
64c9d9d
fix cache step
yasserfaraazkhan Mar 24, 2024
cda8b1a
fix cache step
yasserfaraazkhan Mar 24, 2024
8a3d11d
fix cache step
yasserfaraazkhan Mar 24, 2024
8b41657
fix cache step
yasserfaraazkhan Mar 24, 2024
5f2c780
fix cache step
yasserfaraazkhan Mar 24, 2024
e6b3b1b
remove ios app cache step
yasserfaraazkhan Mar 24, 2024
1d37a27
fix package-lock
yasserfaraazkhan Mar 24, 2024
5ab904a
fix package-lock
yasserfaraazkhan Mar 24, 2024
fcc17fe
npm i
yasserfaraazkhan Mar 24, 2024
d759422
prepare-node-deps
yasserfaraazkhan Mar 24, 2024
730d332
fix detox path for ios
yasserfaraazkhan Mar 24, 2024
bd99e78
test splits tests
yasserfaraazkhan Mar 26, 2024
5295b0e
test splits tests
yasserfaraazkhan Mar 26, 2024
3dc97c7
test splits tests
yasserfaraazkhan Mar 26, 2024
2fc80b7
test splits tests
yasserfaraazkhan Mar 26, 2024
8e6dac9
test splits tests
yasserfaraazkhan Mar 26, 2024
b187edc
test splits tests
yasserfaraazkhan Mar 26, 2024
990858a
test splits tests
yasserfaraazkhan Mar 26, 2024
f00338b
test splits tests
yasserfaraazkhan Mar 26, 2024
f17e38d
test splits tests
yasserfaraazkhan Mar 26, 2024
a7cde32
test splits tests
yasserfaraazkhan Mar 26, 2024
1b2f8f6
test splits tests
yasserfaraazkhan Mar 26, 2024
38ed245
test splits tests
yasserfaraazkhan Mar 26, 2024
3ab077d
clean up
yasserfaraazkhan Mar 26, 2024
54e9f71
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Mar 27, 2024
39beed5
review comments
yasserfaraazkhan Apr 5, 2024
379bfa5
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Apr 5, 2024
724a2a5
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Apr 7, 2024
be55c60
Merge branch 'main' into ios_detox_job
mattermost-build Apr 12, 2024
4a75b1e
fix file path
yasserfaraazkhan Apr 12, 2024
ac3f395
Merge branch 'main' into ios_detox_job
mattermost-build Apr 12, 2024
0658919
review comments
yasserfaraazkhan Apr 16, 2024
e8d3811
add secrets
yasserfaraazkhan Apr 16, 2024
b1f5146
fix report
yasserfaraazkhan Apr 16, 2024
ee79ab2
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Apr 23, 2024
3c9cf51
fix e2e test report
yasserfaraazkhan Apr 23, 2024
a94a258
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Apr 25, 2024
a9896c5
review comments
yasserfaraazkhan Apr 30, 2024
8ac208d
fix report
yasserfaraazkhan Apr 30, 2024
74c5dc8
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan May 2, 2024
e0a7796
fix run summary in the reports channel
yasserfaraazkhan May 2, 2024
49518ef
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan May 15, 2024
b7c0db1
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan May 30, 2024
e506654
E2E Template workflow (#7932)
yasserfaraazkhan May 31, 2024
75b74df
add triggers
yasserfaraazkhan May 31, 2024
48f4def
Add run types
yasserfaraazkhan May 31, 2024
f1dbbf3
Test E2E triggers (#7982)
yasserfaraazkhan May 31, 2024
001d3f3
Provide device option to avoide failures due to wrong input
yasserfaraazkhan May 31, 2024
3864784
let jobs pass with test failures
yasserfaraazkhan May 31, 2024
7264340
remove input.github_sha
yasserfaraazkhan Jun 1, 2024
e012442
review comment
yasserfaraazkhan Jun 4, 2024
0a068d2
Merge remote-tracking branch 'origin/main' into ios_detox_job
yasserfaraazkhan Jun 4, 2024
c55d954
add a checklist item
yasserfaraazkhan Jun 4, 2024
fbeb983
Update .github/workflows/e2e-detox-ci-template.yml
mvitale1989 Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fie
- [ ] Has UI changes
- [ ] Includes text changes and localization file updates
- [ ] Have tested against the 5 core themes to ensure consistency between them.
- [ ] Have run E2E tests by adding label `E2E iOS tests for PR`.

#### Device Information
This PR was tested on: <!-- Device name(s), OS version(s) -->
Expand Down
39 changes: 39 additions & 0 deletions .github/actions/generate-specs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Mattermost, Inc.
name: "generate-specs"
description: This action used to split Detox integration tests based on the parallelism provided

inputs:
search_path:
description: The path to look for from within the directory
required: true
parallelism:
description: The parallelism for the tests
required: true
device_name:
description: The name of Device used for the tests
required: false
default: "iPhone 15"
device_os_version:
description: The os of the device used for the tests
required: false
default: "iOS 17.1"

outputs:
specs:
description: The specs generated for the strategy
value: ${{ steps.generate-specs.outputs.specs }}
runs:
using: "composite"
steps:
- name: ci/generate-specs
id: generate-specs
env:
PARALLELISM: ${{ inputs.parallelism }}
SEARCH_PATH: ${{ inputs.search_path }}
DEVICE_NAME: ${{ inputs.device_name }}
DEVICE_OS_VERSION: ${{ inputs.device_os_version }}
run: |
set -e
node ${{ github.action_path }}/split-tests.js | tee output.json
echo "specs=$(cat output.json)" >> $GITHUB_OUTPUT
shell: bash
94 changes: 94 additions & 0 deletions .github/actions/generate-specs/split-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const fs = require('fs');
const path = require('path');

class DeviceInfo {
constructor(deviceName, deviceOsVersion) {
this.deviceName = deviceName;
this.deviceOsVersion = deviceOsVersion;
}
}

class SpecGroup {
constructor(runId, specs, deviceInfo) {
this.runId = runId;
this.specs = specs;
this.deviceName = deviceInfo.deviceName;
this.deviceOsVersion = deviceInfo.deviceOsVersion;
}
}

class Specs {
constructor(searchPath, parallelism, deviceInfo) {
this.searchPath = searchPath;
this.parallelism = parallelism;
this.rawFiles = [];
this.groupedFiles = [];
this.deviceInfo = deviceInfo;
}

findFiles() {
const dirPath = path.join(this.searchPath);

const fileRegex = /\.e2e\.ts$/;

const walkSync = (currentPath) => {
const files = fs.readdirSync(currentPath);

files.forEach((file) => {
const filePath = path.join(currentPath, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
walkSync(filePath);
} else if (fileRegex.test(filePath)) {
const relativeFilePath = filePath.replace(dirPath + '/', '');
const fullPath = path.join(this.searchPath, relativeFilePath);
this.rawFiles.push(fullPath);
}
});
};

walkSync(dirPath);
}

generateSplits() {
const chunkSize = Math.ceil(this.rawFiles.length / this.parallelism);
let runNo = 1;

for (let i = 0; i < this.rawFiles.length; i += chunkSize) {
const end = Math.min(i + chunkSize, this.rawFiles.length);
const fileGroup = this.rawFiles.slice(i, end).join(' ');
const specFileGroup = new SpecGroup(runNo.toString(), fileGroup, this.deviceInfo);
this.groupedFiles.push(specFileGroup);

if (end === this.rawFiles.length) {
break;
}

runNo++;
}
}

dumpSplits() {
const output = {
include: this.groupedFiles,
};

console.log(JSON.stringify(output));
}
}

function main() {
const searchPath = process.env.SEARCH_PATH;
const parallelism = parseInt(process.env.PARALLELISM, 10);
const deviceName = process.env.DEVICE_NAME;
const deviceOsVersion = process.env.DEVICE_OS_VERSION;
const deviceInfo = new DeviceInfo(deviceName, deviceOsVersion);
const specs = new Specs(searchPath, parallelism, deviceInfo);

specs.findFiles();
specs.generateSplits();
specs.dumpSplits();
}

main();
8 changes: 8 additions & 0 deletions .github/actions/prepare-ios-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ runs:
npm run ios-gems
npm run pod-install
echo "::endgroup::"

- name: Cache Pods
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
8 changes: 8 additions & 0 deletions .github/actions/prepare-mobile-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ runs:
echo "::endgroup::"
working-directory: ./fastlane

- name: Cache Ruby gems
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: ci/prepare-node-deps
uses: ./.github/actions/prepare-node-deps
10 changes: 9 additions & 1 deletion .github/actions/prepare-node-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
using: composite
steps:
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: ".nvmrc"
cache: "npm"
Expand All @@ -21,6 +21,14 @@ runs:
node node_modules/\@sentry/cli/scripts/install.js
echo "::endgroup::"

- name: Cache Node.js modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: ci/patch-npm-dependencies
shell: bash
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-android-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ci/test
uses: ./.github/actions/test

Expand All @@ -26,7 +26,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/prepare-android-build
uses: ./.github/actions/prepare-android-build
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-android-beta-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: android-build-beta-${{ github.run_id }}
path: "*.apk"
6 changes: 3 additions & 3 deletions .github/workflows/build-android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ci/test
uses: ./.github/actions/test

Expand All @@ -26,7 +26,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/prepare-android-build
uses: ./.github/actions/prepare-android-build
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-android-release-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: android-build-release-${{ github.run_id }}
path: "*.apk"
10 changes: 5 additions & 5 deletions .github/workflows/build-ios-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ci/test
uses: ./.github/actions/test

Expand All @@ -28,7 +28,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/prepare-ios-build
uses: ./.github/actions/prepare-ios-build
Expand All @@ -44,7 +44,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-ios-pr-simulator
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ios-build-simulator-${{ github.run_id }}
path: Mattermost-simulator-x86_64.app.zip
Expand All @@ -56,7 +56,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/output-ssh-private-key
shell: bash
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-ios-beta-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ios-build-beta-${{ github.run_id }}
path: "*.ipa"
10 changes: 5 additions & 5 deletions .github/workflows/build-ios-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ci/test
uses: ./.github/actions/test

Expand All @@ -28,7 +28,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/prepare-ios-build
uses: ./.github/actions/prepare-ios-build
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-ios-release-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ios-build-release-${{ github.run_id }}
path: "*.ipa"
Expand All @@ -77,7 +77,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: ci/prepare-ios-build
uses: ./.github/actions/prepare-ios-build
Expand All @@ -93,7 +93,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-ios-pr-simulator
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ios-build-simulator-${{ github.run_id }}
path: Mattermost-simulator-x86_64.app.zip
10 changes: 5 additions & 5 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: ${{ github.event.label.name == 'Build Apps for PR' || github.event.label.name == 'Build App for iOS' || github.event.label.name == 'Build App for Android' }}
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: ci/test
Expand All @@ -28,7 +28,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}

Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-ios-pr-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: ios-build-pr-${{ github.run_id }}
path: "*.ipa"
Expand All @@ -72,7 +72,7 @@ jobs:
- test
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}

Expand All @@ -94,7 +94,7 @@ jobs:
working-directory: ./fastlane

- name: ci/upload-android-pr-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: android-build-pr-${{ github.run_id }}
path: "*.apk"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: ci/test
uses: ./.github/actions/test
Loading