Skip to content

Commit 6c4e7ec

Browse files
authored
Merge pull request #3025 from element-hq/feature/bma/elementEnterprise
Element enterprise (EE) foundations
2 parents 78b6d8f + 7d3c447 commit 6c4e7ec

File tree

36 files changed

+602
-37
lines changed

36 files changed

+602
-37
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
debug:
1717
name: Build APKs
1818
runs-on: ubuntu-latest
19-
# Skip for `main`
20-
if: github.ref != 'refs/heads/main'
2119
strategy:
2220
matrix:
2321
variant: [debug, release, nightly, samples]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Enterprise APK Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
merge_group:
7+
push:
8+
branches: [ develop ]
9+
10+
# Enrich gradle.properties for CI/CD
11+
env:
12+
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx7g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.incremental=false -XX:+UseG1GC
13+
CI_GRADLE_ARG_PROPERTIES: --stacktrace -Dsonar.gradle.skipCompile=true
14+
15+
jobs:
16+
build:
17+
name: Build Enterprise APKs
18+
runs-on: ubuntu-latest
19+
# Skip in forks
20+
if: github.repository == 'element-hq/element-x-android'
21+
strategy:
22+
matrix:
23+
variant: [debug, release, nightly]
24+
fail-fast: false
25+
# Allow all jobs on develop. Just one per PR.
26+
concurrency:
27+
group: ${{ github.ref == 'refs/heads/develop' && format('build-develop-enterprise-{0}-{1}', matrix.variant, github.sha) || format('build-enterprise-{0}-{1}', matrix.variant, github.ref) }}
28+
cancel-in-progress: true
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
# Ensure we are building the branch and not the branch after being merged on develop
33+
# https://github.com/actions/checkout/issues/881
34+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
35+
- name: Add SSH private keys for submodule repositories
36+
uses: webfactory/[email protected]
37+
with:
38+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
39+
- name: Clone submodules
40+
run: git submodule update --init --recursive
41+
- name: Use JDK 17
42+
uses: actions/setup-java@v4
43+
with:
44+
distribution: 'temurin' # See 'Supported distributions' for available options
45+
java-version: '17'
46+
- name: Configure gradle
47+
uses: gradle/actions/setup-gradle@v3
48+
with:
49+
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
50+
- name: Assemble debug Gplay Enterprise APK
51+
if: ${{ matrix.variant == 'debug' }}
52+
env:
53+
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
54+
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
55+
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
56+
run: ./gradlew :app:assembleGplayDebug -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES
57+
- name: Upload debug Enterprise APKs
58+
if: ${{ matrix.variant == 'debug' }}
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: elementx-enterprise-debug
62+
path: |
63+
app/build/outputs/apk/gplay/debug/*-universal-debug.apk
64+
- name: Compile release sources
65+
if: ${{ matrix.variant == 'release' }}
66+
run: ./gradlew compileReleaseSources -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES
67+
- name: Compile nightly sources
68+
if: ${{ matrix.variant == 'nightly' }}
69+
run: ./gradlew compileGplayNightlySources -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES

.github/workflows/danger.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ jobs:
88
name: Danger main check
99
steps:
1010
- uses: actions/checkout@v4
11+
- name: Add SSH private keys for submodule repositories
12+
uses: webfactory/[email protected]
13+
with:
14+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
15+
- name: Clone submodules
16+
if: github.repository == 'element-hq/element-x-android'
17+
run: git submodule update --init --recursive
1118
- run: |
1219
npm install --save-dev @babel/plugin-transform-flow-strip-types
1320
- name: Danger
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and release Enterprise nightly application
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Every nights at 4
7+
- cron: "0 4 * * *"
8+
9+
env:
10+
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx6g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.incremental=false -XX:+UseG1GC
11+
CI_GRADLE_ARG_PROPERTIES: --stacktrace --no-daemon -Dsonar.gradle.skipCompile=true
12+
13+
jobs:
14+
nightly:
15+
name: Build and publish Enterprise nightly bundle to Firebase
16+
runs-on: ubuntu-latest
17+
if: ${{ github.repository == 'element-hq/element-x-android' }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Add SSH private keys for submodule repositories
21+
uses: webfactory/[email protected]
22+
with:
23+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
24+
- name: Clone submodules
25+
run: git submodule update --init --recursive
26+
- name: Use JDK 17
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'temurin' # See 'Supported distributions' for available options
30+
java-version: '17'
31+
- name: Install towncrier
32+
run: |
33+
python3 -m pip install towncrier
34+
- name: Prepare changelog file
35+
run: |
36+
mv towncrier.toml towncrier.toml.bak
37+
sed 's/CHANGES\.md/CHANGES_NIGHTLY\.md/' towncrier.toml.bak > towncrier.toml
38+
rm towncrier.toml.bak
39+
yes n | towncrier build --version nightly
40+
- name: Build and upload Nightly application
41+
run: |
42+
./gradlew assembleGplayNightly appDistributionUploadGplayNightly $CI_GRADLE_ARG_PROPERTIES
43+
env:
44+
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
45+
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
46+
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
47+
ELEMENT_ANDROID_NIGHTLY_KEYID: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_KEYID }}
48+
ELEMENT_ANDROID_NIGHTLY_KEYPASSWORD: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_KEYPASSWORD }}
49+
ELEMENT_ANDROID_NIGHTLY_STOREPASSWORD: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_STOREPASSWORD }}
50+
FIREBASE_TOKEN: ${{ secrets.ELEMENT_ANDROID_NIGHTLY_FIREBASE_TOKEN }}
51+
- name: Additionally upload Nightly APK to browserstack for testing
52+
continue-on-error: true # don't block anything by this upload failing (for now)
53+
run: |
54+
curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_PASSWORD" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=@app/build/outputs/apk/gplay/nightly/app-gplay-universal-nightly.apk" -F "custom_id=element-x-android-nightly"
55+
env:
56+
BROWSERSTACK_USERNAME: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_USERNAME }}
57+
BROWSERSTACK_PASSWORD: ${{ secrets.ELEMENT_ANDROID_BROWSERSTACK_ACCESS_KEY }}

.github/workflows/quality.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21+
- name: Add SSH private keys for submodule repositories
22+
uses: webfactory/[email protected]
23+
with:
24+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
25+
- name: Clone submodules
26+
if: github.repository == 'element-hq/element-x-android'
27+
run: git submodule update --init --recursive
2128
- name: Run code quality check suite
2229
run: ./tools/check/check_code_quality.sh
2330

@@ -68,6 +75,13 @@ jobs:
6875
# Ensure we are building the branch and not the branch after being merged on develop
6976
# https://github.com/actions/checkout/issues/881
7077
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
78+
- name: Add SSH private keys for submodule repositories
79+
uses: webfactory/[email protected]
80+
with:
81+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
82+
- name: Clone submodules
83+
if: github.repository == 'element-hq/element-x-android'
84+
run: git submodule update --init --recursive
7185
- name: Use JDK 17
7286
uses: actions/setup-java@v4
7387
with:
@@ -100,6 +114,13 @@ jobs:
100114
# Ensure we are building the branch and not the branch after being merged on develop
101115
# https://github.com/actions/checkout/issues/881
102116
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
117+
- name: Add SSH private keys for submodule repositories
118+
uses: webfactory/[email protected]
119+
with:
120+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
121+
- name: Clone submodules
122+
if: github.repository == 'element-hq/element-x-android'
123+
run: git submodule update --init --recursive
103124
- name: Use JDK 17
104125
uses: actions/setup-java@v4
105126
with:
@@ -136,6 +157,13 @@ jobs:
136157
# Ensure we are building the branch and not the branch after being merged on develop
137158
# https://github.com/actions/checkout/issues/881
138159
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
160+
- name: Add SSH private keys for submodule repositories
161+
uses: webfactory/[email protected]
162+
with:
163+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
164+
- name: Clone submodules
165+
if: github.repository == 'element-hq/element-x-android'
166+
run: git submodule update --init --recursive
139167
- name: Use JDK 17
140168
uses: actions/setup-java@v4
141169
with:
@@ -168,6 +196,13 @@ jobs:
168196
# Ensure we are building the branch and not the branch after being merged on develop
169197
# https://github.com/actions/checkout/issues/881
170198
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
199+
- name: Add SSH private keys for submodule repositories
200+
uses: webfactory/[email protected]
201+
with:
202+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
203+
- name: Clone submodules
204+
if: github.repository == 'element-hq/element-x-android'
205+
run: git submodule update --init --recursive
171206
- name: Use JDK 17
172207
uses: actions/setup-java@v4
173208
with:
@@ -200,6 +235,13 @@ jobs:
200235
# Ensure we are building the branch and not the branch after being merged on develop
201236
# https://github.com/actions/checkout/issues/881
202237
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
238+
- name: Add SSH private keys for submodule repositories
239+
uses: webfactory/[email protected]
240+
with:
241+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
242+
- name: Clone submodules
243+
if: github.repository == 'element-hq/element-x-android'
244+
run: git submodule update --init --recursive
203245
- name: Use JDK 17
204246
uses: actions/setup-java@v4
205247
with:

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,40 @@ jobs:
3939
path: |
4040
app/build/outputs/bundle/gplayRelease/app-gplay-release.aab
4141
42+
enterprise:
43+
name: Create App Bundle Enterprise
44+
runs-on: ubuntu-latest
45+
concurrency:
46+
group: ${{ format('build-release-main-gplay-{0}', github.sha) }}
47+
cancel-in-progress: true
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Add SSH private keys for submodule repositories
51+
uses: webfactory/[email protected]
52+
with:
53+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
54+
- name: Clone submodules
55+
run: git submodule update --init --recursive
56+
- name: Use JDK 17
57+
uses: actions/setup-java@v4
58+
with:
59+
distribution: 'temurin' # See 'Supported distributions' for available options
60+
java-version: '17'
61+
- name: Configure gradle
62+
uses: gradle/actions/setup-gradle@v3
63+
- name: Create Enterprise app bundle
64+
env:
65+
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
66+
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
67+
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
68+
run: ./gradlew bundleGplayRelease $CI_GRADLE_ARG_PROPERTIES
69+
- name: Upload bundle as artifact
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: elementx-enterprise-app-gplay-bundle-unsigned
73+
path: |
74+
app/build/outputs/bundle/gplayRelease/app-gplay-release.aab
75+
4276
fdroid:
4377
name: Create APKs (FDroid)
4478
runs-on: ubuntu-latest

.github/workflows/tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
# Ensure we are building the branch and not the branch after being merged on develop
3939
# https://github.com/actions/checkout/issues/881
4040
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
41+
- name: Add SSH private keys for submodule repositories
42+
uses: webfactory/[email protected]
43+
with:
44+
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
45+
- name: Clone submodules
46+
if: github.repository == 'element-hq/element-x-android'
47+
run: git submodule update --init --recursive
4148
- name: ☕️ Use JDK 17
4249
uses: actions/setup-java@v4
4350
with:

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "enterprise"]
2+
path = enterprise
3+
url = [email protected]:element-hq/element-android-enterprise.git

.idea/copyright/Element_FOSS.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/Enterprise.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)