Skip to content

Commit

Permalink
Merge pull request platrum#10 from fewva/june-2024
Browse files Browse the repository at this point in the history
Synchronization with the main repository without changes
  • Loading branch information
flrnull authored Jun 21, 2024
2 parents 34ddbcb + fb55d12 commit 9bd598c
Show file tree
Hide file tree
Showing 551 changed files with 44,594 additions and 33,922 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"newlines-between": "always",
"pathGroups": [
{
"pattern": "{@(@actions|@app|@assets|@calls|@client|@components|@constants|@context|@database|@helpers|@hooks|@init|@managers|@queries|@screens|@selectors|@share|@store|@telemetry|@typings|@test|@utils)/**,@(@constants|@i18n|@notifications|@store|@websocket)}",
"pattern": "{@(@actions|@app|@assets|@calls|@client|@components|@constants|@context|@database|@helpers|@hooks|@init|@managers|@queries|@screens|@selectors|@share|@store|@telemetry|@typings|@test|@utils)/**,@(@constants|@i18n|@store|@websocket)}",
"group": "external",
"position": "after"
},
Expand Down
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();
13 changes: 5 additions & 8 deletions .github/actions/prepare-android-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ runs:
- name: ci/prepare-mobile-build
uses: ./.github/actions/prepare-mobile-build

# Disable this since we are not caching anything for now
# - name: ci/install-gradle-dependencies
# shell: bash
# working-directory: android
# run: |
# echo "::group::install-gradle-dependencies"
# ./gradlew dependencies
# echo "::endgroup::"
- name: ci/setup-java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"

- name: ci/jetify-android-libraries
shell: bash
Expand Down
19 changes: 9 additions & 10 deletions .github/actions/prepare-ios-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ description: Action to prepare environment for ios build
runs:
using: composite
steps:
- name: ci/install-os-deps
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
shell: bash
run: |
echo "::group::install-os-deps"
brew install watchman
echo "::endgroup::"
- name: ci/prepare-mobile-build
uses: ./.github/actions/prepare-mobile-build

- name: ci/install-pods-dependencies
shell: bash
run: |
echo "::group::install-pods-dependencies"
echo "::group::install-pods-dependencies"
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-
13 changes: 10 additions & 3 deletions .github/actions/prepare-mobile-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ description: Action to prepare environment for mobile build
runs:
using: composite
steps:
- uses: ruby/setup-ruby@9669f3ee51dc3f4eda8447ab696b3ab19a90d14b # v1.144.0
with:
ruby-version: "2.7.7"
# The required ruby version is mentioned in '.ruby-version'
- uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1.180.0

- name: ci/setup-fastlane-dependencies
shell: bash
Expand All @@ -16,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
8 changes: 4 additions & 4 deletions .github/workflows/build-android-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
- build-beta-android-[0-9]+

env:
NODE_VERSION: 18.7.0
NODE_VERSION: 20.13.1
TERM: xterm

jobs:
test:
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"
8 changes: 4 additions & 4 deletions .github/workflows/build-android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
- build-release-android-[0-9]+

env:
NODE_VERSION: 18.7.0
NODE_VERSION: 20.13.1
TERM: xterm

jobs:
test:
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"
16 changes: 8 additions & 8 deletions .github/workflows/build-ios-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ on:
- build-beta-sim-[0-9]+

env:
NODE_VERSION: 18.7.0
NODE_VERSION: 20.13.1
TERM: xterm

jobs:
test:
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

build-ios-simulator:
runs-on: macos-12
runs-on: macos-14-large
if: ${{ !contains(github.ref_name, 'beta-ios') }}
needs:
- 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,19 +44,19 @@ 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

build-and-deploy-ios-beta:
runs-on: macos-12
runs-on: macos-14-large
if: ${{ !contains(github.ref_name, 'beta-sim') }}
needs:
- 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"
Loading

0 comments on commit 9bd598c

Please sign in to comment.