137 lines
4.5 KiB
YAML
137 lines
4.5 KiB
YAML
name: Build Linux and Android
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags:
|
|
- "**"
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "*.md"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "*.md"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
QT_VERSION: "6.11.1"
|
|
ANDROID_NDK_VERSION: "27.2.12479018"
|
|
# Bump the rN suffix whenever the Dockerfile toolchain must be rebuilt.
|
|
REGISTRY: "registry.brunner.ninja"
|
|
BUILD_IMAGE: "registry.brunner.ninja/feedc0de/evcharger-app:qt-6.11.1-r1"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
# Register a trusted host-mode runner with this label. It only needs
|
|
# Podman, Bash, Git, and Node.js for the actions used below.
|
|
runs-on: linux_amd64
|
|
timeout-minutes: 180
|
|
|
|
steps:
|
|
- name: Check out source and submodules
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 1
|
|
|
|
- name: Restore compiler and Gradle caches
|
|
uses: https://gitea.com/actions/cache@v4
|
|
with:
|
|
path: |
|
|
.ccache
|
|
.gradle/caches
|
|
.gradle/wrapper
|
|
key: evcharger-${{ runner.os }}-qt-6.11.1-${{ gitea.ref_name }}
|
|
restore-keys: |
|
|
evcharger-${{ runner.os }}-qt-6.11.1-
|
|
|
|
- name: Pull or publish the pinned Qt toolchain image
|
|
env:
|
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
run: |
|
|
set -Eeuo pipefail
|
|
: "${REGISTRY_USERNAME:?REGISTRY_USERNAME secret is required to access the toolchain image}"
|
|
: "${REGISTRY_PASSWORD:?REGISTRY_PASSWORD secret is required to access the toolchain image}"
|
|
|
|
auth_file="${RUNNER_TEMP:-/tmp}/evcharger-registry-auth-${GITHUB_RUN_ID}.json"
|
|
export REGISTRY_AUTH_FILE="$auth_file"
|
|
trap 'rm -f -- "$auth_file"' EXIT
|
|
printf '%s' "$REGISTRY_PASSWORD" | podman login "$REGISTRY" \
|
|
--username "$REGISTRY_USERNAME" \
|
|
--password-stdin
|
|
|
|
if podman pull "$BUILD_IMAGE"; then
|
|
echo "Using published toolchain image: $BUILD_IMAGE"
|
|
else
|
|
echo "Toolchain image is not published yet; building $BUILD_IMAGE"
|
|
podman build --pull=always \
|
|
--layers \
|
|
--tag "$BUILD_IMAGE" \
|
|
.
|
|
podman push "$BUILD_IMAGE"
|
|
fi
|
|
|
|
- name: Build Linux development executable
|
|
run: |
|
|
set -Eeuo pipefail
|
|
podman run --rm \
|
|
--userns=keep-id \
|
|
--user "$(id -u):$(id -g)" \
|
|
--env HOME=/tmp/ci-home \
|
|
--env CI_WORKSPACE=/workspace \
|
|
--env CCACHE_DIR=/workspace/.ccache \
|
|
--volume "$GITHUB_WORKSPACE:/workspace" \
|
|
--workdir /workspace \
|
|
"$BUILD_IMAGE" \
|
|
bash ci/build-linux.sh
|
|
|
|
- name: Build Android APK and Play bundle
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
|
|
ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_STORE_PASS }}
|
|
ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_KEYSTORE_KEY_PASS }}
|
|
run: |
|
|
set -Eeuo pipefail
|
|
podman run --rm \
|
|
--userns=keep-id \
|
|
--user "$(id -u):$(id -g)" \
|
|
--env HOME=/tmp/ci-home \
|
|
--env CI_WORKSPACE=/workspace \
|
|
--env CI_RUN_NUMBER="$GITHUB_RUN_NUMBER" \
|
|
--env CI_REF_NAME="$GITHUB_REF_NAME" \
|
|
--env CI_REF_TYPE="$GITHUB_REF_TYPE" \
|
|
--env CCACHE_DIR=/workspace/.ccache \
|
|
--env GRADLE_USER_HOME=/workspace/.gradle \
|
|
--env ANDROID_KEYSTORE_BASE64 \
|
|
--env ANDROID_KEYSTORE_ALIAS \
|
|
--env ANDROID_KEYSTORE_STORE_PASS \
|
|
--env ANDROID_KEYSTORE_KEY_PASS \
|
|
--volume "$GITHUB_WORKSPACE:/workspace" \
|
|
--workdir /workspace \
|
|
"$BUILD_IMAGE" \
|
|
bash ci/build-android.sh
|
|
|
|
- name: Upload Linux build
|
|
uses: https://gitea.com/actions/upload-artifact@v4
|
|
with:
|
|
name: evcharger-linux
|
|
path: dist/linux/
|
|
if-no-files-found: error
|
|
retention-days: 30
|
|
|
|
- name: Upload Android APK and AAB
|
|
uses: https://gitea.com/actions/upload-artifact@v4
|
|
with:
|
|
name: evcharger-android
|
|
path: dist/android/
|
|
if-no-files-found: error
|
|
retention-days: 30
|