安卓libskia.so(darkblade) #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 安卓libskia.so(darkblade) | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: "安卓libskia.so(darkblade)" | |
runs-on: ubuntu-latest | |
steps: | |
# 卸载gcc再安装clang试试 | |
- name: 1 安装依赖 | |
run: | | |
sudo apt update && \ | |
sudo apt remove -y gcc && \ | |
sudo apt install -y sudo git nano python3 xz-utils bzip2 clang wget unzip && \ | |
wget https://dl.google.com/android/repository/android-ndk-r26d-linux.zip && \ | |
unzip android-ndk-r26d-linux.zip | |
- name: 2 克隆仓库 | |
run: | | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git && \ | |
git clone https://skia.googlesource.com/skia.git | |
- name: 3 配置环境 & 编译 | |
run: | | |
echo -e "\n\n导出环境变量\n\n" && \ | |
export SHARE_DIR=$(pwd) && \ | |
export PATH=$SHARE_DIR/depot_tools:$SHARE_DIR/bin:$PATH && \ | |
echo -e "\n\n进入skia文件夹\n\n" && \ | |
cd skia && \ | |
echo -e "\n\n下载依赖工具\n\n" && \ | |
python3 tools/git-sync-deps && \ | |
echo -e "\n\n下载ninja\n\n" && \ | |
bin/fetch-ninja && \ | |
echo -e "\n\n生成gn配置文件\n\n" && \ | |
rm -rf out/arm && \ | |
export outdir=out/arm && export argsgn=$outdir/args.gn && \ | |
mkdir -p $outdir && touch $argsgn && \ | |
echo is_component_build=true >> $argsgn && \ | |
echo target_os=\"android\" >> $argsgn && \ | |
echo is_debug=false >> $argsgn && \ | |
echo ndk_api=23 >> $argsgn && \ | |
echo target_cpu=\"arm\" >> $argsgn && \ | |
echo ndk=\"$SHARE_DIR/android-ndk-r26d\" >> $argsgn && \ | |
bin/gn gen $outdir && \ | |
echo -e "\n\n使用ninja编译\n\n" && \ | |
ninja -C $outdir -j4 && \ | |
echo -e "\n\nninja编译完成\n\n" | |
# - name: 4. 恢复缓存 | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# ~/.gradle/caches | |
# ~/.gradle/wrapper | |
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
# restore-keys: | | |
# ${{ runner.os }}-gradle- | |
# 为什么bin/gn会找不到啊,ls bin 里也有gn啊,手动 bin/fetch-gn试试? | |
# 啊因为每个run都是单独的进程,所以上个run里cd skia了不行,这里退回到默认目录了 | |
# 还有 gn的 --args后面不能用斜线换行。。 | |
# 那环境变量也不起作用了啊,算了还是都放一个run里吧 | |
# ninja那一步,有个缺/cpu-features.c的报错。根据https://blog.csdn.net/u010536615/article/details/53265597 | |
# 可能是有残留缓存所以冲突?删除obj/local | |
# 啊不对,是我cd skia之后,ndk文件夹目录应该变成上一级的了。。。指定目录写错了 | |
# 用.. 也不对,因为ninja编译的时候还会进入out/arm。。。最好想办法写成绝对路径,但是参数里又不支持引用。。 | |
# 那就导出到环境变量然后拼接吧。。 | |
- name: 6 上传到artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libskia.so | |
path: ./skia/out/arm/libskia.so | |
- name: 7 上传到release | |
uses: andelf/nightly-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: libskia-android | |
name: 'android libskia.so $$' | |
draft: false | |
prerelease: false | |
body: | | |
Based on ${{ github.sha }} | |
files: | | |
./skia/out/arm/libskia.so |