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

IOS CI and Ability to distribute to single platform #1095

Merged
merged 78 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
6179c97
added IOS github action.
jigar-f Jun 11, 2024
58bcc65
trigger workflow.
jigar-f Jun 11, 2024
97e3f18
Update release.yml
jigar-f Jun 11, 2024
6c0deae
fix branch issue.
jigar-f Jun 11, 2024
09f2f09
fix syntex issue.
jigar-f Jun 11, 2024
7a52d33
Update build-ios.yml
jigar-f Jun 11, 2024
42c3eff
Added flutter pub get.
jigar-f Jun 11, 2024
f69a390
Added tunnel profile.
jigar-f Jun 11, 2024
00f33a2
Update build-ios.yml
jigar-f Jun 11, 2024
54d12cd
Hide tunnel profile.
jigar-f Jun 11, 2024
9223040
uncomment tunnel profile.
jigar-f Jun 11, 2024
8ef12ec
Update build-ios.yml
jigar-f Jun 11, 2024
9cf5a06
Update build-ios.yml
jigar-f Jun 11, 2024
ccb909a
Update build-ios.yml
jigar-f Jun 11, 2024
afb2c2f
Update build-ios.yml
jigar-f Jun 11, 2024
b0c05c8
Update build-ios.yml
jigar-f Jun 11, 2024
215b757
Update build-ios.yml
jigar-f Jun 11, 2024
dedaeed
Update tunnel vaules.
jigar-f Jun 11, 2024
f4a62d9
uncomment full steps.
jigar-f Jun 11, 2024
e915799
Update project.pbxproj
jigar-f Jun 11, 2024
0bda05c
Fix issue with variable.
jigar-f Jun 11, 2024
72c67e7
Removes automatic signin
jigar-f Jun 11, 2024
2db8780
Trigger CI flow.
jigar-f Jun 11, 2024
f3f89db
Added debug logs.
jigar-f Jun 11, 2024
9df7b9a
Change code sign.
jigar-f Jun 11, 2024
2d72659
Added verbose.
jigar-f Jun 11, 2024
62677fa
Update project.pbxproj
jigar-f Jun 11, 2024
273f38b
Update project.pbxproj
jigar-f Jun 11, 2024
2088f43
Update project.pbxproj
jigar-f Jun 11, 2024
995c724
Added export_option.plist.
jigar-f Jun 12, 2024
d079807
Update build-ios.yml
jigar-f Jun 12, 2024
f81c3e2
Update build-ios.yml
jigar-f Jun 12, 2024
e5e7289
Update build-ios.yml
jigar-f Jun 12, 2024
9acff46
Update build-ios.yml
jigar-f Jun 12, 2024
afa6faf
updated project path.
jigar-f Jun 12, 2024
4f44497
Update build-ios.yml
jigar-f Jun 12, 2024
2d231b0
added scheme in action.
jigar-f Jun 12, 2024
29b4219
Added build framework as step.
jigar-f Jun 12, 2024
cb04d82
update command.
jigar-f Jun 12, 2024
3e59072
updated config.
jigar-f Jun 12, 2024
df96745
Update build-ios.yml
jigar-f Jun 12, 2024
915e6fa
Added changes on FFI bindings step.
jigar-f Jun 12, 2024
dba2ed9
Fix syntax issue.
jigar-f Jun 12, 2024
ba2db58
Removed unused code.
jigar-f Jun 12, 2024
6334e2c
Added TestFlight action.
jigar-f Jun 12, 2024
89b49f7
Change variable name.
jigar-f Jun 12, 2024
a11ccd6
Try to find workspace location.
jigar-f Jun 12, 2024
4a5f268
Update build-ios.yml
jigar-f Jun 12, 2024
8931f76
Update build-ios.yml
jigar-f Jun 12, 2024
d84646c
Update build-ios.yml
jigar-f Jun 12, 2024
898bf4c
Added debug step
jigar-f Jun 12, 2024
8ca0fce
Added more debug steps.
jigar-f Jun 12, 2024
f34cc50
Update build-ios.yml
jigar-f Jun 12, 2024
d9bfa8d
Remove debug steps.
jigar-f Jun 12, 2024
0142ef1
Added lot of debug steps.
jigar-f Jun 12, 2024
f79d0a7
Added echo.
jigar-f Jun 12, 2024
936041c
Update release.yml
jigar-f Jun 12, 2024
7f5180f
use steps instead of needs.
jigar-f Jun 12, 2024
ad7fcdc
Added logs.
jigar-f Jun 12, 2024
7148fb0
Update release.yml
jigar-f Jun 12, 2024
7d7a418
Use env.
jigar-f Jun 12, 2024
0deaf28
Update release.yml
jigar-f Jun 12, 2024
04692b5
Try to use envs.
jigar-f Jun 13, 2024
dfc3f1f
change tag for testing
jigar-f Jun 13, 2024
7044869
Enable all jobs.
jigar-f Jun 13, 2024
3549dd0
Added push to s3 step.
jigar-f Jun 13, 2024
8a123bf
Comment push-binaries step.
jigar-f Jun 13, 2024
71a7342
Updated copy action.
jigar-f Jun 13, 2024
07a4af6
Enable all workflow.
jigar-f Jun 13, 2024
9f11a76
merge latest
atavism Jun 13, 2024
7edd9a8
Upgrade multiple action packages due to d deprecated version.
jigar-f Jun 14, 2024
6c1eb44
Updated readme and updated more actions pacakges.
jigar-f Jun 14, 2024
23e7743
Do not push ios build to s3.
jigar-f Jun 17, 2024
807d0d1
Build ios when tag to prod
jigar-f Jun 21, 2024
93d5af0
merge latest
atavism Jun 23, 2024
d8bbc9f
Merge branch 'jigar/ios-ci' of github.com:getlantern/lantern-client i…
atavism Jun 23, 2024
aed7e42
merge latest
atavism Jun 23, 2024
5644996
merge latest
atavism Jun 23, 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
2 changes: 1 addition & 1 deletion .github/workflows/browerstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run: flutter --version

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

Expand Down
165 changes: 165 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Build Android Installer
on:
workflow_call:
inputs:
version_file:
type: string
required: true
version:
type: string
required: true
prefix:
type: string
required: true

env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern

jobs:
build-android:
env:
version: ${{ inputs.version }}
version_file: ${{ inputs.version_file }}
prefix: ${{ inputs.prefix }}
runs-on: macos-latest-xlarge
steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Pull LFS objects
run: git lfs pull

- name: Installing Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Install latest protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@latest

- name: Granting private modules access
run: |
git config --global url."https://${{ secrets.CI_PRIVATE_REPOS_GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"

- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
organization: getlantern
project: android

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Generate ffi bindings
run: |
make darwin
make ffigen

- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Activate protoc-gen-dart plugin
run: |
echo "${HOME}/.pub-cache/bin" >> $GITHUB_PATH
dart pub global activate protoc_plugin

- name: Set gradle properties
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties

- name: Decode Keystore
id: write_file
uses: timheuer/[email protected]
with:
fileName: 'keystore.release.jks'
fileDir: './android/app'
encodedString: ${{ secrets.KEYSTORE }}

- name: Generate app.env
env:
ANDROID_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID }}
IOS_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID_IOS }}
run: |
touch app.env
echo "Android_interstitialAd=$ANDROID_INTERSTITIAL_AD_ID" > app.env
echo "IOS_interstitialAd=$IOS_INTERSTITIAL_AD_ID" >> app.env

- name: Build Android installers
run: make package-android
env:
INTERSTITIAL_AD_UNIT: "${{ secrets.INTERSTITIAL_AD_UNIT_ID }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
VERSION: "${{ env.version }}"

- uses: actions/upload-artifact@v4
with:
name: android-apk-build
retention-days: 2
path: |
lantern-installer.apk

- uses: actions/upload-artifact@v4
with:
name: android-aab-build
retention-days: 2
path: |
lantern-installer.aab

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install s3cmd
run: pip install s3cmd

- name: Set s3cmd permissions
run: |
echo "[default]" > "$HOME/.s3cfg"
echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"

- name: Push binaries to s3
env:
VERSION: "${{ env.version }}"
APK: "${{ env.prefix }}-${{ env.version }}.apk"
AAB: "${{ env.prefix }}-${{ env.version }}.aab"
update: "lantern_update_android_arm-${{inputs.version}}.bz2"
update_source: lantern_update_android_arm.bz2
run: |
mv ${{ env.update_source }} ${{ env.update }}
mv lantern-installer.apk "$APK"
mv lantern-installer.aab "$AAB"
cp "$APK" ${{ env.prefix }}.apk
cp "$AAB" ${{ env.prefix }}.aab
echo ${{ env.version }} > ${{ env.version_file }}
shasum -a 256 "$APK" | cut -d " " -f 1 > "$APK".sha256
shasum -a 256 "$AAB" | cut -d " " -f 1 > "$AAB".sha256
shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
cp "$APK".sha256 ${{ env.prefix }}.apk.sha256
cp "$AAB".sha256 ${{ env.prefix }}.aab.sha256
s3cmd put --acl-public "$APK" "$APK".sha256 ${{ env.update }} ${{ env.update }}.sha256 ${{ env.version_file }} ${{ env.prefix }}.apk.sha256 ${{ env.prefix }}.apk "s3://$S3_BUCKET"
s3cmd put --acl-public "$AAB" "$AAB".sha256 ${{ env.prefix }}.aab.sha256 ${{ env.prefix }}.aab "s3://$S3_BUCKET"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/$APK"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/${{ env.prefix }}.apk"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/$AAB"
s3cmd modify --add-header='content-type':'application/vnd.android.package-archive' "s3://$S3_BUCKET/${{ env.prefix }}.aab"

6 changes: 3 additions & 3 deletions .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jobs:
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
runs-on: ${{ inputs.macos_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
lfs: true

- name: Pull LFS objects
run: git lfs pull

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

Expand All @@ -62,7 +62,7 @@ jobs:
chmod 600 /tmp/cache/.netrc

- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v1
uses: mathieu-bour/setup-sentry-cli@v2
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
Expand Down
185 changes: 185 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Build IOS
on:
workflow_call:
inputs:
version_file:
type: string
required: true
macos_version:
type: string
required: true
xcode_version:
type: string
required: true
version:
type: string
required: true
prefix:
type: string
required: true
env:
GOPRIVATE: github.com/getlantern
jobs:
build-ios:
runs-on: ${{ inputs.macos_version }}
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
version_file: ${{ inputs.version_file }}
prefix: ${{ inputs.prefix }}
AC_USERNAME: [email protected]
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}

steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Pull LFS objects
run: git lfs pull

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ inputs.xcode_version }}

- name: Repo access
run: |
mkdir /tmp/cache
echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc
chmod 600 /tmp/cache/.netrc

- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
organization: getlantern
project: lantern-ios

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_CERTIFICATE_P12_BASE64 }}
atavism marked this conversation as resolved.
Show resolved Hide resolved
P12_PASSWORD: ${{ secrets.IOS_CERTIFICATE_P12_PASS }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_PROVISION_PROFILE_BASE6 }}
atavism marked this conversation as resolved.
Show resolved Hide resolved
BUILD_TUNNEL_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_TUNNEL_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
EXPORT_OPTIONS: ${{ secrets.EXPORT_OPTION_PLIST }}
run: |
set -x
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
TPP_PATH=$RUNNER_TEMP/build_tpp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
EXPORT_OPTIONS_PATH=$GITHUB_WORKSPACE/ExportOptions.plist


# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH

# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

PROVISIONING_PROFILES_DIR=~/Library/MobileDevice/Provisioning\ Profiles
mkdir -p "$PROVISIONING_PROFILES_DIR"

# apply main provisioning profile
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles

# apply tunnel provisioning profile
echo -n "$BUILD_TUNNEL_PROVISION_PROFILE_BASE64" | base64 --decode -o $TPP_PATH
cp $TPP_PATH ~/Library/MobileDevice/Provisioning\ Profiles

# Create ExportOptions.plist
echo "$EXPORT_OPTIONS" | base64 --decode > "$EXPORT_OPTIONS_PATH"

- name: Generate FFI bindings
run: |
make darwin
make ffigen

- name: Generate app.env
env:
ANDROID_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID }}
IOS_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID_IOS }}
run: |
touch app.env
echo "Android_interstitialAd=$ANDROID_INTERSTITIAL_AD_ID" > app.env
echo "IOS_interstitialAd=$IOS_INTERSTITIAL_AD_ID" >> app.env

- name: Get dependencies & Pod install
run: |
flutter pub get
cd ios
pod install
cd ..

- name: Build iOS app
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: getlantern
SENTRY_PROJECT_IOS: lantern-ios
run: make ios-release

- name: Upload application
uses: actions/upload-artifact@v4
with:
name: Lantern.ipa
path: ${{ github.workspace }}/build/ios/ipa/Lantern.ipa
retention-days: 2
#
# - name: Compress artifacts using bzip2
# run: |
# cd ${{ github.workspace }}/build/ios/ipa/
# bzip2 -zk Lantern.ipa
#
# - name: Copy .ipa and .bz2 to root
# run: |
# cp ${{ github.workspace }}/build/ios/ipa/Lantern.ipa ${{ github.workspace }}/Lantern.ipa
# cp ${{ github.workspace }}/build/ios/ipa/Lantern.ipa.bz2 ${{ github.workspace }}/Lantern.ipa.bz2
#
# - name: Install s3cmd
# run: pip install s3cmd
#
# - name: Set s3cmd permissions
# run: |
# echo "[default]" > "$HOME/.s3cfg"
# echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
# echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"
#
# - name: Push binaries to s3
# env:
# VERSION: "${{ env.version }}"
# IPA: "${{ env.prefix }}-${{ env.version }}.ipa"
# update: "lantern_update_ios-${{inputs.version}}.bz2"
# update_source: Lantern.ipa.bz2
# run: |
# mv ${{ env.update_source }} ${{ env.update }}
# mv Lantern.ipa "$IPA"
# cp "$IPA" ${{ env.prefix }}.ipa
# echo ${{ env.version }} > ${{ env.version_file }}
# shasum -a 256 "$IPA" | cut -d " " -f 1 > "$IPA".sha256
# shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
# cp "$IPA".sha256 ${{ env.prefix }}.ipa.sha256
# s3cmd put --acl-public "$IPA" "$IPA".sha256 ${{ env.update }} ${{ env.update }}.sha256 ${{ env.version_file }} ${{ env.prefix }}.ipa.sha256 ${{ env.prefix }}.ipa "s3://lantern"
Loading
Loading