Skip to content

Commit

Permalink
Android and iOS build on CircleCI (ethereum#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanregisser authored and Mariano Cortesi committed Jan 31, 2020
1 parent 9dcb899 commit 05e0919
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 42 deletions.
79 changes: 79 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,68 @@ jobs:
paths:
- geth

android:
docker:
- image: celohq/android-client
user: circleci
working_directory: ~/repos/geth
steps:
- checkout
- run:
name: Compile android client
command: |
set -euo pipefail
# TODO(jeanregisser): Fix docker image so build works directly with circleci user
sudo chown -R circleci:circleci $HOME/.rustup $HOME/.cargo
export PATH=$PATH:$HOME/.cargo/bin
export NDK_VERSION=android-ndk-r19c
export ANDROID_NDK=/opt/android/${NDK_VERSION}
export ANDROID_HOME=/opt/android/sdk
make android
- persist_to_workspace:
root: ~/repos
paths:
- geth/build/bin/geth.aar

ios:
macos:
xcode: "11.3.1"
working_directory: ~/repos/geth
steps:
- checkout
- run:
name: Setup Go language
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install [email protected]
- run:
name: Setup Rust language
command: |
set -euo pipefail
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=$PATH:$HOME/.cargo/bin
rustup install 1.37.0
rustup default 1.37.0
- run:
name: Compile ios client
command: |
set -euo pipefail
export PATH="/usr/local/opt/[email protected]/bin:$HOME/.cargo/bin:$PATH"
make ios
- persist_to_workspace:
root: ~/repos
paths:
- geth/build/bin/Geth.framework.tgz
- geth/vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a
- geth/vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_snark.a

publish-mobile-client:
docker:
- image: circleci/node:10
working_directory: ~/repos/geth
steps:
- attach_workspace:
at: ~/repos
- run: ./scripts/publish-mobile-client.sh ${CIRCLE_SHA1} ${NPM_TOKEN_FOR_CELO_CLIENT}

end-to-end-monorepo-checkout:
<<: *end-to-end-defaults
working_directory: ~/repos/celo-monorepo
Expand Down Expand Up @@ -168,6 +230,23 @@ workflows:
jobs:
- bls-zexe
- lint
- android
- ios
- publish-mobile-client:
requires:
- android
- ios
# Makes sure tests are all green before publishing
# Though these are not using the mobile built binaries
# they should be a good indicator
- unit-tests
- end-to-end-transfer-test
- end-to-end-sync-test
- end-to-end-blockchain-parameters-test
- end-to-end-geth-governance-test
filters:
branches:
only: master
- end-to-end-monorepo-checkout
- unit-tests:
requires:
Expand Down
14 changes: 0 additions & 14 deletions Dockerfile.androidbuild

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ android: bls-zexe-android

ios: bls-zexe-ios
build/env.sh go run build/ci.go xcode --local
pushd "$(GOBIN)"; rm -rf Geth.framework.zip; zip -r9y Geth.framework.zip Geth.framework; popd
pushd "$(GOBIN)"; rm -rf Geth.framework.tgz; tar -czvf Geth.framework.tgz Geth.framework; popd
@echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."

Expand Down
10 changes: 0 additions & 10 deletions cloudbuild-android.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions npm-android.sh

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"license": "LGPL-3.0",
"files": [
"build/bin/geth.aar",
"build/bin/Geth.framework.zip",
"build/bin/Geth.framework.tgz",
"CeloBlockchain.podspec",
"crypto/bls/bls-zexe/bls/target/universal/release/libbls_zexe.a",
"crypto/bls/bls-zexe/bls/target/universal/release/libbls_snark.a"
],
"scripts": {
"postinstall": "rm -rf build/bin/Geth.framework && unzip build/bin/Geth.framework.zip -d build/bin && touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a"
"postinstall": "rm -rf build/bin/Geth.framework && tar -xvf build/bin/Geth.framework.tgz -C build/bin && touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a"
}
}
29 changes: 29 additions & 0 deletions scripts/publish-mobile-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
#
# Usage: ./scripts/publish-mobile-client.sh $COMMIT_SHA $NPM_TOKEN

set -euo pipefail

# Process args
commit_sha_short="${1:0:7}"
npm_token="${2:-}"

package_name="$(node -p "require('./package.json').name")"

version=$(npm show "$package_name" version)
# Bump minor version
a=( ${version//./ } )
((a[2]++))
new_version="${a[0]}.${a[1]}.${a[2]}"

# Add npm token if provided
if [ -n "$npm_token" ]; then
echo "//registry.npmjs.org/:_authToken=$npm_token" > ~/.npmrc
fi

# TODO: Create an appropriate README for NPM
rm README.md

npm -f --no-git-tag-version version "$new_version"
npm publish --tag "$commit_sha_short" --access public
npm dist-tag add "$package_name@$new_version" latest

0 comments on commit 05e0919

Please sign in to comment.