-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (80 loc) · 3.38 KB
/
skia-android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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:$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" && \
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: 4 上传到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