Files

74 lines
3.0 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
lists-and-tools:
name: Lists, tools and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Tools virtualenv
run: |
python3 -m venv tools/venv
tools/venv/bin/pip install -q -r tools/requirements.txt
- name: Example lists, README tables, shell helpers
env:
CLEANYOURTV_STRICT: ${{ github.event_name == 'push' && '1' || '' }}
# The venv interpreter, not the runner's python3: the runner has no adb_shell, so
# running the suite with it leaves test_tv_reboot to its child-rerun workaround
# instead of running in-process (#1800).
run: tools/venv/bin/python -m unittest discover -s tests -v
tables:
# Main only: a list PR adds just its folder and tv.json, so on a pull request the tables lag on purpose.
# A job of its own, so "the tables want regenerating" never reads as "the lists are broken": the merge
# bot waits for main to be green between merges and regenerates the tables after the wave.
name: README tables
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: README TV tables match examples/*/tv.json
run: |
python3 tools/gen_tables.py --check || {
echo "::error::README.md and examples/README.md are generated from examples/*/tv.json. A maintainer runs python3 tools/gen_tables.py on main and commits the result; contributors never need to."
exit 1
}
launcher:
name: Launcher build and unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
with:
distribution: temurin
java-version: "17"
- uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
with:
packages: platforms;android-34 build-tools;34.0.0
- uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
- name: Unit tests, lint and release build
working-directory: launcher
run: |
chmod +x gradlew
./gradlew --no-daemon testReleaseUnitTest lintRelease assembleRelease
- name: The launcher stays small
run: |
size=$(stat -c %s launcher/app/build/outputs/apk/release/app-release.apk)
echo "release APK: $((size / 1024)) KB"
test "$size" -lt 589824 || { echo "APK is over 576 KB; the launcher targets 1 GB TVs, keep it small"; exit 1; }