115 lines
3.6 KiB
YAML
115 lines
3.6 KiB
YAML
name: Build Linux and Android
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags:
|
|
- "**"
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
QT_VERSION: "6.11.1"
|
|
ANDROID_NDK_VERSION: "27.2.12479018"
|
|
BUILD_IMAGE: "evcharger-ci:qt-6.11.1-${{ gitea.sha }}"
|
|
BUILD_CACHE_IMAGE: "evcharger-ci:qt-6.11.1-cache"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
# Register a trusted host-mode runner with this label. It only needs
|
|
# Docker, 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: Build the pinned Qt toolchain image
|
|
run: |
|
|
set -Eeuo pipefail
|
|
docker image inspect "$BUILD_CACHE_IMAGE" >/dev/null 2>&1 || true
|
|
docker build --pull \
|
|
--cache-from "$BUILD_CACHE_IMAGE" \
|
|
--tag "$BUILD_IMAGE" \
|
|
.
|
|
docker tag "$BUILD_IMAGE" "$BUILD_CACHE_IMAGE"
|
|
|
|
- name: Build Linux development executable
|
|
run: |
|
|
set -Eeuo pipefail
|
|
docker run --rm \
|
|
--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
|
|
docker run --rm \
|
|
--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
|
|
|
|
- name: Remove the commit-specific image tag
|
|
if: always()
|
|
run: docker image rm "$BUILD_IMAGE" >/dev/null 2>&1 || true
|