-
-
Notifications
You must be signed in to change notification settings - Fork 28
151 lines (148 loc) Β· 10.9 KB
/
release-for-arm.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
on:
release:
types: [created]
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
#- arm-unknown-linux-gnueabi
#- armv7-linux-androideabi
#- aarch64-linux-android
#- x86_64-linux-android
#- i686-linux-android
steps:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.37
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v5
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install Android NDK
if: matrix.target == 'aarch64-linux-android' || matrix.target == 'i686-linux-android' || matrix.target == 'x86_64-linux-android' || matrix.target == 'armv7-linux-androideabi'
run: |
wget https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip
unzip android-ndk-r22b-linux-x86_64.zip
wget https://dl.google.com/android/repository/android-ndk-r25b-linux.zip
unzip android-ndk-r25b-linux.zip
cp android-ndk-r22b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21
cp android-ndk-r22b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/libgcc.a android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21
cp android-ndk-r22b/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/libgcc.a android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21
cp android-ndk-r22b/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/libgcc.a android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21
echo "ANDROID_NDK_HOME=$GITHUB_WORKSPACE/android-ndk-r25b" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi-clang
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-clang
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android21-clang $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-clang
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-clang
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++ $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang++
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi-clang++
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-clang++
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android21-clang++ $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-clang++
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang++ $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-clang++
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android-ar
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ar
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi-ar
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
ln -s $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar $GITHUB_WORKSPACE/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
- name: Installing needed dependencies
run: sudo apt-get install -y libasound2-dev protobuf-compiler clang lldb lld
- name: Installing needed Ubuntu arm dependencies
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'armv7-unknown-linux-gnueabihf' || matrix.target == 'arm-unknown-linux-gnueabi'
run: |
sudo mkdir -p /build/sysroot
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ focal main" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=armel] http://ports.ubuntu.com/ubuntu-ports/ focal main" | sudo tee -a /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi gcc-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc pkg-config libudev-dev libssl-dev
sudo apt-get download libasound2:armhf libasound2-dev:armhf libasound2:arm64 libasound2-dev:arm64
sudo dpkg -x libasound2_1.2.2-2.1_armhf.deb /build/sysroot/
sudo dpkg -x libasound2_1.2.2-2.1_arm64.deb /build/sysroot/
sudo dpkg -x libasound2-dev_1.2.2-2.1_armhf.deb /build/sysroot/
sudo dpkg -x libasound2-dev_1.2.2-2.1_arm64.deb /build/sysroot//
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "C_INCLUDE_PATH=/build/sysroot/usr/include" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
run: |
echo "RUSTFLAGS=-C linker=arm-linux-gnueabihf-gcc -L/usr/arm-linux-gnueabihf/lib -L/build/sysroot/usr/lib/arm-linux-gnueabihf -L/build/sysroot/lib/arm-linux-gnueabihf" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'arm-unknown-linux-gnueabi'
run: |
echo "RUSTFLAGS=-C linker=arm-linux-gnueabi-gcc -L/usr/arm-linux-gnueabi/lib -L/build/sysroot/usr/lib/arm-linux-gnueabi -L/build/sysroot/lib/arm-linux-gnueabi" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "RUSTFLAGS=-C linker=aarch64-linux-gnu-gcc -L/usr/aarch64-linux-gnu/lib -L/build/sysroot/usr/lib/aarch64-linux-gnu -L/build/sysroot/lib/aarch64-linux-gnu" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'aarch64-linux-android'
run: |
echo "RUSTFLAGS=-C linker=aarch64-linux-android-clang -L$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/33 -lc++ -lstdc++ -lc" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'armv7-linux-androideabi'
run: |
echo "RUSTFLAGS=-C linker=armv7a-linux-androideabi-clang -L$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/33 -lc++ -lstdc++ -lc" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'i686-linux-android'
run: |
echo "RUSTFLAGS=-C linker=i686-linux-android-clang -L$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/33 -lc++ -lstdc++ -lc" >> $GITHUB_ENV
- name: Configure Rust FLAGS
if: matrix.target == 'x86_64-linux-android'
run: |
echo "RUSTFLAGS=-C linker=x86_64-linux-android-clang -L$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/33 -lc++ -lstdc++ -lc" >> $GITHUB_ENV
- name: Build webui
run: |
cd webui/musicplayer
bun install && bun run build
- name: Running cargo build
uses: actions-rs/cargo@v1
with:
command: build
toolchain: stable
args: --release --target ${{ matrix.target }}"
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz music-player
shasum -a 256 ../../../music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz > ../../../music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz.sha256
cd ../../../ && rm -rf target
- name: Upload release assets
run: |
for ext in tar.gz tar.gz.sha256; do
export FILE="music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.$ext"
fluentci run github_pipeline release_upload
done
env:
TAG: ${{ env.RELEASE_VERSION }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}