Skip to content

Commit 87849a0

Browse files
author
zhouwg
committed
ci: fix issue in android build(#12638)
1 parent e391d3e commit 87849a0

File tree

1 file changed

+102
-92
lines changed

1 file changed

+102
-92
lines changed

.github/workflows/build.yml

Lines changed: 102 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,103 +1471,113 @@ jobs:
14711471
key: android-build
14721472
evict-old-files: 1d
14731473

1474-
- name: Set up JDK
1475-
uses: actions/setup-java@v3
1476-
with:
1477-
java-version: 17
1478-
distribution: zulu
1479-
1480-
- name: Setup Android SDK
1481-
uses: android-actions/setup-android@v3
1482-
with:
1483-
log-accepted-android-sdk-licenses: false
1474+
# - name: Set up JDK
1475+
# uses: actions/setup-java@v3
1476+
# with:
1477+
# java-version: 17
1478+
# distribution: zulu
1479+
#
1480+
# - name: Setup Android SDK
1481+
# uses: android-actions/setup-android@v3
1482+
# with:
1483+
# log-accepted-android-sdk-licenses: false
14841484

1485-
- name: Build
1485+
- name: Dependencies
14861486
run: |
1487-
cd examples/llama.android
1488-
1489-
./gradlew build --no-daemon
1490-
1491-
release:
1492-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1493-
1494-
runs-on: ubuntu-latest
1495-
1496-
needs:
1497-
- ubuntu-cpu-cmake
1498-
- ubuntu-22-cmake-vulkan
1499-
- windows-latest-cmake
1500-
- windows-2019-cmake-cuda
1501-
- windows-latest-cmake-sycl
1502-
- windows-latest-cmake-hip-release
1503-
- macOS-latest-cmake-arm64
1504-
- macOS-latest-cmake-x64
1505-
1506-
steps:
1507-
- name: Clone
1508-
id: checkout
1509-
uses: actions/checkout@v4
1510-
with:
1511-
fetch-depth: 0
1512-
1513-
- name: ccache
1514-
uses: hendrikmuhs/[email protected]
1515-
with:
1516-
key: release
1517-
evict-old-files: 1d
1487+
sudo apt-get update
1488+
sudo apt-get install build-essential
1489+
sudo apt-get install cmake
1490+
export PWD=`pwd`
1491+
export ANDROID_PLATFORM=android-34
1492+
export ANDROID_NDK=${PWD}/android-ndk-r26c
1493+
wget --no-config --quiet --show-progress -O android-ndk-r26c-linux.zip https://dl.google.com/android/repository/android-ndk-r26c-linux.zip
1494+
unzip android-ndk-r26c-linux.zip
15181495
1519-
- name: Determine tag name
1520-
id: tag
1521-
shell: bash
1496+
- name: Build
15221497
run: |
1523-
BUILD_NUMBER="$(git rev-list --count HEAD)"
1524-
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
1525-
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
1526-
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
1527-
else
1528-
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
1529-
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
1530-
fi
1531-
1532-
- name: Download artifacts
1533-
id: download-artifact
1534-
uses: actions/download-artifact@v4
1535-
with:
1536-
path: ./artifact
1537-
1538-
- name: Move artifacts
1539-
id: move_artifacts
1540-
run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
1541-
1542-
- name: Create release
1543-
id: create_release
1544-
uses: ggml-org/action-create-release@v1
1545-
env:
1546-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1547-
with:
1548-
tag_name: ${{ steps.tag.outputs.name }}
1498+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_OPENMP=OFF -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=latest -DCMAKE_C_FLAGS=-march=armv8.7-a
1499+
cmake --build build -j $(nproc)
15491500
1550-
- name: Upload release
1551-
id: upload_release
1552-
uses: actions/github-script@v3
1553-
with:
1554-
github-token: ${{secrets.GITHUB_TOKEN}}
1555-
script: |
1556-
const path = require('path');
1557-
const fs = require('fs');
1558-
const release_id = '${{ steps.create_release.outputs.id }}';
1559-
for (let file of await fs.readdirSync('./artifact/release')) {
1560-
if (path.extname(file) === '.zip') {
1561-
console.log('uploadReleaseAsset', file);
1562-
await github.repos.uploadReleaseAsset({
1563-
owner: context.repo.owner,
1564-
repo: context.repo.repo,
1565-
release_id: release_id,
1566-
name: file,
1567-
data: await fs.readFileSync(`./artifact/release/${file}`)
1568-
});
1569-
}
1570-
}
1501+
# release:
1502+
# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1503+
#
1504+
# runs-on: ubuntu-latest
1505+
#
1506+
# needs:
1507+
# - ubuntu-cpu-cmake
1508+
# - ubuntu-22-cmake-vulkan
1509+
# - windows-latest-cmake
1510+
# - windows-2019-cmake-cuda
1511+
# - windows-latest-cmake-sycl
1512+
# - windows-latest-cmake-hip-release
1513+
# - macOS-latest-cmake-arm64
1514+
# - macOS-latest-cmake-x64
1515+
#
1516+
# steps:
1517+
# - name: Clone
1518+
# id: checkout
1519+
# uses: actions/checkout@v4
1520+
# with:
1521+
# fetch-depth: 0
1522+
#
1523+
# - name: ccache
1524+
# uses: hendrikmuhs/[email protected]
1525+
# with:
1526+
# key: release
1527+
# evict-old-files: 1d
1528+
#
1529+
# - name: Determine tag name
1530+
# id: tag
1531+
# shell: bash
1532+
# run: |
1533+
# BUILD_NUMBER="$(git rev-list --count HEAD)"
1534+
# SHORT_HASH="$(git rev-parse --short=7 HEAD)"
1535+
# if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
1536+
# echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
1537+
# else
1538+
# SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
1539+
# echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
1540+
# fi
1541+
#
1542+
# - name: Download artifacts
1543+
# id: download-artifact
1544+
# uses: actions/download-artifact@v4
1545+
# with:
1546+
# path: ./artifact
1547+
#
1548+
# - name: Move artifacts
1549+
# id: move_artifacts
1550+
# run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
1551+
#
1552+
# - name: Create release
1553+
# id: create_release
1554+
# uses: ggml-org/action-create-release@v1
1555+
# env:
1556+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1557+
# with:
1558+
# tag_name: ${{ steps.tag.outputs.name }}
1559+
#
1560+
# - name: Upload release
1561+
# id: upload_release
1562+
# uses: actions/github-script@v3
1563+
# with:
1564+
# github-token: ${{secrets.GITHUB_TOKEN}}
1565+
# script: |
1566+
# const path = require('path');
1567+
# const fs = require('fs');
1568+
# const release_id = '${{ steps.create_release.outputs.id }}';
1569+
# for (let file of await fs.readdirSync('./artifact/release')) {
1570+
# if (path.extname(file) === '.zip') {
1571+
# console.log('uploadReleaseAsset', file);
1572+
# await github.repos.uploadReleaseAsset({
1573+
# owner: context.repo.owner,
1574+
# repo: context.repo.repo,
1575+
# release_id: release_id,
1576+
# name: file,
1577+
# data: await fs.readFileSync(`./artifact/release/${file}`)
1578+
# });
1579+
# }
1580+
# }
15711581

15721582
# ubuntu-latest-gcc:
15731583
# runs-on: ubuntu-latest

0 commit comments

Comments
 (0)