Merge pull request #218 from ProtonMail/fix/gomobile-build-ci
Fix the build pipeline for iOS and Android
This commit is contained in:
commit
3152e50f92
4 changed files with 42 additions and 111 deletions
40
.github/workflows/ios.yml
vendored
40
.github/workflows/ios.yml
vendored
|
|
@ -12,16 +12,16 @@ jobs:
|
|||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Set up xcode 13.2
|
||||
- name: Set up xcode 14.2
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: 13.2
|
||||
xcode-version: 14.2
|
||||
id: xcode
|
||||
|
||||
- name: Set up Go 1.15.15
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.15.15
|
||||
go-version: ^1.16
|
||||
id: go
|
||||
|
||||
- name: Checkout
|
||||
|
|
@ -37,37 +37,9 @@ jobs:
|
|||
./build.sh apple
|
||||
find dist
|
||||
|
||||
- name: Upload iOS artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: iOS build
|
||||
path: dist/ios
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload mac OS artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: mac OS build
|
||||
path: dist/macos
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload mac OS ui artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: mac OS ui build
|
||||
path: dist/macos-ui
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload iOS simulator artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: iOS simulator build
|
||||
path: dist/ios-simulator
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload xcframework
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Gopenpgp xcframework
|
||||
path: dist/Gopenpgp.xcframework
|
||||
name: gopenpgp.xcframework
|
||||
path: dist/apple/gopenpgp.xcframework
|
||||
if-no-files-found: error
|
||||
|
|
|
|||
73
build.sh
73
build.sh
|
|
@ -15,7 +15,7 @@ reset="\033[0m"
|
|||
|
||||
# Trap in case something went wrong
|
||||
failed_build() {
|
||||
printf "${red}The build failed!\n${reset}"
|
||||
printf "${red}The build failed!\nRun 'make clean' before retrying...\n${reset}"
|
||||
}
|
||||
|
||||
install_modules()
|
||||
|
|
@ -28,12 +28,24 @@ install_modules()
|
|||
install_gomobile()
|
||||
{
|
||||
printf "${green}Installing gomobile fork${reset}\n\n"
|
||||
|
||||
go get golang.org/x/mobile/cmd/gomobile@latest
|
||||
go get golang.org/x/mobile/cmd/gobind@latest
|
||||
|
||||
go build golang.org/x/mobile/cmd/gomobile
|
||||
go build golang.org/x/mobile/cmd/gobind
|
||||
PATH=$(pwd):$PATH
|
||||
printf "${green}Done ${reset}\n\n"
|
||||
}
|
||||
|
||||
|
||||
get_modules(){
|
||||
printf "${green}Start installing go modules and their dependencies ${reset}\n\n"
|
||||
GO111MODULE=on go mod download
|
||||
printf "${green}Done ${reset}\n\n"
|
||||
}
|
||||
|
||||
|
||||
remove_dir()
|
||||
{
|
||||
DIR=$1
|
||||
|
|
@ -46,19 +58,22 @@ remove_dir()
|
|||
build()
|
||||
{
|
||||
TARGET=$1
|
||||
OUTPUT_DIR=$2
|
||||
TAGS="mobile"
|
||||
if [ $TARGET = "android" ]; then
|
||||
JAVAPKG_FLAG="-javapkg=${ANDROID_JAVA_PKG}"
|
||||
JAVAPKG_FLAG="-javapkg=com.proton.gopenpgp"
|
||||
OUT_EXTENSION="aar"
|
||||
else
|
||||
JAVAPKG_FLAG=""
|
||||
OUT_EXTENSION="framework"
|
||||
OUT_EXTENSION="xcframework"
|
||||
TAGS="$TAGS,ios"
|
||||
fi
|
||||
TARGET_DIR=${OUT_DIR}/${TARGET}
|
||||
TARGET_DIR=${OUT_DIR}/${OUTPUT_DIR}
|
||||
TARGET_OUT_FILE=${TARGET_DIR}/${BUILD_NAME}.${OUT_EXTENSION}
|
||||
mkdir -p $TARGET_DIR
|
||||
printf "${green}Start Building ${TARGET} .. Location: ${TARGET_DIR} ${reset}\n\n"
|
||||
remove_dir $TARGET_OUT_FILE
|
||||
./gomobile bind -tags mobile -target $TARGET $JAVAPKG_FLAG -x -ldflags="-s -w" -o ${TARGET_OUT_FILE} ${PACKAGES}
|
||||
./gomobile bind -tags $TAGS -target $TARGET $JAVAPKG_FLAG -x -ldflags="-s -w " -o ${TARGET_OUT_FILE} ${PACKAGES}
|
||||
}
|
||||
|
||||
# import function, add internal package in the build
|
||||
|
|
@ -69,15 +84,14 @@ import()
|
|||
|
||||
|
||||
## ======== Config ===============
|
||||
|
||||
# ==== Generic parameters ======
|
||||
|
||||
# output directory
|
||||
OUT_DIR="./dist"
|
||||
OUT_DIR="dist"
|
||||
|
||||
# name of the build output
|
||||
BUILD_NAME="Gopenpgp"
|
||||
|
||||
ANDROID_JAVA_PKG="com.proton.${BUILD_NAME}"
|
||||
BUILD_NAME="gopenpgp"
|
||||
|
||||
# ==== Packages to included =====
|
||||
PACKAGES=""
|
||||
|
|
@ -91,58 +105,31 @@ import github.com/ProtonMail/gopenpgp/v2/helper
|
|||
|
||||
######## ======== Main ===========
|
||||
|
||||
# We get the needed go modules stated in the go.mod file
|
||||
install_modules
|
||||
install_gomobile
|
||||
|
||||
get_modules
|
||||
|
||||
go env
|
||||
echo "PATH=$PATH"
|
||||
echo "gomobile:$(which gomobile)"
|
||||
echo "ndk:$ANDROID_NDK_HOME"
|
||||
|
||||
printf "Packages included : ${PACKAGES}\n"
|
||||
## start building
|
||||
|
||||
|
||||
# ================= Apple Builds ======================
|
||||
# ========== iOS and Simulator =========
|
||||
# we build the framework for the ios devices and simulator
|
||||
if [ $NB_INPUTS -ne 1 ] || [ $USER_INPUT = apple ]; then
|
||||
# we build the framework for the ios sim on arm64 macs
|
||||
|
||||
build ios-simulator
|
||||
|
||||
# we build the framework for the ios devices
|
||||
build ios
|
||||
|
||||
# ========== macOs ====================
|
||||
|
||||
# we build the framework for the macos devices
|
||||
|
||||
build macos
|
||||
|
||||
# ======== macOSUI ===============
|
||||
|
||||
# we build the framework for the macos-ui target
|
||||
|
||||
build macos-ui
|
||||
|
||||
# we join all platform's framework in a xcframework
|
||||
XCFRAMEWORK_OUT_FILE=$OUT_DIR/$BUILD_NAME.xcframework
|
||||
remove_dir $XCFRAMEWORK_OUT_FILE;
|
||||
xcodebuild -create-xcframework \
|
||||
-framework $OUT_DIR/ios/$BUILD_NAME.framework \
|
||||
-framework $OUT_DIR/macos/$BUILD_NAME.framework \
|
||||
-framework $OUT_DIR/macos-ui/$BUILD_NAME.framework \
|
||||
-framework $OUT_DIR/ios-simulator/$BUILD_NAME.framework \
|
||||
-output $XCFRAMEWORK_OUT_FILE
|
||||
|
||||
build ios,iossimulator,macos apple
|
||||
fi
|
||||
|
||||
|
||||
# ================ Android Build =====================
|
||||
if [ $NB_INPUTS -ne 1 ] || [ $USER_INPUT = android ]; then
|
||||
build android
|
||||
build android android
|
||||
fi
|
||||
|
||||
printf "${green}All Done. ${reset}\n\n"
|
||||
|
||||
|
||||
trap - EXIT
|
||||
5
go.mod
5
go.mod
|
|
@ -9,7 +9,6 @@ require (
|
|||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
|
||||
golang.org/x/mobile v0.0.0-20221110043201-43a038452099 // indirect
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
)
|
||||
|
||||
replace golang.org/x/mobile => github.com/ProtonMail/go-mobile v0.0.0-20210326110230-f181c70e4e2b
|
||||
|
|
|
|||
35
go.sum
35
go.sum
|
|
@ -1,18 +1,13 @@
|
|||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20221031134845-8fd9bc37cf08 h1:dS7r5z4iGS0qCjM7UwWdsEMzQesUQbGcXdSm2/tWboA=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20221031134845-8fd9bc37cf08/go.mod h1:qRZgbeASl2a9OwmsV85aWwRqic0NHPh+9ewGAzb4cgM=
|
||||
github.com/ProtonMail/go-mobile v0.0.0-20210326110230-f181c70e4e2b h1:XVeh08xp93T+xK6rzpCSQTZ+LwEo+ASHvOifrQ5ZgEE=
|
||||
github.com/ProtonMail/go-mobile v0.0.0-20210326110230-f181c70e4e2b/go.mod h1:Naot1YTww71UdzhpocCmKjmnb8+3Jlcww/TW6kP6/yc=
|
||||
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/cloudflare/circl v1.1.0 h1:bZgT/A+cikZnKIwn7xL2OBj012Bmvho/o6RpRvv3GKY=
|
||||
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
|
||||
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
|
@ -20,42 +15,20 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd h1:ePuNC7PZ6O5BzgPn9bZayERXBdfZjUYoXEf5BTfDfh8=
|
||||
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw=
|
||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69 h1:yBHHx+XZqXJBm6Exke3N7V9gnlsyXxoCPEb1yVenjfk=
|
||||
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue