mirror of
https://github.com/ArtemSBulgakov/buildozer-action.git
synced 2024-08-16 10:09:52 +02:00
Move global_buildozer_dir to workspace
This commit is contained in:
parent
49198bf782
commit
4879dd7027
4 changed files with 53 additions and 0 deletions
|
@ -11,5 +11,6 @@ RUN pip3 uninstall -y buildozer
|
|||
RUN echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf > /dev/null
|
||||
|
||||
COPY entrypoint.sh /action/entrypoint.sh
|
||||
COPY patches.py /action/patches.py
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
|
|
24
README.md
24
README.md
|
@ -41,6 +41,30 @@ Filename of built package relative to repository root.
|
|||
|
||||
- Example: `test_app/bin/testapp-0.1-armeabi-v7a-debug.apk`
|
||||
|
||||
## Caching
|
||||
|
||||
You can set up cache for Buildozer global and local directories. Global
|
||||
directory is in root of repository. Local directory is in workdir.
|
||||
|
||||
- Global: `.buildozer-global` (sdk, ndk, platform-tools)
|
||||
- Local: `test_app/.buildozer` (dependencies, build temp, _not recommended to cache_)
|
||||
|
||||
I don't recommend to cache local buildozer directory because Buildozer doesn't
|
||||
automatically update dependencies to latest version.
|
||||
|
||||
Use cache only if it speeds up your workflow! Usually this only adds 1-3 minutes
|
||||
to job running time, so I don't use it.
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
- name: Cache Buildozer global directory
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .buildozer-global
|
||||
key: buildozer-global-${{ hashFiles('test_app/buildozer.spec') }} # Replace with your path
|
||||
```
|
||||
|
||||
## Example usage
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -34,6 +34,14 @@ if ! cd "$INPUT_WORKDIR"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Apply patches
|
||||
echo ::group::Applying patches to Buildozer
|
||||
if ! python3 /action/patches.py; then
|
||||
echo ::error::Error while running patches.py
|
||||
# exit 1 # Allow to fail
|
||||
fi
|
||||
echo ::endgroup::
|
||||
|
||||
# Run command
|
||||
if ! sh -c "$INPUT_COMMAND"; then
|
||||
echo ::error::Error while executing command \""$INPUT_COMMAND"\"
|
||||
|
|
20
patches.py
Normal file
20
patches.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import os
|
||||
import buildozer
|
||||
|
||||
print("Changing global_buildozer_dir")
|
||||
source = open(buildozer.__file__, "r", encoding="utf-8").read()
|
||||
new_source = source.replace(
|
||||
"""
|
||||
@property
|
||||
def global_buildozer_dir(self):
|
||||
return join(expanduser('~'), '.buildozer')
|
||||
""",
|
||||
f"""
|
||||
@property
|
||||
def global_buildozer_dir(self):
|
||||
return '{os.environ["GITHUB_WORKSPACE"]}/.buildozer_global'
|
||||
""",
|
||||
)
|
||||
if new_source == source:
|
||||
print("::warning::Cannot change global buildozer directory. Update buildozer-action to new version or create a Bug Request")
|
||||
open(buildozer.__file__, "w", encoding="utf-8").write(new_source)
|
Loading…
Reference in a new issue