Compare commits

...

27 Commits

Author SHA1 Message Date
Mario Vitale
16f7f6d889 Implement usage flow as expected by mobile team 2023-02-17 21:39:29 +01:00
Mario Vitale
6c1900b266 Fix ssh key filename 2023-02-15 16:59:21 +01:00
Mario Vitale
44f2e2ba83 Also add deploy key to the iso-beta build job 2023-02-15 16:09:30 +01:00
Mario Vitale
ae2bd62941 Do not use secrets in conditionals 2023-02-15 15:57:45 +01:00
Mario Vitale
349279bf32 Fix ssh private key permissions 2023-02-15 15:35:13 +01:00
Mario Vitale
34ee3fc117 Add private_deploy_key to iOS signed jobs 2023-02-15 15:23:19 +01:00
Mario Vitale
43bb050e96 Fix multiline notation, avoid leading spaces 2023-02-15 14:35:22 +01:00
Mario Vitale
64bcc6baef Fix multiline variable notation 2023-02-15 14:30:46 +01:00
Mario Vitale
ff6cf7ae7d Fix typo in some variables 2023-02-15 11:17:46 +01:00
Mario Vitale
c3032447d3 Fix variable names, types and defaults 2023-02-14 16:12:47 +01:00
Mario Vitale
3327467054 Fix typo for building the simulator 2023-02-13 19:11:58 +01:00
Mario Vitale
a251774800 Enable simulator and beta build, for testing 2023-02-13 19:01:38 +01:00
Mario Vitale
64e76361ab Fiix variable quoting during generation 2023-02-13 15:20:17 +01:00
Mario Vitale
dd7938d61f Set variables through envfile 2023-02-13 14:18:52 +01:00
Mario Vitale
80e156c78c Add ios-default vars 2023-02-13 13:17:45 +01:00
Mario Vitale
4e1fbda0a8 Use ruby 2.7 2023-02-13 12:36:57 +01:00
Mario Vitale
8f0130d4b9 Test iOS build job 2023-02-10 19:24:36 +01:00
Mario Vitale
3283f81a59 Small fix to deploy-to-store job 2023-02-10 16:07:55 +01:00
Mario Vitale
5ceb860c0c Implement deploy-to-store reusable workflow 2023-02-10 15:58:06 +01:00
Mario Vitale
3dd95a077b Implement ios unsigned and simulator builds 2023-02-08 22:54:48 +01:00
Mario Vitale
a17bce37f7 Begin supporting ios unsigned and simulator builds 2023-02-08 22:46:31 +01:00
Mario Vitale
28040b5f99 TMP test that binary operator shorcircuiting works 2023-02-08 18:25:40 +01:00
Mario Vitale
3bb26f3329 Implement build-ios.beta workflow 2023-02-08 18:12:59 +01:00
Mario Vitale
fa36b9420b Implement ios-pr build 2023-02-08 15:59:16 +01:00
Mario Vitale
1c5df0766b Implement build-ios-pr 2023-02-04 01:29:31 +01:00
Mario Vitale
9751beefd3 Add more actions 2023-02-02 17:56:52 +01:00
Mario Vitale
13fdae55f7 Move test steps to Github Actions 2023-02-01 16:57:53 +01:00
14 changed files with 561 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
---
name: 'fastlane-dependencies'
description: 'Install fastlane dependencies'
inputs:
caching_key:
description: Name of the OS to generate dependencies for, to compartimentalize caching
type: string
required: true
runs:
using: 'composite'
steps:
- name: ci/cache-fastlane-dependencies
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
key: gems-v1-${{ inputs.os }}-${{ hashFiles('fastlane/Gemfile.lock') }}-${{ runner.arch }}
path: fastlane/vendor/bundle
- name: ci/get-fastlane-dependencies
working-directory: fastlane
shell: bash
run: bundle install --path vendor/bundle

View File

@@ -0,0 +1,21 @@
---
name: 'generate-assets'
description: 'Generate app assets'
runs:
using: 'composite'
steps:
- name: ci/cache-assets
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
key: assets-v1-${{ hashFiles('assets/base/config.json') }}-${{ runner.arch }}
path: dist
- name: ci/genereate-assets
shell: bash
run: node ./scripts/generate-assets.js
- name: ci/import-compass-icon
shell: bash
run: |
COMPASS_ICONS="node_modules/@mattermost/compass-icons/font/compass-icons.ttf"
cp "$COMPASS_ICONS" "assets/fonts/"
cp "$COMPASS_ICONS" "android/app/src/main/assets/fonts"

21
.github/actions/node-prepare/action.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
---
name: 'node-prepare'
description: 'Install node packages'
runs:
using: 'composite'
steps:
- name: ci/cache-npm-dependencies
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
key: npm-v1-${{ hashFiles('package-lock.json') }}
path: node_modules
- name: ci/install-npm-dependencies
shell: bash
run: |
NODE_ENV=development npm ci --ignore-scripts
node node_modules/\@sentry/cli/scripts/install.js
node node_modules/react-native-webrtc/tools/downloadWebRTC.js
- name: ci/patch-npm-dependencies
shell: bash
run: npx patch-package

View File

@@ -0,0 +1,19 @@
---
name: 'pods-dependencies'
description: 'Get cocoapods dependencies'
runs:
using: 'composite'
steps:
- name: ci/cache-pods-dependencies
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
key: cocoapods-v1-${{ inputs.os }}-${{ hashFiles('ios/Podfile.lock') }}-${{ runner.arch }}
path: |
ios/Pods
~/.cocoapods
- name: ci/get-pods-dependencies
shell: bash
run: |
npm run ios-gems
npm run pod-install

245
.github/workflows/.build-ios.yml vendored Normal file
View File

@@ -0,0 +1,245 @@
---
name: build-ios
on:
workflow_call:
# If any of these is set to an empty value, its corresponding env var will not be set
inputs:
app_name:
required: false
type: string
app_scheme:
required: false
type: string
aws_bucket_name:
required: false
type: string
aws_folder_name:
required: false
type: string
aws_region:
required: false
type: string
beta_build:
required: false
type: string
build_for_release:
required: false
type: string
build_pr:
required: false
type: string
extension_app_identifier:
required: false
type: string
branch_to_build:
required: false
type: string
build_artifact_name:
required: true
type: string
build_type:
# Valid values: signed, unsigned, simulator
required: true
type: string
ios_app_group:
required: false
type: string
ios_build_export_method:
required: false
type: string
ios_icloud_container:
required: false
type: string
main_app_identifier:
required: false
type: string
match_app_identifier:
required: false
type: string
match_readonly:
required: false
type: string
match_shallow_clone:
required: false
type: string
match_skip_docs:
required: false
type: string
match_type:
required: false
type: string
babel_env:
required: false
type: string
default: "production"
node_env:
required: false
type: string
default: "production"
node_options:
required: false
type: string
default: "--max_old_space_size=12000"
notification_service_identifier:
required: false
type: string
pilot_skip_waiting_for_build_processing:
required: false
type: string
replace_assets:
required: false
type: string
sentry_enabled:
required: false
type: string
show_onboarding:
required: false
type: string
sync_provisioning_profiles:
required: false
type: string
tag:
required: false
type: string
secrets:
aws_access_key_id:
required: false
aws_secret_access_key:
required: false
fastlane_team_id:
required: false
gh_token:
required: false
ios_api_issuer_id:
required: false
ios_api_key:
required: false
ios_api_key_id:
required: false
match_git_url:
required: false
match_password:
required: false
mattermost_webhook_url:
required: false
private_deploy_key:
required: false
sentry_auth_token:
required: false
sentry_dsn_ios:
required: false
sentry_org:
required: false
sentry_project_ios:
required: false
jobs:
build-ios:
runs-on: macos-11
steps:
- name: ci/generate-env
run: |
# Using this method instead of the workflow-level `env`, to avoid setting variables with empty values
# Note that multiline strings require a different notation: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
[ -z "${{ inputs.branch_to_build }}" ] || echo 'BRANCH_TO_BUILD=${{ inputs.branch_to_build }}' >> $GITHUB_ENV
[ -z "${{ inputs.app_name }}" ] || echo 'APP_NAME=${{ inputs.app_name }}' >> $GITHUB_ENV
[ -z "${{ inputs.app_scheme }}" ] || echo 'APP_SCHEME=${{ inputs.app_scheme }}' >> $GITHUB_ENV
[ -z "${{ secrets.aws_access_key_id }}" ] || echo 'AWS_ACCESS_KEY_ID=${{ secrets.aws_access_key_id }}' >> $GITHUB_ENV
[ -z "${{ secrets.aws_secret_access_key }}" ] || echo 'AWS_SECRET_ACCESS_KEY=${{ secrets.aws_secret_access_key }}' >> $GITHUB_ENV
[ -z "${{ inputs.aws_bucket_name }}" ] || echo 'AWS_BUCKET_NAME=${{ inputs.aws_bucket_name }}' >> $GITHUB_ENV
[ -z "${{ inputs.aws_folder_name }}" ] || echo 'AWS_FOLDER_NAME=${{ inputs.aws_folder_name }}' >> $GITHUB_ENV
[ -z "${{ inputs.aws_region }}" ] || echo 'AWS_REGION=${{ inputs.aws_region }}' >> $GITHUB_ENV
[ -z "${{ inputs.beta_build }}" ] || echo 'BETA_BUILD=${{ inputs.beta_build }}' >> $GITHUB_ENV
[ -z "${{ inputs.build_for_release }}" ] || echo 'BUILD_FOR_RELEASE=${{ inputs.build_for_release }}' >> $GITHUB_ENV
[ -z "${{ inputs.build_pr }}" ] || echo 'BUILD_PR=${{ inputs.build_pr }}' >> $GITHUB_ENV
[ -z "${{ inputs.extension_app_identifier }}" ] || echo 'EXTENSION_APP_IDENTIFIER=${{ inputs.extension_app_identifier }}' >> $GITHUB_ENV
[ -z "${{ secrets.fastlane_team_id }}" ] || echo 'FASTLANE_TEAM_ID=${{ secrets.fastlane_team_id }}' >> $GITHUB_ENV
[ -z "${{ secrets.gh_token }}" ] || echo 'GITHUB_TOKEN=${{ secrets.gh_token }}' >> $GITHUB_ENV
[ -z "${{ secrets.ios_api_issuer_id }}" ] || echo 'IOS_API_ISSUER_ID=${{ secrets.ios_api_issuer_id }}' >> $GITHUB_ENV
if [ -n "${{ secrets.ios_api_key }}" ]; then
cat <<EOF >>$GITHUB_ENV
IOS_API_KEY<<INNEREOF
${{ secrets.ios_api_key }}
INNEREOF
EOF
fi
[ -z "${{ secrets.ios_api_key_id }}" ] || echo 'IOS_API_KEY_ID=${{ secrets.ios_api_key_id }}' >> $GITHUB_ENV
[ -z "${{ inputs.ios_app_group }}" ] || echo 'IOS_APP_GROUP=${{ inputs.ios_app_group }}' >> $GITHUB_ENV
[ -z "${{ inputs.ios_build_export_method }}" ] || echo 'IOS_BUILD_EXPORT_METHOD=${{ inputs.ios_build_export_method }}' >> $GITHUB_ENV
[ -z "${{ inputs.ios_icloud_container }}" ] || echo 'IOS_ICLOUD_CONTAINER=${{ inputs.ios_icloud_container }}' >> $GITHUB_ENV
[ -z "${{ inputs.main_app_identifier }}" ] || echo 'MAIN_APP_IDENTIFIER=${{ inputs.main_app_identifier }}' >> $GITHUB_ENV
[ -z "${{ inputs.match_app_identifier }}" ] || echo 'MATCH_APP_IDENTIFIER=${{ inputs.match_app_identifier }}' >> $GITHUB_ENV
[ -z "${{ inputs.match_readonly }}" ] || echo 'MATCH_READONLY=${{ inputs.match_readonly }}' >> $GITHUB_ENV
[ -z "${{ inputs.match_shallow_clone }}" ] || echo 'MATCH_SHALLOW_CLONE=${{ inputs.match_shallow_clone }}' >> $GITHUB_ENV
[ -z "${{ inputs.match_skip_docs }}" ] || echo 'MATCH_SKIP_DOCS=${{ inputs.match_skip_docs }}' >> $GITHUB_ENV
[ -z "${{ secrets.match_git_url }}" ] || echo 'MATCH_GIT_URL=${{ secrets.match_git_url }}' >> $GITHUB_ENV
[ -z "${{ secrets.match_password }}" ] || echo 'MATCH_PASSWORD=${{ secrets.match_password }}' >> $GITHUB_ENV
[ -z "${{ inputs.match_type }}" ] || echo 'MATCH_TYPE=${{ inputs.match_type }}' >> $GITHUB_ENV
[ -z "${{ secrets.mattermost_webhook_url }}" ] || echo 'MATTERMOST_WEBHOOK_URL=${{ secrets.mattermost_webhook_url }}' >> $GITHUB_ENV
[ -z "${{ inputs.notification_service_identifier }}" ] || echo 'NOTIFICATION_SERVICE_IDENTIFIER=${{ inputs.notification_service_identifier }}' >> $GITHUB_ENV
[ -z "${{ inputs.node_env }}" ] || echo 'NODE_ENV=${{ inputs.node_env }}' >> $GITHUB_ENV
[ -z "${{ inputs.node_options }}" ] || echo 'NODE_OPTIONS=${{ inputs.node_options }}' >> $GITHUB_ENV
[ -z "${{ inputs.babel_env }}" ] || echo 'BABEL_ENV=${{ inputs.babel_env }}' >> $GITHUB_ENV
[ -z "${{ inputs.pilot_skip_waiting_for_build_processing }}" ] || echo 'PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING=${{ inputs.pilot_skip_waiting_for_build_processing }}' >> $GITHUB_ENV
[ -z "${{ inputs.replace_assets }}" ] || echo 'REPLACE_ASSETS=${{ inputs.replace_assets }}' >> $GITHUB_ENV
[ -z "${{ secrets.sentry_auth_token }}" ] || echo 'SENTRY_AUTH_TOKEN=${{ secrets.sentry_auth_token }}' >> $GITHUB_ENV
[ -z "${{ secrets.sentry_dsn_ios }}" ] || echo 'SENTRY_DSN_IOS=${{ secrets.sentry_dsn_ios }}' >> $GITHUB_ENV
[ -z "${{ inputs.sentry_enabled }}" ] || echo 'SENTRY_ENABLED=${{ inputs.sentry_enabled }}' >> $GITHUB_ENV
[ -z "${{ secrets.sentry_org }}" ] || echo 'SENTRY_ORG=${{ secrets.sentry_org }}' >> $GITHUB_ENV
[ -z "${{ secrets.sentry_project_ios }}" ] || echo 'SENTRY_PROJECT_IOS=${{ secrets.sentry_project_ios }}' >> $GITHUB_ENV
[ -z "${{ inputs.show_onboarding }}" ] || echo 'SHOW_ONBOARDING=${{ inputs.show_onboarding }}' >> $GITHUB_ENV
[ -z "${{ inputs.sync_provisioning_profiles }}" ] || echo 'SYNC_PROVISIONING_PROFILES=${{ inputs.sync_provisioning_profiles }}' >> $GITHUB_ENV
[ -z "${{ inputs.tag }}" ] || echo 'TAG=${{ inputs.tag }}' >> $GITHUB_ENV
- name: ci/output-ssh-private-key
run: |
SSH_KEY_PATH=~/.ssh/id_ed25519
if [ -n "${{ secrets.private_deploy_key }}" ]; then
mkdir -p ~/.ssh
echo -e '${{ secrets.private_deploy_key }}' > ${SSH_KEY_PATH}
chmod 0600 ${SSH_KEY_PATH}
ssh-keygen -y -f ${SSH_KEY_PATH} > ${SSH_KEY_PATH}.pub
fi
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/node-prepare
uses: ./.github/actions/node-prepare
- name: ci/pods-dependencies
uses: ./.github/actions/pods-dependencies
- name: ci/generate-assets
uses: ./.github/actions/generate-assets
- name: ci/fastlane-dependencies
uses: ./.github/actions/fastlane-dependencies
with:
caching_key: ios
# Build iOS app, method depends on the value of `build_type`
- name: ci/build-ios-signed
working-directory: ./fastlane
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman
export TERM=xterm && bundle exec fastlane ios build
if: "${{ inputs.build_type == 'signed' }}"
- name: ci/build-ios-unsigned
working-directory: ./fastlane
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman
bundle exec fastlane ios unsigned
if: "${{ inputs.build_type == 'unsigned' }}"
- name: ci/build-ios-simulator
working-directory: ./fastlane
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman
bundle exec fastlane ios simulator
if: "${{ inputs.build_type == 'simulator' }}"
# Upload the build artifact, its path depends on the value of `build_type`
- name: ci/upload-ios-buld
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: "${{ inputs.build_artifact_name }}"
path: "*.ipa"
if: "${{ inputs.build_type == 'signed' || inputs.build_type == 'unsigned' }}"
- name: ci/upload-ios-buld-simulator
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: "${{ inputs.build_artifact_name }}"
path: "Mattermost-simulator-x86_64.app.zip"
if: "${{ inputs.build_type == 'simulator' }}"

27
.github/workflows/.deploy-to-store.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: 'deploy-to-store'
on:
workflow_call:
inputs:
build_artifact_name:
required: true
type: string
os:
# Valid values: `ios`, `android`
required: true
type: string
env:
required: false
type: string
jobs:
deploy-to-store:
runs-on: ubuntu-latest
steps:
- name: ci/download-artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: "${{ inputs.build_artifact_name }}"
- name: ci/deploy-to-store
working-directory: fastlane
run: ${{ inputs.env }} bundle exec fastlane ${{ inputs.os }} deploy file:$(pwd)/../${{ ( inputs.os == 'ios' && '*.ipa' ) || '*.apk' }}

23
.github/workflows/.test.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
---
name: test
on:
workflow_call:
jobs:
test:
runs-on: ubuntu-latest
container:
image: node:16.14.2-bullseye
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/node-prepare
uses: ./.github/actions/node-prepare
- name: ci/generate-assets
uses: ./.github/actions/generate-assets
- name: ci/check-styles
run: npm run check
- name: ci/run-tests
run: npm test
- name: ci/check-i18n
run: ./scripts/precommit/i18n.sh

60
.github/workflows/build-ios.beta.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
---
name: "build-ios-beta"
on:
push:
branches:
# TODO: remove the `gha-` to match the current workflow again
- build-gha-\d+$
- build-gha-ios-\d+$
- build-gha-ios-beta-\d+$
jobs:
build-ios-pr:
uses: ./.github/workflows/.build-ios.yml
with:
build_artifact_name: "ios-build-beta-${{ github.run_id }}"
build_type: "signed"
app_name: "Mattermost Beta"
app_scheme: "mattermost"
aws_bucket_name: "releases.mattermost.com"
aws_folder_name: "mattermost-mobile-beta"
aws_region: "us-east-1"
beta_build: "true"
build_for_release: "true"
extension_app_identifier: "com.mattermost.rnbeta.MattermostShare"
ios_app_group: "group.com.mattermost.rnbeta"
ios_build_export_method: "app-store"
ios_icloud_container: "iCloud.com.mattermost.rnbeta"
main_app_identifier: "com.mattermost.rnbeta"
match_app_identifier: "com.mattermost.rnbeta.NotificationService,com.mattermost.rnbeta.MattermostShare,com.mattermost.rnbeta"
match_readonly: "true"
match_shallow_clone: "true"
match_skip_docs: "true"
match_type: "appstore"
notification_service_identifier: "com.mattermost.rnbeta.NotificationService"
pilot_skip_waiting_for_build_processing: "true"
replace_assets: "false"
sentry_enabled: "true"
show_onboarding: "true"
sync_provisioning_profiles: "true"
secrets:
aws_access_key_id: "${{ secrets.MM_MOBILE_BETA_AWS_ACCESS_KEY_ID }}"
aws_secret_access_key: "${{ secrets.MM_MOBILE_BETA_AWS_SECRET_ACCESS_KEY }}"
fastlane_team_id : "${{ secrets.MM_MOBILE_FASTLANE_TEAM_ID }}"
ios_api_issuer_id: "${{ secrets.MM_MOBILE_IOS_API_ISSUER_ID }}"
ios_api_key: "${{ secrets.MM_MOBILE_IOS_API_KEY }}"
ios_api_key_id: "${{ secrets.MM_MOBILE_IOS_API_KEY_ID }}"
match_git_url: "${{ secrets.MM_MOBILE_MATCH_GIT_URL }}"
match_password: "${{ secrets.MM_MOBILE_MATCH_PASSWORD }}"
mattermost_webhook_url: "${{ secrets.MM_MOBILE_BETA_MATTERMOST_WEBHOOK_URL }}"
private_deploy_key: "${{ secrets.MM_MOBILE_PRIVATE_DEPLOY_KEY }}"
sentry_auth_token: "${{ secrets.MM_MOBILE_SENTRY_AUTH_TOKEN }}"
sentry_dsn_ios: "${{ secrets.MM_MOBILE_SENTRY_DSN_IOS }}"
sentry_org: "${{ secrets.MM_MOBILE_SENTRY_ORG }}"
sentry_project_ios: "${{ secrets.MM_MOBILE_SENTRY_PROJECT_IOS }}"
#deploy-to-store:
# uses: ./.github/workflows/.deploy-to-store.yml
# with:
# build_artifact_name: "ios-build-beta-${{ github.run_id }}"
# os: 'ios'
# needs: [build-ios-pr]

49
.github/workflows/build-ios.pr.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
---
name: "build-ios-pr"
on:
push:
branches:
# TODO: remove the `gha-` to match the current workflow again
- 'build-gha-pr-*'
- 'ios-gha-pr-*'
jobs:
build-ios-pr:
uses: ./.github/workflows/.build-ios.yml
with:
branch_to_build: "${{ github.ref_name }}"
build_artifact_name: "ios-build-pr-${{ github.run_id }}"
build_type: "signed"
app_name: "Mattermost Beta"
app_scheme: "mattermost"
aws_bucket_name: "pr-builds.mattermost.com"
aws_folder_name: "mattermost-mobile"
aws_region: "us-east-1"
beta_build: "true"
build_for_release: "true"
build_pr: "true"
extension_app_identifier: "com.mattermost.rnbeta.MattermostShare"
ios_app_group: "group.com.mattermost.rnbeta"
ios_build_export_method: "ad-hoc"
ios_icloud_container: "iCloud.com.mattermost.rnbeta"
main_app_identifier: "com.mattermost.rnbeta"
match_app_identifier: "com.mattermost.rnbeta.NotificationService,com.mattermost.rnbeta.MattermostShare,com.mattermost.rnbeta"
match_readonly: "true"
match_shallow_clone: "true"
match_skip_docs: "true"
match_type: "adhoc"
notification_service_identifier: "com.mattermost.rnbeta.NotificationService"
replace_assets: "false"
show_onboarding: "true"
sync_provisioning_profiles: "true"
secrets:
aws_access_key_id: "${{ secrets.MM_MOBILE_PR_AWS_ACCESS_KEY_ID }}"
aws_secret_access_key: "${{ secrets.MM_MOBILE_PR_AWS_SECRET_ACCESS_KEY }}"
fastlane_team_id : "${{ secrets.MM_MOBILE_FASTLANE_TEAM_ID }}"
ios_api_issuer_id: "${{ secrets.MM_MOBILE_IOS_API_ISSUER_ID }}"
ios_api_key: "${{ secrets.MM_MOBILE_IOS_API_KEY }}"
ios_api_key_id: "${{ secrets.MM_MOBILE_IOS_API_KEY_ID }}"
match_git_url: "${{ secrets.MM_MOBILE_MATCH_GIT_URL }}"
match_password: "${{ secrets.MM_MOBILE_MATCH_PASSWORD }}"
mattermost_webhook_url: "${{ secrets.MM_MOBILE_PR_MATTERMOST_WEBHOOK_URL }}"
private_deploy_key: "${{ secrets.MM_MOBILE_PRIVATE_DEPLOY_KEY }}"

View File

@@ -0,0 +1,19 @@
---
name: "build-ios-simulator"
on:
push:
branches:
# TODO: remove the `gha-` to match the current workflow again
- 'build-gha-*'
- 'build-ios-sim-gha-*'
jobs:
build-ios-unsigned:
uses: ./.github/workflows/.build-ios.yml
with:
build_artifact_name: "ios-build-simulator-${{ github.run_id }}"
build_type: simulator
node_options: "--max_old_space_size=12000"
tag: "${{ github.ref_name }}"
secrets:
gh_token: "${{ secrets.MM_MOBILE_GITHUB_TOKEN }}"

View File

@@ -0,0 +1,36 @@
---
name: "github-release-draft"
on:
push:
tags:
# TODO: remove the `gha-` to match the current workflow again
- 'gha-v[0-9]+.[0-9]+.[0-9]+*'
jobs:
build-ios-unsigned:
uses: ./.github/workflows/.build-ios.yml
with:
build_artifact_name: "ios-build-unsigned-${{ github.run_id }}"
build_type: unsigned
node_options: "--max_old_space_size=12000"
tag: "${{ github.ref_name }}"
secrets:
gh_token: "${{ secrets.MM_MOBILE_GITHUB_TOKEN }}"
# TODO add android job here. Also modify github-release to download its artifact, and to depend on it
github-release:
runs-on: ubuntu-20.04 # To use Ruby 2.7, instead of Ruby 3
steps:
- name: ci/fastlane-dependencies
uses: ./.github/actions/fastlane-dependencies
with:
caching_key: github-release
- name: ci/download-android-artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: "ios-build-unsigned-${{ github.run_id }}"
- run:
name: Create GitHub release
working_directory: fastlane
command: bundle exec fastlane github
# TODO depend on android job as well
needs: [build-ios-unsigned]

9
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
---
name: test
on:
pull_request:
types: [opened, synchronize]
jobs:
test:
uses: ./.github/workflows/.test.yml

1
.gitignore vendored
View File

@@ -102,6 +102,7 @@ detox/detox_pixel_*
# Bundle artifact
*.jsbundle
.bundle
#editor-settings
.vscode

View File

@@ -14,11 +14,11 @@ before_all do
ENV['SPACESHIP_SKIP_2FA_UPGRADE'] = '1'
is_build_pr = ENV['BUILD_PR'] == 'true'
if is_build_pr && ENV['CIRCLECI'] == 'true'
ENV['BRANCH_TO_BUILD'] = ENV['CIRCLE_BRANCH']
if is_build_pr && ENV['CI'] == 'true'
ENV['BRANCH_TO_BUILD'] = ENV['GITHUB_REF_NAME']
end
if ENV['CIRCLECI'] != 'true'
if ENV['CI'] != 'true'
# Raises an error is git is not clean
if ENV['COMMIT_CHANGES_TO_GIT'] == 'true'
ensure_git_status_clean
@@ -46,9 +46,9 @@ before_all do
end
after_all do |lane|
if ENV['CIRCLECI'] != 'true'
if ENV['CI'] != 'true'
if ENV['RESET_GIT_BRANCH'] == 'true'
branch = ENV['BRANCH_TO_BUILD'] || 'master'
branch = ENV['BRANCH_TO_BUILD'] || 'main'
package_id = ENV['MAIN_APP_IDENTIFIER'] || 'com.mattermost.rnbeta'
beta_dir = '../android/app/src/main/java/com/mattermost/rnbeta'
release_dir = "../android/app/src/main/java/#{package_id.gsub '.', '/'}"
@@ -68,7 +68,7 @@ after_all do |lane|
sh "git branch -D #{local_branch}"
UI.success("Deleted working branch \"#{local_branch}\"")
if lane.to_s == 'build_pr'
sh 'git checkout master'
sh 'git checkout main'
## Remove the branch for the PR
sh "git branch -D #{branch}"
UI.success("Deleted PR branch \"#{branch}\"")
@@ -286,7 +286,7 @@ end
desc 'Create GitHub release'
lane :github do
tag = ENV['CIRCLE_TAG'] || ENV['TAG']
tag = ENV['GITHUB_REF_NAME'] || ENV['TAG']
if tag
version = android_get_version_name(gradle_file: './android/app/build.gradle')
@@ -316,8 +316,8 @@ end
platform :ios do
before_all do
if ENV['CIRCLECI'] == 'true'
setup_circle_ci
if ENV['CI'] == 'true'
setup_ci
end
end