Skip to content

Commit

Permalink
Add comments and be sure to segment action cache by architecture.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Apr 4, 2022
1 parent e803908 commit 34a10e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ jobs:
python-version: 3.9
- uses: actions/cache@v2
with:
# This is where python for android puts its intermediary build
# files - we cache this to improve build performance, but be
# aggressive in clearing the cache whenever any file changes
# in the repository.
path: ~/.local
key: ${{ runner.os }}-local-${{ hashFiles('*') }}
key: ${{ runner.os }}-local-${{ github.event.inputs.arch || inputs.arch }}-${{ hashFiles('*') }}
restore-keys: |
${{ runner.os }}-local-
${{ runner.os }}-local-${{ github.event.inputs.arch || inputs.arch }}-
- uses: actions/cache@v2
with:
path: ~/.cache/pip
Expand All @@ -76,6 +80,9 @@ jobs:
- name: Build the app
env:
ARCH: ${{ github.event.inputs.arch || inputs.arch }}
# No need to set the ANDROID_HOME environment variable here that is used for
# setting up the ANDROID SDK and ANDROID NDK, as the github actions images
# have these SDKs and NDKs already installed.
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-3
ANDROIDSDK: ${{ env.ANDROID_SDK_ROOT }}
ANDROIDNDK: ${{ env.ANDROID_NDK_ROOT }}
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ ANDROIDNDKVER := 21.4.7075529

SDK := ${ANDROID_HOME}/android-sdk-$(PLATFORM)

# This checks if an environment variable with a specific name
# exists. If it doesn't, it prints an error message and exits.
# For example to check for the presence of the ANDROIDSDK environment
# variable, you could use:
# make guard-ANDROIDSDK
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
Expand Down Expand Up @@ -72,6 +77,7 @@ needs-version:

.PHONY: kolibri.apk
# Build the signed version of the apk
# For some reason, p4a defauls to adding a final '-' to the filename, so we remove it in the final step.
kolibri.apk: p4a_android_distro src/kolibri needs-version
$(MAKE) guard-P4A_RELEASE_KEYSTORE
$(MAKE) guard-P4A_RELEASE_KEYALIAS
Expand All @@ -84,6 +90,7 @@ kolibri.apk: p4a_android_distro src/kolibri needs-version

.PHONY: kolibri.apk.unsigned
# Build the unsigned debug version of the apk
# For some reason, p4a defauls to adding a final '-' to the filename, so we remove it in the final step.
kolibri.apk.unsigned: p4a_android_distro src/kolibri needs-version
@echo "--- :android: Build APK (unsigned)"
p4a apk --arch=$(P4A_ARCH) --version=$(APK_VERSION) --numeric-version=$(BUILD_NUMBER)
Expand Down Expand Up @@ -125,6 +132,9 @@ sdk:
@echo "Accepting all licenses"
yes | $(SDK)/cmdline-tools/bin/sdkmanager --licenses --sdk_root=$(SDK)

# All of these commands are non-destructive, so if the cmdline-tools are already installed, make will skip
# based on the directory existing.
# The SDK installations will take a little time, but will not attempt to redownload if already installed.
setup:
$(MAKE) guard-ANDROID_HOME
mkdir -p $(SDK)
Expand Down

0 comments on commit 34a10e9

Please sign in to comment.