mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-22 07:13:13 +01:00
Upgrade CI workflow (#111)
* Cache dependencies on CI workflow * Use available fontforge version for CI action Avoid a dirty OS upgrade to get a newer version of FontForge, use what is available at Ubuntu 20.04 * Upgrade CI Workflow By using an appimage of FontForge, it's easier to install the latest version, to cache it, and there is no extra dependencies clashes with Ubuntu 20.04 * Make paths for fontforge absolute in makefile It's necessary because fontforge is an AppImage and requires it * Improve cache step on CI wget don't download a duplicate if file already exists * Generate base64 ascii encoded debug keystore That can be used to transfer the keystore to a Github Secret * Restore debug.keystore from github secrets Get the asc encoded keystore from github secrets, and decode it back to a bynary file inside the CI run. * Cleanup redundant lines and add explanation comment * runs-on ubuntu-latest Co-authored-by: Jules Aguillon <jules@j3s.fr> * add *.keystore.asc to .gitignore * Clean up lines, adjust documentation * use CURDIR automatic makefile variable Co-authored-by: Jules Aguillon <jules@j3s.fr>
This commit is contained in:
parent
2b6c2b98e0
commit
723c7e9aec
33
.github/workflows/make-apk.yml
vendored
33
.github/workflows/make-apk.yml
vendored
@ -9,17 +9,19 @@ jobs:
|
|||||||
Build-Apk:
|
Build-Apk:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install nix
|
- name: Cache fontforge and extra dependencies
|
||||||
uses: cachix/install-nix-action@v15
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
|
||||||
- name: Cache Nix store
|
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: /nix
|
path: /usr/local/bin
|
||||||
key: nix-store
|
key: usr-local-bin
|
||||||
- name: Install external dependencies
|
- name: Install latest FontForge version (using AppImage)
|
||||||
run: nix-env -f '<nixpkgs>' -i fontforge
|
run: |
|
||||||
|
# Get most recent version of FontForge
|
||||||
|
# Using AppImage there is no dependecy problem, it is the latest version and it's easier to cache
|
||||||
|
cd /usr/local/bin
|
||||||
|
sudo wget -c -N https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage
|
||||||
|
sudo chmod +x ./FontForge-2022-03-08-582bd41-x86_64.AppImage
|
||||||
|
sudo ln --symbolic --force /usr/local/bin/FontForge-2022-03-08-582bd41-x86_64.AppImage /usr/local/bin/fontforge
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
@ -31,6 +33,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: _build/debug.keystore
|
path: _build/debug.keystore
|
||||||
key: debug-keystore
|
key: debug-keystore
|
||||||
|
- name: Restore debug keystore from github Secrets
|
||||||
|
run: |
|
||||||
|
mkdir -p _build
|
||||||
|
cd "$GITHUB_WORKSPACE/_build"
|
||||||
|
# Check if exist and use the secret named DEBUG_KEYSTORE
|
||||||
|
# The contents of the secret can be obtained -
|
||||||
|
# from the debug.keystore.asc from you local _build folder
|
||||||
|
if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" == "" ]]; then
|
||||||
|
echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc"
|
||||||
|
if [[ -s "debug.keystore.asc" ]]; then
|
||||||
|
gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make
|
run: make
|
||||||
- name: Save debug apk
|
- name: Save debug apk
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.keystore
|
*.keystore
|
||||||
|
*.keystore.asc
|
||||||
_build
|
_build
|
||||||
/*-keystore.conf
|
/*-keystore.conf
|
||||||
|
@ -23,6 +23,24 @@ make
|
|||||||
If the build succeed, the debug apk is located in
|
If the build succeed, the debug apk is located in
|
||||||
`_build/juloo.keyboard2.debug.apk`.
|
`_build/juloo.keyboard2.debug.apk`.
|
||||||
|
|
||||||
|
## Using the local debug.keystore on the Github CI actions
|
||||||
|
|
||||||
|
It's possible to save the local debug.keystore into a github secret, so the same keystore is utilized to build the debug apk in the CI github actions.
|
||||||
|
Doing this, they wil have the same signature, thus the debug apk can be updated without having to uninstall it first.
|
||||||
|
|
||||||
|
After you sucessfully run `make`, (thus a debug.keystore exists) you can use this second command to generate a base64 stringified version of it
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd _build
|
||||||
|
gpg -c --armor --pinentry-mode loopback --passphrase debug0 --yes "debug.keystore"
|
||||||
|
```
|
||||||
|
|
||||||
|
A file will be generated inside the local `_build/` folder, called `debug.keystore.asc`
|
||||||
|
|
||||||
|
You can copy the content of this file, and with that, paste it into a new github secret in your repo settings.
|
||||||
|
|
||||||
|
The secret must be named `DEBUG_KEYSTORE`
|
||||||
|
|
||||||
## Debugging on your phone
|
## Debugging on your phone
|
||||||
|
|
||||||
First [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb#Enabling).
|
First [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb#Enabling).
|
||||||
|
6
Makefile
6
Makefile
@ -97,12 +97,12 @@ $(R_FILE): $(RES_FILES) $(MANIFEST_FILE)
|
|||||||
|
|
||||||
# Special font
|
# Special font
|
||||||
|
|
||||||
SPECIAL_FONT_GLYPHS = $(wildcard srcs/special_font/*.svg)
|
SPECIAL_FONT_GLYPHS = $(wildcard $(CURDIR)/srcs/special_font/*.svg)
|
||||||
SPECIAL_FONT_SCRIPT = srcs/special_font/build.pe
|
SPECIAL_FONT_SCRIPT = $(CURDIR)/srcs/special_font/build.pe
|
||||||
|
|
||||||
_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS)
|
_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS)
|
||||||
mkdir -p $(@D)
|
mkdir -p $(@D)
|
||||||
fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $@ $(SPECIAL_FONT_GLYPHS)
|
fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $(CURDIR)/$@ $(SPECIAL_FONT_GLYPHS)
|
||||||
|
|
||||||
# Compile java classes and build classes.dex
|
# Compile java classes and build classes.dex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user