Skip to content

fdroid_build

fdroid_build #290

Workflow file for this run

name: F-Droid
on:
pull_request:
paths:
- '.github/workflows/fdroid.yml'
- 'app/org.fcitx.fcitx5.android.yml'
workflow_dispatch:
inputs:
build_number:
description: build number on Jenkins Job fcitx5-android
type: string
required: true
default: lastSuccessfulBuild
repository_dispatch:
defaults:
run:
shell: bash
jobs:
fdroid-build:
runs-on: ubuntu-24.04
container: registry.gitlab.com/fdroid/fdroidserver:buildserver-bookworm
strategy:
matrix:
abi:
- armeabi-v7a
- arm64-v8a
- x86
- x86_64
fail-fast: false
steps:
- name: Fetch fdroiddata
uses: actions/checkout@v4
with:
repository: f-droid/fdroiddata
- name: Fetch fdroidserver
uses: actions/checkout@v4
with:
repository: f-droid/fdroidserver
path: fdroidserver
- name: Setup fdroidserver
run: |
source /etc/profile.d/bsenv.sh
rm -rf $fdroidserver
mv $GITHUB_WORKSPACE/fdroidserver $fdroidserver
rm -rf $ANDROID_HOME/tools
sdkmanager "tools" "platform-tools"
for d in logs tmp unsigned $home_vagrant/metadata $home_vagrant/.android $home_vagrant/.gradle $ANDROID_HOME; do
test -d $d || mkdir $d;
chown -R vagrant $d;
done
ln -s $home_vagrant/.gradle $GITHUB_WORKSPACE/.gradle
ln -s $GITHUB_WORKSPACE/tmp $home_vagrant/tmp
ln -s $GITHUB_WORKSPACE/srclibs $home_vagrant/srclibs
mv $GITHUB_WORKSPACE/build $home_vagrant/build
ln -s $home_vagrant/build $GITHUB_WORKSPACE/build
chown -R vagrant $GITHUB_WORKSPACE
- name: Build
env:
BUILD_NUMBER: ${{ inputs.build_number || 'lastSuccessfulBuild' }}
run: |
set -x
# prevent prebuilder from writing to build summary file
unset GITHUB_ACTIONS GITHUB_STEP_SUMMARY
curl -Lo /usr/bin/yq "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64"
chmod +x /usr/bin/yq
build_metadata=$(curl "https://jenkins.fcitx-im.org/job/android/job/fcitx5-android/$BUILD_NUMBER/artifact/out/build-metadata.json")
versionName=$(echo $build_metadata | yq ".versionName")
commitHash=$(echo $build_metadata | yq ".commitHash")
timestamp=$(echo $build_metadata | yq ".timestamp")
baseVersionCode=$(curl -L "https://github.com/fcitx5-android/fcitx5-android/raw/$commitHash/build-logic/convention/src/main/kotlin/Versions.kt" | grep "baseVersionCode =" | sed 's/.*= //')
declare -A abi_list
abi_list=([armeabi-v7a]=1 [arm64-v8a]=2 [x86]=3 [x86_64]=4)
i=${abi_list[${{ matrix.abi }}]}
versionCode=$(($baseVersionCode * 10 + $i))
source /etc/profile.d/bsenv.sh
metadata="$home_vagrant/metadata/org.fcitx.fcitx5.android.yml"
curl -Lo $metadata "https://github.com/${{ github.repository }}/raw/${{ github.sha }}/app/org.fcitx.fcitx5.android.yml"
sed -i s/%ts/$timestamp/g $metadata
sed -i s/%abi/${{ matrix.abi }}/g $metadata
yq -i ".Builds[0] |=
(.versionName = \"$versionName\") |=
(.versionCode = $versionCode) |=
(.commit = \"$commitHash\")
" $metadata
# TODO: remove this afterwards
# https://github.com/orgs/community/discussions/26676
yq -i ".Builds[0] |=
(.commit = \"${{ github.event.pull_request.head.sha }}\")
" $metadata
prebuiltTreeURL=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/contents/lib/fcitx5/src/main/cpp/prebuilt?ref=${{ github.sha }}" \
| yq .html_url)
prebuilderSHA=$(curl -L "${prebuiltTreeURL/\/tree\//\/raw\/}/toolchain-versions.json" | yq ".prebuilder")
yq -i ".Builds[0].srclibs[0] |=
\"fcitx5-android-prebuilder@${prebuilderSHA}\"
" $metadata
yq ".Builds[0]" $metadata
cp $metadata $GITHUB_WORKSPACE/metadata
fdroid="sudo --preserve-env --user vagrant
env HOME=$home_vagrant
PYTHONPATH=$fdroidserver:$fdroidserver/examples
PYTHONUNBUFFERED=true
GRADLE_USER_HOME=$home_vagrant/.gradle
$fdroidserver/fdroid"
build="org.fcitx.fcitx5.android:$versionCode"
chown -R vagrant $home_vagrant
$fdroid fetchsrclibs $build --verbose
cd $home_vagrant
$fdroid build --verbose --test --scan-binary --on-server --no-tarball $build
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: fdroid-${{ matrix.abi }}
path: tmp/
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy