84 lines (71 loc) · 2.47 KB
/
build_native_runtime.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
name: Build Native Runtime
env:
CXX: clang++
CC: clang
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build_native_runtime:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, self-hosted]
steps:
- name: Detect runner CPU architecture
run: |
echo "CPU_ARCH=$(uname -m)" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Set up JDK 11.0.8
uses: actions/setup-java@v1
with:
java-version: 11.0.8
- name: Cache ICU build output
id: cache-icu
uses: actions/cache@v2
with:
path: ~/icu-bin
key: ${{ runner.os }}-${{env.CPU_ARCH}}-icu-${{ hashFiles('nativeruntime/external/icu/**') }}
- name: Build ICU for MacOS
if: runner.os =='macOS' && steps.cache-icu.outputs.cache-hit != 'true'
run: |
cd nativeruntime/external/icu/icu4c/source
./runConfigureICU MacOSX --enable-static --prefix=$HOME/icu-bin
make -j4
make install
- name: Build ICU for Linux
if: runner.os == 'Linux' && steps.cache-icu.outputs.cache-hit != 'true'
run: |
export CFLAGS="$CFLAGS -fPIC"
export CXXFLAGS="$CXXFLAGS -fPIC"
cd nativeruntime/external/icu/icu4c/source
./runConfigureICU Linux --enable-static --prefix=$HOME/icu-bin
make -j4
make install
- name: Run CMake
run: |
mkdir build
cd build
ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp
make
- name: Rename libnativeruntime for Linux
if: runner.os == 'Linux'
run: |
echo "NATIVERUNTIME_ARTIFACT_FILE=librobolectric-nativeruntime-linux-x86_64.so" >> $GITHUB_ENV
mv build/libnativeruntime.so build/librobolectric-nativeruntime-linux-x86_64.so
- name: Rename libnativeruntime for macOS
if: runner.os == 'macOS'
run: |
echo "NATIVERUNTIME_ARTIFACT_FILE=librobolectric-nativeruntime-mac-$(uname -m).dylib" >> $GITHUB_ENV
mv build/libnativeruntime.dylib build/librobolectric-nativeruntime-mac-$(uname -m).dylib
- name: Upload libnativeruntime
uses: actions/upload-artifact@v2
with:
name: ${{env.NATIVERUNTIME_ARTIFACT_FILE}}
path: |
build/${{env.NATIVERUNTIME_ARTIFACT_FILE}}