Skip to content

Feature/android builds on windows clean #150

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

Merged
merged 8 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Android Builds

on:
on:
pull_request:
types: [opened, reopened, synchronize]

Expand All @@ -14,13 +14,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
architecture: ["x64",]
include:
- os: ubuntu-latest
architecture: "x64"
- os: macos-latest
architecture: "x64"
- os: windows-latest
architecture: "x64"

steps:
- uses: actions/checkout@v2
Expand All @@ -38,10 +40,15 @@ jobs:
python-version: 3.7
architecture: ${{ matrix.architecture }}

- name: Add msbuild to PATH
if: startsWith(matrix.os, 'windows')
uses: microsoft/[email protected]

- name: Install prerequisites
shell: bash
run: |
build_scripts/android/install_prereqs.sh

- name: Cache ccache files
id: cache_ccache
uses: actions/cache@v2
Expand All @@ -50,6 +57,7 @@ jobs:
key: dev-test-ccache-${{ env.MATRIX_UNIQUE_NAME }}

- name: Build SDK
shell: bash
run: |
build_scripts/android/build.sh android_build .

Expand Down
15 changes: 11 additions & 4 deletions build_scripts/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ if [[ -n $(ls) ]]; then
exit 2
fi
cd -
# Turn buildpath into an absolute path for use later with rsync.
buildpath=$( cd "${buildpath}" ; pwd -P )

# If NDK_ROOT is not set or is the wrong version, use to the version in /tmp.
if [[ -z "${NDK_ROOT}" || ! $(grep -q "Pkg\.Revision = 16\." "${NDK_ROOT}/source.properties") ]]; then
Expand Down Expand Up @@ -54,6 +52,15 @@ for lib in *; do
fi
done
set -x
# Use rsync to copy the relevent paths to the destination directory.
rsync -aR "${paths[@]}" "${buildpath}/"

if [[ $(uname) == "Linux" ]] || [[ $(uname) == "Darwin" ]]; then
# Turn buildpath into an absolute path for use later with rsync.
buildpath=$( cd "${buildpath}" ; pwd -P )
# Use rsync to copy the relevent paths to the destination directory.
rsync -aR "${paths[@]}" "${buildpath}/"
else
# rsync has to be specifically installed on windows bash (including github runners)
# Also, rsync with absolute destination path doesn't work on Windows.
# Using a simple copy instead of rsync on Windows.
cp -R --parents "${paths[@]}" "${buildpath}"
fi
23 changes: 16 additions & 7 deletions build_scripts/android/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ elif [[ $(uname) == "Linux" ]]; then
echo "::set-env name=CCACHE_INSTALLED::1"
fi
else
echo "Unsupported platform, this script must run on a MacOS or Linux machine."
exit 1
platform=windows
# On Windows, we have an additional dependency for Strings
curl -LSs \ curl -LSs \
"https://download.sysinternals.com/files/Strings.zip" \
--output Strings.zip
unzip -q Strings.zip && rm -f Strings.zip
fi

if [[ -z $(which cmake) ]]; then
Expand All @@ -28,11 +32,16 @@ if [[ -z $(which python) ]]; then
else
updated_pip=0
if ! $(echo "import absl"$'\n'"import google.protobuf" | python - 2> /dev/null); then
echo "Installing python packages."
set -x
sudo python -m pip install --upgrade pip
pip install absl-py protobuf
set +x
echo "Installing python packages."
set -x
# On Windows bash shell, sudo doesn't exist
if [[ $(uname) == "Linux" ]] || [[ $(uname) == "Darwin" ]]; then
sudo python -m pip install --upgrade pip
else
python -m pip install --upgrade pip
fi
pip install absl-py protobuf
set +x
fi
fi

Expand Down