-
Notifications
You must be signed in to change notification settings - Fork 1.4k
141 lines (122 loc) · 4.54 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
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
name: Build Native Runtime
on:
push:
branches: [ master ]
pull_request:
branches: [ master, google ]
jobs:
build_native_runtime:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, self-hosted, windows-2019]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
# msys2 only log not fail on non-Windows platform.
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
platform-check-severity: warn
location: D:\
install: >-
make
mingw-w64-x86_64-gcc
mingw-w64-x86_64-ninja
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install build tools (Mac OS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install ninja-build
- name: Cache ICU build output (Non Windows)
id: cache-icu
uses: actions/cache@v2
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
path: ~/icu-bin
key: ${{ runner.os }}-${{ runner.arch }}-icu-${{ hashFiles('nativeruntime/external/icu/**') }}
- name: Cache ICU build output (Windows)
id: cache-icu-windows
uses: actions/cache@v2
if: runner.os == 'Windows'
with:
path: D:\msys64\home\runneradmin\icu-bin
key: ${{ runner.os }}-${{ runner.arch }}-icu-windows-${{ 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: Build ICU for Windows
if: runner.os == 'Windows' && steps.cache-icu-windows.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
cd nativeruntime/external/icu/icu4c/source
./runConfigureICU MinGW --enable-static --prefix=$HOME/icu-bin
make -j4
make install
- name: Run CMake (Non Windows)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
mkdir build
cd build
ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp -G Ninja
ninja
- name: Run CMake (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
mkdir build
cd build
ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp -G Ninja
ninja
- 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: Rename libnativeruntime for Windows
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
mv build/libnativeruntime.dll build/robolectric-nativeruntime-windows-x86_64.dll
- name: Upload libnativeruntime (Non Windows)
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: actions/upload-artifact@v2
with:
name: ${{env.NATIVERUNTIME_ARTIFACT_FILE}}
path: |
build/${{env.NATIVERUNTIME_ARTIFACT_FILE}}
- name: Upload libnativeruntime (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v2
with:
name: robolectric-nativeruntime-windows-x86_64.dll
path: |
build/robolectric-nativeruntime-windows-x86_64.dll